-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from Organisasjonskollegiet/migrate-database
Remove saveAuthUser to fix bug
- Loading branch information
Showing
10 changed files
with
89 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
prisma/migrations/20241017150329_remove_uuid_constraint/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
Warnings: | ||
- The primary key for the `HasVoted` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "HasVoted" DROP CONSTRAINT "HasVoted_userId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Meeting" DROP CONSTRAINT "Meeting_ownerId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Participant" DROP CONSTRAINT "Participant_userId_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "HasVoted" DROP CONSTRAINT "HasVoted_pkey", | ||
ALTER COLUMN "userId" SET DATA TYPE VARCHAR(255), | ||
ADD CONSTRAINT "HasVoted_pkey" PRIMARY KEY ("userId", "votationId"); | ||
|
||
-- AlterTable | ||
ALTER TABLE "Meeting" ALTER COLUMN "ownerId" SET DATA TYPE VARCHAR(255); | ||
|
||
-- AlterTable | ||
ALTER TABLE "Participant" ALTER COLUMN "userId" SET DATA TYPE VARCHAR(255); | ||
|
||
-- AlterTable | ||
ALTER TABLE "User" DROP CONSTRAINT "User_pkey", | ||
ALTER COLUMN "id" SET DATA TYPE VARCHAR(255), | ||
ADD CONSTRAINT "User_pkey" PRIMARY KEY ("id"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Meeting" ADD CONSTRAINT "Meeting_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Participant" ADD CONSTRAINT "Participant_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "HasVoted" ADD CONSTRAINT "HasVoted_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import { createMeeting, createVotation, createAlternative } from '../../../lib/t | |
import { createTestContext } from '../../../lib/tests/testContext'; | ||
import { VotationStatus, Role } from '.prisma/client'; | ||
import { gql } from 'graphql-request'; | ||
|
||
const ctx = createTestContext(); | ||
|
||
const alternativeText = 'alt'; | ||
|
@@ -70,6 +71,7 @@ it('should not cast vote successfully since votation is not ongoing', async () = | |
it('should not cast vote successfully since user is not participant', async () => { | ||
const meetingOwner = await ctx.prisma.user.create({ | ||
data: { | ||
id: '234', // Generate a new UUID for the test user | ||
email: '[email protected]', | ||
password: 'password', | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.