-- Create tenant_tables to store tenant-specific table definitions
CREATE TABLE tenant_tables (
    id SERIAL,
    tenant_id INTEGER NOT NULL,
    user_id INTEGER DEFAULT NULL,
    table_name VARCHAR(100) NOT NULL,
    definition JSONB NOT NULL,
    isDeleted BOOLEAN NOT NULL DEFAULT FALSE,
    updatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id)
);
CREATE INDEX tenant_tables_tenant_idx ON tenant_tables(tenant_id);
CREATE INDEX tenant_tables_user_idx ON tenant_tables(user_id);
CREATE INDEX tenant_tables_name_idx ON tenant_tables(table_name);
