always quote identifiers

This commit is contained in:
AJ ONeal 2020-10-10 14:52:46 -06:00
parent c2e091588b
commit d244cbf589

View File

@ -1,17 +1,33 @@
CREATE extension IF NOT EXISTS pgcrypto; CREATE extension IF NOT EXISTS pgcrypto;
SET TIMEZONE='UTC'; SET TIMEZONE='UTC';
--DROP TABLE IF EXISTS authn; -- AuthN
CREATE TABLE IF NOT EXISTS authn ( --
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), --DROP TABLE IF EXISTS "authn";
ppid TEXT NOT NULL, CREATE TABLE IF NOT EXISTS "authn" (
email TEXT NOT NULL, "id" TEXT PRIMARY KEY DEFAULT gen_random_uuid(),
verified BOOL DEFAULT FALSE, "ppid" TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'UTC'), "email" TEXT NOT NULL,
updated_at TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'UTC'), "verified" BOOL NOT NULL DEFAULT FALSE,
deleted_at TIMESTAMP NOT NULL DEFAULT ('epoch' AT TIME ZONE 'UTC') "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); -- Events
CREATE INDEX IF NOT EXISTS idx_ppid ON authn (ppid); --
CREATE INDEX IF NOT EXISTS idx_email ON authn (email); --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");