Some kind of starting point
This commit is contained in:
21
db/migrations/20201207191913_first.sql
Normal file
21
db/migrations/20201207191913_first.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- migrate:up
|
||||
|
||||
CREATE TABLE "users" (
|
||||
"id" uuid PRIMARY KEY,
|
||||
"created" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"username" text NOT NULL,
|
||||
"password" text NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "usersFields" (
|
||||
"id" uuid PRIMARY KEY,
|
||||
"created" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"userId" uuid NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"value" text[] NOT NULL
|
||||
);
|
||||
ALTER TABLE "usersFields"
|
||||
ADD FOREIGN KEY ("userId") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT;
|
||||
CREATE UNIQUE INDEX idx_usersfields ON "usersFields" ("userId", "name");
|
||||
|
||||
-- migrate:down
|
||||
Reference in New Issue
Block a user