nom-nom-nix-gc/migrations/V1__init.sql

21 lines
441 B
SQL

CREATE TABLE Users (
id uuid,
user_name text NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE Keys (
id integer PRIMARY KEY,
key_dump jsonb NOT NULL,
user_id uuid NOT NULL,
CONSTRAINT fk_user FOREIGN KEY (user_id) REFERENCES Users(id)
);
CREATE TABLE PendingRegistrations (
id uuid,
user_name text NOT NULL
);
-- We'll mostly querying the Keys using the associated uid.
CREATE INDEX idx_keys_uid ON Keys USING HASH (user_id);