CREATE TABLE IF NOT EXISTS "api_keys" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "key_hash" text NOT NULL, "key_prefix" text DEFAULT 'bnt_' NOT NULL, "key_type" text NOT NULL, "project_id" text, "scopes" jsonb DEFAULT '["generate"]'::jsonb NOT NULL, "created_at" timestamp DEFAULT now() NOT NULL, "expires_at" timestamp, "last_used_at" timestamp, "is_active" boolean DEFAULT true NOT NULL, "name" text, "created_by" uuid, CONSTRAINT "api_keys_key_hash_unique" UNIQUE("key_hash") );