2020-12-29 13:46:58 +01:00
|
|
|
-- migrate:up
|
|
|
|
|
2021-01-02 11:56:24 +01:00
|
|
|
CREATE TABLE "accounts" (
|
2020-12-29 13:46:58 +01:00
|
|
|
"id" uuid PRIMARY KEY,
|
|
|
|
"created" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
2021-01-02 11:56:24 +01:00
|
|
|
"accountName" text NOT NULL,
|
|
|
|
"apiKey" text,
|
|
|
|
"password" text
|
2020-12-29 13:46:58 +01:00
|
|
|
);
|
2021-01-02 11:56:24 +01:00
|
|
|
CREATE UNIQUE INDEX idx_accountname ON accounts ("accountName");
|
2020-12-29 13:46:58 +01:00
|
|
|
|
2021-01-02 11:56:24 +01:00
|
|
|
CREATE TABLE "accountsFields" (
|
2020-12-29 13:46:58 +01:00
|
|
|
"id" uuid PRIMARY KEY,
|
|
|
|
"created" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
2021-01-02 11:56:24 +01:00
|
|
|
"accountId" uuid NOT NULL,
|
2020-12-29 13:46:58 +01:00
|
|
|
"name" text NOT NULL,
|
|
|
|
"value" text[] NOT NULL
|
|
|
|
);
|
2021-01-02 11:56:24 +01:00
|
|
|
ALTER TABLE "accountsFields"
|
|
|
|
ADD FOREIGN KEY ("accountId") REFERENCES "accounts" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT;
|
|
|
|
CREATE UNIQUE INDEX idx_accountsfields ON "accountsFields" ("accountId", "name");
|
2020-12-29 13:46:58 +01:00
|
|
|
|
|
|
|
-- migrate:down
|