buster/apps/api/migrations/2024-06-03-035237_create_ap.../up.sql

14 lines
507 B
MySQL
Raw Normal View History

2025-01-04 05:32:54 +08:00
-- Your SQL goes here
CREATE TABLE api_keys (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
owner_id UUID NOT NULL references users(id) on update cascade on delete cascade,
key TEXT NOT NULL UNIQUE,
organization_id UUID NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at timestamptz not null default now(),
deleted_at TIMESTAMPTZ
);
-- Enable Row Level Security
ALTER TABLE
api_keys ENABLE ROW LEVEL SECURITY;