SQL

CREATE TABLE reporting_templates  (
  id VARCHAR(50) NOT NULL,
  scope VARCHAR(16) NOT NULL,
  tenant_id VARCHAR(50) NOT NULL,
  project_id VARCHAR(50) NOT NULL,
  inherits_from VARCHAR(50),
  name VARCHAR(255) NOT NULL,
  description TEXT NOT NULL,
  mode VARCHAR(16) NOT NULL,
  output_format VARCHAR(16) NOT NULL,
  styling JSON NOT NULL,
  source_document_id VARCHAR(50) NOT NULL,
  ontology_id VARCHAR(64) NOT NULL,
  enabled BOOLEAN NOT NULL,
  created_by VARCHAR(50) NOT NULL,
  created_at DATETIME NOT NULL,
  updated_at DATETIME NOT NULL,
  deleted BOOLEAN NOT NULL,
  PRIMARY KEY (id)
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
id VARCHAR(50) ✓ Rename | Drop
scope VARCHAR(16) Rename | Drop
tenant_id VARCHAR(50) Rename | Drop
project_id VARCHAR(50) Rename | Drop
inherits_from VARCHAR(50) ✓ Rename | Drop
name VARCHAR(255) Rename | Drop
description TEXT Rename | Drop
mode VARCHAR(16) Rename | Drop
output_format VARCHAR(16) Rename | Drop
styling JSON Rename | Drop
source_document_id VARCHAR(50) Rename | Drop
ontology_id VARCHAR(64) Rename | Drop
enabled BOOLEAN Rename | Drop
created_by VARCHAR(50) Rename | Drop
created_at DATETIME Rename | Drop
updated_at DATETIME Rename | Drop
deleted BOOLEAN Rename | Drop

+ Add index

Indexes

Name Columns Unique SQL Drop?
ix_reporting_templates_inherits_from inherits_from SQL
CREATE INDEX ix_reporting_templates_inherits_from
ON reporting_templates (inherits_from)
Drop
ix_reporting_templates_scope scope SQL
CREATE INDEX ix_reporting_templates_scope
ON reporting_templates (scope)
Drop
ix_reporting_templates_tenant_project
  • tenant_id
  • project_id
SQL
CREATE INDEX ix_reporting_templates_tenant_project
ON reporting_templates (tenant_id, project_id)
Drop
sqlite_autoindex_reporting_templates_1 id ✓ SQL
-- no sql found --
Drop
uq_reporting_template_active_override
  • tenant_id
  • project_id
  • inherits_from
✓ SQL
CREATE UNIQUE INDEX uq_reporting_template_active_override
ON reporting_templates (tenant_id, project_id, inherits_from) WHERE inherits_from IS NOT NULL AND deleted = 0
Drop