apskel-pos-backend/migrations/000001_create_organizations_table.up.sql
aditya.siregar 4f5950543e init
2025-07-18 20:10:29 +07:00

14 lines
538 B
SQL

-- Organizations table
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE organizations (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
plan_type VARCHAR(50) NOT NULL CHECK (plan_type IN ('basic', 'premium', 'enterprise')),
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Indexes
CREATE INDEX idx_organizations_plan_type ON organizations(plan_type);
CREATE INDEX idx_organizations_created_at ON organizations(created_at);