Skip to content

Commit

Permalink
Update schema.sql
Browse files Browse the repository at this point in the history
For some reason cascade delete does not work without explicitly writing the primary key (id) in the foreign key definition.
  • Loading branch information
baptiste00001 authored Dec 21, 2024
1 parent c695cce commit dd0cd1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/adapter-pg/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CREATE TABLE users
CREATE TABLE accounts
(
id SERIAL,
"userId" INTEGER NOT NULL REFERENCES users ON DELETE CASCADE,
"userId" INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
type VARCHAR(255) NOT NULL,
provider VARCHAR(255) NOT NULL,
"providerAccountId" VARCHAR(255) NOT NULL,
Expand All @@ -32,7 +32,7 @@ CREATE TABLE accounts
CREATE TABLE sessions
(
id SERIAL,
"userId" INTEGER NOT NULL REFERENCES users ON DELETE CASCADE,
"userId" INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
expires TIMESTAMPTZ NOT NULL,
"sessionToken" VARCHAR(255) UNIQUE NOT NULL,

Expand Down

0 comments on commit dd0cd1f

Please sign in to comment.