mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Adding relations for reset tokens.
This commit is contained in:
parent
f3cb74ac7a
commit
24004c4533
4 changed files with 1346 additions and 0 deletions
12
drizzle/0015_awesome_gabe_jones.sql
Normal file
12
drizzle/0015_awesome_gabe_jones.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS "password_reset_tokens" (
|
||||||
|
"id" varchar(255) PRIMARY KEY NOT NULL,
|
||||||
|
"user_id" varchar(255) NOT NULL,
|
||||||
|
"expires_at" timestamp (6) with time zone,
|
||||||
|
"created_at" timestamp (6) with time zone DEFAULT now()
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "password_reset_tokens" ADD CONSTRAINT "password_reset_tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
1320
drizzle/meta/0015_snapshot.json
Normal file
1320
drizzle/meta/0015_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -106,6 +106,13 @@
|
||||||
"when": 1708479971410,
|
"when": 1708479971410,
|
||||||
"tag": "0014_organic_morlocks",
|
"tag": "0014_organic_morlocks",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 15,
|
||||||
|
"version": "5",
|
||||||
|
"when": 1709344835732,
|
||||||
|
"tag": "0015_awesome_gabe_jones",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -161,6 +161,13 @@ export const password_reset_tokens = pgTable('password_reset_tokens', {
|
||||||
}).default(sql`now()`)
|
}).default(sql`now()`)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const password_reset_token_relations = relations(password_reset_tokens, ({ one }) => ({
|
||||||
|
user: one(users, {
|
||||||
|
fields: [password_reset_tokens.user_id],
|
||||||
|
references: [users.id]
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
|
||||||
export const collections = pgTable('collections', {
|
export const collections = pgTable('collections', {
|
||||||
id: varchar('id', {
|
id: varchar('id', {
|
||||||
length: 255
|
length: 255
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue