Skip to main content

infra/sql/0001_init.sql

Metadata

Indexed Symbols

No indexed functions/methods detected in this file.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

-- Anchor MSP PSA baseline schema
-- Workspace-per-client isolation: every row includes workspace_id and is policy-scoped.

create extension if not exists pgcrypto;

create table if not exists workspaces (
id uuid primary key default gen_random_uuid(),
name text not null,
slug text not null unique,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);

create table if not exists clients (
id uuid primary key default gen_random_uuid(),
workspace_id uuid not null references workspaces(id) on delete cascade,
name text not null,
status text not null,
tier text not null,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);

create table if not exists contacts (
id uuid primary key default gen_random_uuid(),