mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-03 03:01:52 +02:00
Create guest user in user table when creating a participant
This commit is contained in:
parent
346ef136f0
commit
65192f95c9
5 changed files with 20 additions and 7 deletions
|
@ -9,8 +9,9 @@ BEGIN
|
|||
WHERE user_id IS NULL
|
||||
LOOP
|
||||
WITH new_user AS (
|
||||
INSERT INTO users (is_guest, created_at)
|
||||
INSERT INTO users (id, is_guest, created_at)
|
||||
VALUES (
|
||||
gen_random_uuid()::text,
|
||||
TRUE,
|
||||
NOW()
|
||||
)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
- Made the column `user_id` on table `participants` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "participants" ALTER COLUMN "user_id" SET NOT NULL;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
-- DropForeignKey
|
||||
ALTER TABLE "participants" DROP CONSTRAINT "participants_user_id_fkey";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "participants" ADD CONSTRAINT "participants_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
Loading…
Add table
Add a link
Reference in a new issue