-- Create clients and cases tables

-- Table: clients
CREATE TABLE clients (
    id SERIAL,
    tenant_id INTEGER DEFAULT NULL,
    isDeleted BOOLEAN NOT NULL DEFAULT FALSE,
    updatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id)
);
CREATE INDEX clients_tenant_idx ON clients (tenant_id);

-- Table: cases
CREATE TABLE cases (
    id SERIAL,
    client_id INTEGER DEFAULT NULL,
    title VARCHAR(255) DEFAULT NULL,
    status VARCHAR(50) DEFAULT NULL,
    opened_at TIMESTAMP DEFAULT NULL,
    closed_at TIMESTAMP DEFAULT NULL,
    tenant_id INTEGER DEFAULT NULL,
    isDeleted BOOLEAN NOT NULL DEFAULT FALSE,
    updatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id)
);
CREATE INDEX cases_client_idx ON cases (client_id);
CREATE INDEX cases_tenant_idx ON cases (tenant_id);
