Files
moeka-project/integrations/satori-bot/drizzle/0000_cooing_captain_flint.sql
T

31 lines
821 B
SQL

CREATE TABLE "channels" (
"id" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"platform" text NOT NULL,
"self_id" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE "event_queue" (
"id" text PRIMARY KEY NOT NULL,
"event" json NOT NULL,
"status" text NOT NULL,
"created_at" bigint NOT NULL
);
--> statement-breakpoint
CREATE TABLE "messages" (
"id" text PRIMARY KEY NOT NULL,
"channel_id" text NOT NULL,
"user_id" text NOT NULL,
"user_name" text NOT NULL,
"content" text NOT NULL,
"timestamp" bigint NOT NULL
);
--> statement-breakpoint
CREATE TABLE "unread_events" (
"id" text PRIMARY KEY NOT NULL,
"channel_id" text NOT NULL,
"event" json NOT NULL,
"created_at" bigint NOT NULL
);
--> statement-breakpoint
CREATE INDEX "channel_timestamp_idx" ON "messages" USING btree ("channel_id","timestamp");