CREATE TABLE "domains" ( "id" varchar(255) PRIMARY KEY, "friendly_name" varchar(255), "support_email" varchar(255), "created_at" datetime, "updated_at" datetime ); CREATE TABLE "tenants" ( "id" int PRIMARY KEY, "name" varchar(255), "domain_id" varchar(255) CONSTRAINT domains_id REFERENCES domains(id), "created_at" datetime, "updated_at" datetime ); CREATE TABLE "resource_types" ( "id" int PRIMARY KEY, "name" varchar(255), "domain_id" varchar(255) CONSTRAINT domains_id REFERENCES domains(id), "created_at" datetime, "updated_at" datetime ); CREATE TABLE "role_templates" ( "id" int PRIMARY KEY, "name" varchar(255), "domain_id" varchar(255) CONSTRAINT domains_id REFERENCES domains(id), "created_at" datetime, "updated_at" datetime ); CREATE TABLE "actions" ( "id" int PRIMARY KEY, "name" varchar(255), "resource_type_id" int CONSTRAINT resource_types_id REFERENCES resource_types(id), "created_at" datetime, "updated_at" datetime ); CREATE TABLE "role_template_permissions" ( "id" int PRIMARY KEY, "resource_path" varchar(255), "action_id" int CONSTRAINT actions_id REFERENCES actions(id), "allow_deny" varchar(255), "role_template_id" int CONSTRAINT role_templates_id REFERENCES role_templates(id), "created_at" datetime, "updated_at" datetime ); CREATE TABLE "roles" ( "id" int PRIMARY KEY, "name" varchar(255), "tenant_id" int CONSTRAINT tenants_id REFERENCES tenants(id), "inherits_role_id" int CONSTRAINT roles_id REFERENCES roles(id), "role_template_id" int CONSTRAINT role_templates_id REFERENCES role_templates(id), "created_at" datetime, "updated_at" datetime ); CREATE TABLE "role_permissions" ( "id" int PRIMARY KEY, "resource_path" varchar(255), "action_id" int CONSTRAINT actions_id REFERENCES actions(id), "allow_deny" varchar(255), "role_id" int CONSTRAINT roles_id REFERENCES roles(id), "created_at" datetime, "updated_at" datetime ); CREATE TABLE "role_trust" ( "id" int PRIMARY KEY, "usertype" varchar(255), "identifier" varchar(255), "role_id" int CONSTRAINT roles_id REFERENCES roles(id), "created_at" datetime, "updated_at" datetime );