always quote identifiers
This commit is contained in:
parent
c2e091588b
commit
d244cbf589
|
@ -1,17 +1,33 @@
|
|||
CREATE extension IF NOT EXISTS pgcrypto;
|
||||
SET TIMEZONE='UTC';
|
||||
|
||||
--DROP TABLE IF EXISTS authn;
|
||||
CREATE TABLE IF NOT EXISTS authn (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
ppid TEXT NOT NULL,
|
||||
email TEXT NOT NULL,
|
||||
verified BOOL DEFAULT FALSE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'UTC'),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'UTC'),
|
||||
deleted_at TIMESTAMP NOT NULL DEFAULT ('epoch' AT TIME ZONE 'UTC')
|
||||
-- AuthN
|
||||
--
|
||||
--DROP TABLE IF EXISTS "authn";
|
||||
CREATE TABLE IF NOT EXISTS "authn" (
|
||||
"id" TEXT PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
"ppid" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL,
|
||||
"verified" BOOL NOT NULL DEFAULT FALSE,
|
||||
"created_at" TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'UTC'),
|
||||
"updated_at" TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'UTC'),
|
||||
"deleted_at" TIMESTAMP NOT NULL DEFAULT ('epoch' AT TIME ZONE 'UTC')
|
||||
);
|
||||
--CREATE INDEX CONCURRENTLY IF NOT EXISTS "idx_slug" ON "authn" ("ppid");
|
||||
CREATE INDEX IF NOT EXISTS "idx_ppid" ON "authn" ("ppid");
|
||||
CREATE INDEX IF NOT EXISTS "idx_email" ON "authn" ("email");
|
||||
|
||||
--CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_slug ON authn (ppid);
|
||||
CREATE INDEX IF NOT EXISTS idx_ppid ON authn (ppid);
|
||||
CREATE INDEX IF NOT EXISTS idx_email ON authn (email);
|
||||
-- Events
|
||||
--
|
||||
--DROP TABLE IF EXISTS "events";
|
||||
CREATE TABLE IF NOT EXISTS "events" (
|
||||
"id" TEXT PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
"action" TEXT NOT NULL,
|
||||
"table" TEXT NOT NULL,
|
||||
"record" TEXT NOT NULL,
|
||||
"by" TEXT NOT NULL,
|
||||
"at" TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'UTC'),
|
||||
);
|
||||
--CREATE INDEX CONCURRENTLY IF NOT EXISTS "idx_record" ON "events" ("record");
|
||||
CREATE INDEX IF NOT EXISTS "idx_record" ON authn ("record");
|
||||
CREATE INDEX IF NOT EXISTS "idx_by" ON authn ("by");
|
||||
|
|
Loading…
Reference in New Issue