Some kind of starting point

This commit is contained in:
2020-12-29 13:46:58 +01:00
commit 1811f200c0
14 changed files with 398 additions and 0 deletions

View 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