Add migration for external accounts
This commit is contained in:
parent
8f28ac03ee
commit
911ac38d05
3 changed files with 469 additions and 0 deletions
assets/migrations
17
assets/migrations/2_external.up.sql
Normal file
17
assets/migrations/2_external.up.sql
Normal file
|
@ -0,0 +1,17 @@
|
|||
CREATE TABLE "external_auth" (
|
||||
"id" bigserial NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"type" text NOT NULL,
|
||||
"config" jsonb NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
CREATE INDEX ON "external_auth" ("type");
|
||||
|
||||
CREATE TABLE "external_user" (
|
||||
"external_auth_id" bigint NOT NULL,
|
||||
"foreign_id" text NOT NULL,
|
||||
"user_id" bigint NOT NULL,
|
||||
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE,
|
||||
FOREIGN KEY ("external_auth_id") REFERENCES "external_auth" ("id") ON DELETE CASCADE,
|
||||
PRIMARY KEY ("external_auth_id", "foreign_id")
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue