de30497f59
- Implemented tenant and user management features including: - Tenant creation and management with associated migrations. - User creation and management with associated migrations. - Tenant membership management with associated migrations. - Platform user roles management with associated migrations. - Quota management with associated migrations. - Article and template management with associated migrations. - Added HTTP handlers for templates and workspaces. - Created tests for protected and public routes. - Introduced a script to check tenant scope in SQL queries. - Documented task plan for backend completion and frontend foundation.
21 lines
1.1 KiB
SQL
21 lines
1.1 KiB
SQL
CREATE TABLE article_templates (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
scope VARCHAR(20) NOT NULL,
|
|
tenant_id BIGINT REFERENCES tenants(id),
|
|
origin_type VARCHAR(20) NOT NULL DEFAULT 'platform',
|
|
share_code_id BIGINT,
|
|
template_key VARCHAR(100) NOT NULL,
|
|
template_name VARCHAR(200) NOT NULL,
|
|
schema_json JSONB NOT NULL DEFAULT '{}',
|
|
prompt_template TEXT,
|
|
prompt_visibility VARCHAR(20) NOT NULL DEFAULT 'visible',
|
|
protected_prompt_asset_key TEXT,
|
|
card_config_json JSONB NOT NULL DEFAULT '{}',
|
|
status VARCHAR(20) NOT NULL DEFAULT 'active',
|
|
version_no INT NOT NULL DEFAULT 1,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
deleted_at TIMESTAMPTZ
|
|
);
|
|
CREATE UNIQUE INDEX uk_template_scope_key_version_active ON article_templates(scope, tenant_id, template_key, version_no) WHERE deleted_at IS NULL;
|