19 lines
776 B
SQL
19 lines
776 B
SQL
CREATE TABLE "records" (
|
|||
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||
|
|
"collection" text NOT NULL,
|
||
|
|
"data" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
||
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||
|
|
);
|
||
|
|
--> statement-breakpoint
|
||
|
|
CREATE TABLE "users" (
|
||
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||
|
|
"email" text NOT NULL,
|
||
|
|
"name" text NOT NULL,
|
||
|
|
"password_hash" text NOT NULL,
|
||
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||
|
|
CONSTRAINT "users_email_unique" UNIQUE("email")
|
||
|
|
);
|
||
|
|
--> statement-breakpoint
|
||
|
|
CREATE INDEX "records_collection_created_at_idx" ON "records" USING btree ("collection","created_at");
|