mirror of https://github.com/buster-so/buster.git
17 lines
593 B
SQL
17 lines
593 B
SQL
-- Migration: create_api_keys
|
|
-- Created: 2024-06-03-035237
|
|
-- Original: 2024-06-03-035237_create_api_keys
|
|
|
|
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; |