CREATE TABLE IF NOT EXISTS workspace (
    id          UUID PRIMARY KEY,
    slug        VARCHAR(255) NOT NULL,
    name        VARCHAR(255) NOT NULL,
    description TEXT,
    avatar_url  VARCHAR(255),
    plan        VARCHAR(50) NOT NULL DEFAULT 'free',
    billing_email VARCHAR(255),
    stripe_customer_id     VARCHAR(255),
    stripe_subscription_id VARCHAR(255),
    plan_expires_at       TIMESTAMPTZ,
    deleted_at  TIMESTAMPTZ,
    created_at  TIMESTAMPTZ NOT NULL,
    updated_at  TIMESTAMPTZ NOT NULL
);

CREATE UNIQUE INDEX idx_workspace_slug ON workspace (slug);
CREATE INDEX idx_workspace_deleted_at ON workspace (deleted_at);
