Files
manyangles/packages/database/drizzle/0013_assistant_tokens.sql
T

15 lines
641 B
SQL

CREATE TABLE "assistant_tokens" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" text NOT NULL REFERENCES "user"("id") ON DELETE CASCADE,
"name" text NOT NULL,
"token_hash" text NOT NULL UNIQUE,
"permissions" jsonb NOT NULL,
"read_only" boolean DEFAULT true NOT NULL,
"expires_at" timestamp with time zone NOT NULL,
"revoked_at" timestamp with time zone,
"last_used_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
CREATE INDEX "assistant_tokens_user_idx" ON "assistant_tokens" ("user_id");