diff --git a/migrations/.snapshot-cathedral.json b/migrations/.snapshot-cathedral.json index f7e7153e..a32031c0 100644 --- a/migrations/.snapshot-cathedral.json +++ b/migrations/.snapshot-cathedral.json @@ -135,7 +135,7 @@ "unsigned": false, "autoincrement": false, "primary": false, - "nullable": true, + "nullable": false, "mappedType": "json" }, "created_at": { @@ -479,128 +479,266 @@ "nullable": false, "default": "false", "mappedType": "boolean" - } - }, - "name": "silence", - "schema": "public", - "indexes": [ - { - "keyName": "silence_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "silence_solution_id_foreign": { - "constraintName": "silence_solution_id_foreign", - "columnNames": [ - "solution_id" + }, + "req_type": { + "name": "req_type", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "enumItems": [ + "assumption", + "constraint", + "effect", + "environment_component", + "functional_behavior", + "glossary_term", + "hint", + "invariant", + "justification", + "limit", + "meta_requirement", + "noise", + "non_functional_behavior", + "obstacle", + "outcome", + "parsed_requirement", + "person", + "product", + "responsibility", + "role", + "silence", + "stakeholder", + "system_component", + "task", + "test_case", + "use_case", + "user_story" ], - "localTableName": "public.silence", - "referencedColumnNames": [ - "id" + "mappedType": "enum" + }, + "priority": { + "name": "priority", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "enumItems": [ + "MUST", + "SHOULD", + "COULD", + "WONT" ], - "referencedTableName": "public.solution", - "updateRule": "cascade" + "mappedType": "enum" }, - "silence_modified_by_id_foreign": { - "constraintName": "silence_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" + "parent_component_id": { + "name": "parent_component_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "uuid" + }, + "email": { + "name": "email", + "type": "varchar(254)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 254, + "mappedType": "string" + }, + "primary_actor_id": { + "name": "primary_actor_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "uuid" + }, + "segmentation": { + "name": "segmentation", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "enumItems": [ + "Client", + "Vendor" ], - "localTableName": "public.silence", - "referencedColumnNames": [ - "id" + "mappedType": "enum" + }, + "category": { + "name": "category", + "type": "text", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "enumItems": [ + "Business Rule", + "Physical Law", + "Engineering Decision", + "Key Stakeholder", + "Shadow Influencer", + "Fellow Traveler", + "Observer" ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", + "mappedType": "enum" + }, + "availability": { + "name": "availability", + "type": "int", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "integer" + }, + "influence": { + "name": "influence", + "type": "int", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "integer" + }, + "parent_component_1_id": { + "name": "parent_component_1_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, - "nullable": false, + "nullable": true, "mappedType": "uuid" }, - "name": { - "name": "name", + "scope": { + "name": "scope", "type": "varchar(255)", "unsigned": false, "autoincrement": false, "primary": false, - "nullable": false, + "nullable": true, "length": 255, "mappedType": "string" }, - "statement": { - "name": "statement", - "type": "varchar(1000)", + "level": { + "name": "level", + "type": "varchar(255)", "unsigned": false, "autoincrement": false, "primary": false, - "nullable": false, - "length": 1000, + "nullable": true, + "length": 255, "mappedType": "string" }, - "solution_id": { - "name": "solution_id", + "goal_in_context": { + "name": "goal_in_context", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 255, + "mappedType": "string" + }, + "precondition_id": { + "name": "precondition_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, - "nullable": false, + "nullable": true, "mappedType": "uuid" }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", + "trigger_id": { + "name": "trigger_id", + "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" + "nullable": true, + "mappedType": "uuid" }, - "modified_by_id": { - "name": "modified_by_id", + "main_success_scenario": { + "name": "main_success_scenario", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 255, + "mappedType": "string" + }, + "success_guarantee_id": { + "name": "success_guarantee_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", + "nullable": true, "mappedType": "uuid" }, - "is_silence": { - "name": "is_silence", - "type": "boolean", + "extensions": { + "name": "extensions", + "type": "varchar(255)", "unsigned": false, "autoincrement": false, "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" + "nullable": true, + "length": 255, + "mappedType": "string" + }, + "follows_id": { + "name": "follows_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "uuid" + }, + "functional_behavior_id": { + "name": "functional_behavior_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "uuid" + }, + "outcome_id": { + "name": "outcome_id", + "type": "uuid", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "mappedType": "uuid" } }, - "name": "role", + "name": "requirement", "schema": "public", "indexes": [ { - "keyName": "role_pkey", + "columnNames": [ + "req_type" + ], + "composite": false, + "keyName": "requirement_req_type_index", + "constraint": false, + "primary": false, + "unique": false + }, + { + "keyName": "requirement_pkey", "columnNames": [ "id" ], @@ -612,3380 +750,131 @@ ], "checks": [], "foreignKeys": { - "role_solution_id_foreign": { - "constraintName": "role_solution_id_foreign", + "requirement_solution_id_foreign": { + "constraintName": "requirement_solution_id_foreign", "columnNames": [ "solution_id" ], - "localTableName": "public.role", + "localTableName": "public.requirement", "referencedColumnNames": [ "id" ], "referencedTableName": "public.solution", "updateRule": "cascade" }, - "role_modified_by_id_foreign": { - "constraintName": "role_modified_by_id_foreign", + "requirement_modified_by_id_foreign": { + "constraintName": "requirement_modified_by_id_foreign", "columnNames": [ "modified_by_id" ], - "localTableName": "public.role", + "localTableName": "public.requirement", "referencedColumnNames": [ "id" ], "referencedTableName": "public.app_user", "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - } - }, - "name": "responsibility", - "schema": "public", - "indexes": [ - { - "keyName": "responsibility_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "responsibility_solution_id_foreign": { - "constraintName": "responsibility_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.responsibility", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "responsibility_modified_by_id_foreign": { - "constraintName": "responsibility_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.responsibility", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - } - }, - "name": "product", - "schema": "public", - "indexes": [ - { - "keyName": "product_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "product_solution_id_foreign": { - "constraintName": "product_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.product", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "product_modified_by_id_foreign": { - "constraintName": "product_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.product", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - } - }, - "name": "parsed_requirement", - "schema": "public", - "indexes": [ - { - "keyName": "parsed_requirement_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "parsed_requirement_solution_id_foreign": { - "constraintName": "parsed_requirement_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.parsed_requirement", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "parsed_requirement_modified_by_id_foreign": { - "constraintName": "parsed_requirement_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.parsed_requirement", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "email": { - "name": "email", - "type": "varchar(254)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "length": 254, - "mappedType": "string" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "person", - "schema": "public", - "indexes": [ - { - "keyName": "person_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "person_solution_id_foreign": { - "constraintName": "person_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.person", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "person_modified_by_id_foreign": { - "constraintName": "person_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.person", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "person_follows_id_foreign": { - "constraintName": "person_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.person", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "outcome", - "schema": "public", - "indexes": [ - { - "keyName": "outcome_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "outcome_solution_id_foreign": { - "constraintName": "outcome_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.outcome", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "outcome_modified_by_id_foreign": { - "constraintName": "outcome_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.outcome", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "outcome_follows_id_foreign": { - "constraintName": "outcome_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.outcome", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "obstacle", - "schema": "public", - "indexes": [ - { - "keyName": "obstacle_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "obstacle_solution_id_foreign": { - "constraintName": "obstacle_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.obstacle", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "obstacle_modified_by_id_foreign": { - "constraintName": "obstacle_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.obstacle", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "obstacle_follows_id_foreign": { - "constraintName": "obstacle_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.obstacle", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "priority": { - "name": "priority", - "type": "text", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "enumItems": [ - "MUST", - "SHOULD", - "COULD", - "WONT" - ], - "mappedType": "enum" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "non_functional_behavior", - "schema": "public", - "indexes": [ - { - "keyName": "non_functional_behavior_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "non_functional_behavior_solution_id_foreign": { - "constraintName": "non_functional_behavior_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.non_functional_behavior", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "non_functional_behavior_modified_by_id_foreign": { - "constraintName": "non_functional_behavior_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.non_functional_behavior", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "non_functional_behavior_follows_id_foreign": { - "constraintName": "non_functional_behavior_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.non_functional_behavior", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - } - }, - "name": "noise", - "schema": "public", - "indexes": [ - { - "keyName": "noise_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "noise_solution_id_foreign": { - "constraintName": "noise_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.noise", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "noise_modified_by_id_foreign": { - "constraintName": "noise_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.noise", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "limit", - "schema": "public", - "indexes": [ - { - "keyName": "limit_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "limit_solution_id_foreign": { - "constraintName": "limit_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.limit", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "limit_modified_by_id_foreign": { - "constraintName": "limit_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.limit", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "limit_follows_id_foreign": { - "constraintName": "limit_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.limit", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "justification", - "schema": "public", - "indexes": [ - { - "keyName": "justification_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "justification_solution_id_foreign": { - "constraintName": "justification_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.justification", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "justification_modified_by_id_foreign": { - "constraintName": "justification_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.justification", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "justification_follows_id_foreign": { - "constraintName": "justification_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.justification", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "invariant", - "schema": "public", - "indexes": [ - { - "keyName": "invariant_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "invariant_solution_id_foreign": { - "constraintName": "invariant_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.invariant", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "invariant_modified_by_id_foreign": { - "constraintName": "invariant_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.invariant", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "invariant_follows_id_foreign": { - "constraintName": "invariant_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.invariant", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - } - }, - "name": "hint", - "schema": "public", - "indexes": [ - { - "keyName": "hint_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "hint_solution_id_foreign": { - "constraintName": "hint_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.hint", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "hint_modified_by_id_foreign": { - "constraintName": "hint_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.hint", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "parent_component_id": { - "name": "parent_component_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "glossary_term", - "schema": "public", - "indexes": [ - { - "keyName": "glossary_term_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "glossary_term_solution_id_foreign": { - "constraintName": "glossary_term_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.glossary_term", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "glossary_term_modified_by_id_foreign": { - "constraintName": "glossary_term_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.glossary_term", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "glossary_term_parent_component_id_foreign": { - "constraintName": "glossary_term_parent_component_id_foreign", - "columnNames": [ - "parent_component_id" - ], - "localTableName": "public.glossary_term", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.glossary_term", - "deleteRule": "set null", - "updateRule": "cascade" - }, - "glossary_term_follows_id_foreign": { - "constraintName": "glossary_term_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.glossary_term", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "priority": { - "name": "priority", - "type": "text", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "enumItems": [ - "MUST", - "SHOULD", - "COULD", - "WONT" - ], - "mappedType": "enum" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "functional_behavior", - "schema": "public", - "indexes": [ - { - "keyName": "functional_behavior_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "functional_behavior_solution_id_foreign": { - "constraintName": "functional_behavior_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.functional_behavior", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "functional_behavior_modified_by_id_foreign": { - "constraintName": "functional_behavior_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.functional_behavior", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "functional_behavior_follows_id_foreign": { - "constraintName": "functional_behavior_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.functional_behavior", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "parent_component_id": { - "name": "parent_component_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "environment_component", - "schema": "public", - "indexes": [ - { - "keyName": "environment_component_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "environment_component_solution_id_foreign": { - "constraintName": "environment_component_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.environment_component", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "environment_component_modified_by_id_foreign": { - "constraintName": "environment_component_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.environment_component", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "environment_component_parent_component_id_foreign": { - "constraintName": "environment_component_parent_component_id_foreign", - "columnNames": [ - "parent_component_id" - ], - "localTableName": "public.environment_component", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.environment_component", - "deleteRule": "set null", - "updateRule": "cascade" - }, - "environment_component_follows_id_foreign": { - "constraintName": "environment_component_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.environment_component", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "effect", - "schema": "public", - "indexes": [ - { - "keyName": "effect_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "effect_solution_id_foreign": { - "constraintName": "effect_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.effect", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "effect_modified_by_id_foreign": { - "constraintName": "effect_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.effect", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "effect_follows_id_foreign": { - "constraintName": "effect_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.effect", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "category": { - "name": "category", - "type": "text", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "enumItems": [ - "Business Rule", - "Physical Law", - "Engineering Decision" - ], - "mappedType": "enum" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "constraint", - "schema": "public", - "indexes": [ - { - "keyName": "constraint_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "constraint_solution_id_foreign": { - "constraintName": "constraint_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.constraint", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "constraint_modified_by_id_foreign": { - "constraintName": "constraint_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.constraint", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "constraint_follows_id_foreign": { - "constraintName": "constraint_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.constraint", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "assumption", - "schema": "public", - "indexes": [ - { - "keyName": "assumption_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "assumption_solution_id_foreign": { - "constraintName": "assumption_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.assumption", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "assumption_modified_by_id_foreign": { - "constraintName": "assumption_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.assumption", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "assumption_follows_id_foreign": { - "constraintName": "assumption_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.assumption", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "parent_component_id": { - "name": "parent_component_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "segmentation": { - "name": "segmentation", - "type": "text", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "enumItems": [ - "Client", - "Vendor" - ], - "mappedType": "enum" - }, - "category": { - "name": "category", - "type": "text", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "enumItems": [ - "Key Stakeholder", - "Shadow Influencer", - "Fellow Traveler", - "Observer" - ], - "mappedType": "enum" - }, - "availability": { - "name": "availability", - "type": "int", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "integer" - }, - "influence": { - "name": "influence", - "type": "int", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "integer" - } - }, - "name": "stakeholder", - "schema": "public", - "indexes": [ - { - "keyName": "stakeholder_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [ - { - "name": "stakeholder_availability_check", - "expression": "availability >= 0 AND availability <= 100", - "definition": "check ((availability >= 0 AND availability <= 100))", - "columnName": "availability" - }, - { - "name": "stakeholder_influence_check", - "expression": "influence >= 0 AND influence <= 100", - "definition": "check ((influence >= 0 AND influence <= 100))", - "columnName": "influence" - } - ], - "foreignKeys": { - "stakeholder_solution_id_foreign": { - "constraintName": "stakeholder_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.stakeholder", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "stakeholder_modified_by_id_foreign": { - "constraintName": "stakeholder_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.stakeholder", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "stakeholder_follows_id_foreign": { - "constraintName": "stakeholder_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.stakeholder", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - }, - "stakeholder_parent_component_id_foreign": { - "constraintName": "stakeholder_parent_component_id_foreign", - "columnNames": [ - "parent_component_id" - ], - "localTableName": "public.stakeholder", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.stakeholder", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "parent_component_id": { - "name": "parent_component_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - } - }, - "name": "system_component", - "schema": "public", - "indexes": [ - { - "keyName": "system_component_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "system_component_solution_id_foreign": { - "constraintName": "system_component_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.system_component", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "system_component_modified_by_id_foreign": { - "constraintName": "system_component_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.system_component", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - }, - "system_component_follows_id_foreign": { - "constraintName": "system_component_follows_id_foreign", - "columnNames": [ - "follows_id" - ], - "localTableName": "public.system_component", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", - "updateRule": "cascade" - }, - "system_component_parent_component_id_foreign": { - "constraintName": "system_component_parent_component_id_foreign", - "columnNames": [ - "parent_component_id" - ], - "localTableName": "public.system_component", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.system_component", - "deleteRule": "set null", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - } - }, - "name": "task", - "schema": "public", - "indexes": [ - { - "keyName": "task_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "task_solution_id_foreign": { - "constraintName": "task_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.task", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "task_modified_by_id_foreign": { - "constraintName": "task_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.task", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "priority": { - "name": "priority", - "type": "text", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "enumItems": [ - "MUST", - "SHOULD", - "COULD", - "WONT" - ], - "mappedType": "enum" - } - }, - "name": "test_case", - "schema": "public", - "indexes": [ - { - "keyName": "test_case_pkey", - "columnNames": [ - "id" - ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "test_case_solution_id_foreign": { - "constraintName": "test_case_solution_id_foreign", - "columnNames": [ - "solution_id" - ], - "localTableName": "public.test_case", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" - }, - "test_case_modified_by_id_foreign": { - "constraintName": "test_case_modified_by_id_foreign", - "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.test_case", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" - } - }, - "nativeEnums": {} - }, - { - "columns": { - "id": { - "name": "id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "mappedType": "uuid" - }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", - "mappedType": "uuid" - }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "priority": { - "name": "priority", - "type": "text", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "enumItems": [ - "MUST", - "SHOULD", - "COULD", - "WONT" - ], - "mappedType": "enum" - }, - "primary_actor_id": { - "name": "primary_actor_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "scope": { - "name": "scope", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "level": { - "name": "level", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "goal_in_context": { - "name": "goal_in_context", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "precondition_id": { - "name": "precondition_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "trigger_id": { - "name": "trigger_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "main_success_scenario": { - "name": "main_success_scenario", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "success_guarantee_id": { - "name": "success_guarantee_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" + "requirement_parent_component_id_foreign": { + "constraintName": "requirement_parent_component_id_foreign", + "columnNames": [ + "parent_component_id" + ], + "localTableName": "public.requirement", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.requirement", + "deleteRule": "set null", + "updateRule": "cascade" }, - "extensions": { - "name": "extensions", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - } - }, - "name": "use_case", - "schema": "public", - "indexes": [ - { - "keyName": "use_case_pkey", + "requirement_primary_actor_id_foreign": { + "constraintName": "requirement_primary_actor_id_foreign", "columnNames": [ + "primary_actor_id" + ], + "localTableName": "public.requirement", + "referencedColumnNames": [ "id" ], - "composite": false, - "constraint": true, - "primary": true, - "unique": true - } - ], - "checks": [], - "foreignKeys": { - "use_case_solution_id_foreign": { - "constraintName": "use_case_solution_id_foreign", + "referencedTableName": "public.requirement", + "deleteRule": "set null", + "updateRule": "cascade" + }, + "requirement_parent_component_1_id_foreign": { + "constraintName": "requirement_parent_component_1_id_foreign", "columnNames": [ - "solution_id" + "parent_component_1_id" ], - "localTableName": "public.use_case", + "localTableName": "public.requirement", "referencedColumnNames": [ "id" ], - "referencedTableName": "public.solution", + "referencedTableName": "public.requirement", + "deleteRule": "set null", "updateRule": "cascade" }, - "use_case_modified_by_id_foreign": { - "constraintName": "use_case_modified_by_id_foreign", + "requirement_precondition_id_foreign": { + "constraintName": "requirement_precondition_id_foreign", "columnNames": [ - "modified_by_id" + "precondition_id" ], - "localTableName": "public.use_case", + "localTableName": "public.requirement", "referencedColumnNames": [ "id" ], - "referencedTableName": "public.app_user", + "referencedTableName": "public.requirement", + "deleteRule": "set null", "updateRule": "cascade" }, - "use_case_primary_actor_id_foreign": { - "constraintName": "use_case_primary_actor_id_foreign", + "requirement_success_guarantee_id_foreign": { + "constraintName": "requirement_success_guarantee_id_foreign", "columnNames": [ - "primary_actor_id" + "success_guarantee_id" ], - "localTableName": "public.use_case", + "localTableName": "public.requirement", "referencedColumnNames": [ "id" ], - "referencedTableName": "public.stakeholder", + "referencedTableName": "public.requirement", "deleteRule": "set null", "updateRule": "cascade" }, - "use_case_follows_id_foreign": { - "constraintName": "use_case_follows_id_foreign", + "requirement_follows_id_foreign": { + "constraintName": "requirement_follows_id_foreign", "columnNames": [ "follows_id" ], - "localTableName": "public.use_case", + "localTableName": "public.requirement", "referencedColumnNames": [ "id" ], - "referencedTableName": "public.parsed_requirement", + "referencedTableName": "public.requirement", "deleteRule": "set null", "updateRule": "cascade" }, - "use_case_precondition_id_foreign": { - "constraintName": "use_case_precondition_id_foreign", + "requirement_functional_behavior_id_foreign": { + "constraintName": "requirement_functional_behavior_id_foreign", "columnNames": [ - "precondition_id" + "functional_behavior_id" ], - "localTableName": "public.use_case", + "localTableName": "public.requirement", "referencedColumnNames": [ "id" ], - "referencedTableName": "public.assumption", + "referencedTableName": "public.requirement", "deleteRule": "set null", "updateRule": "cascade" }, - "use_case_success_guarantee_id_foreign": { - "constraintName": "use_case_success_guarantee_id_foreign", + "requirement_outcome_id_foreign": { + "constraintName": "requirement_outcome_id_foreign", "columnNames": [ - "success_guarantee_id" + "outcome_id" ], - "localTableName": "public.use_case", + "localTableName": "public.requirement", "referencedColumnNames": [ "id" ], - "referencedTableName": "public.effect", + "referencedTableName": "public.requirement", "deleteRule": "set null", "updateRule": "cascade" } @@ -4003,28 +892,8 @@ "nullable": false, "mappedType": "uuid" }, - "name": { - "name": "name", - "type": "varchar(255)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 255, - "mappedType": "string" - }, - "statement": { - "name": "statement", - "type": "varchar(1000)", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 1000, - "mappedType": "string" - }, - "solution_id": { - "name": "solution_id", + "left_id": { + "name": "left_id", "type": "uuid", "unsigned": false, "autoincrement": false, @@ -4032,81 +901,41 @@ "nullable": false, "mappedType": "uuid" }, - "last_modified": { - "name": "last_modified", - "type": "timestamptz", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "length": 6, - "default": "now()", - "mappedType": "datetime" - }, - "modified_by_id": { - "name": "modified_by_id", + "right_id": { + "name": "right_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, - "default": "'ac594919-50e3-438a-b9bc-efb8a8654243'", "mappedType": "uuid" }, - "is_silence": { - "name": "is_silence", - "type": "boolean", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": false, - "default": "false", - "mappedType": "boolean" - }, - "priority": { - "name": "priority", + "rel_type": { + "name": "rel_type", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "enumItems": [ - "MUST", - "SHOULD", - "COULD", - "WONT" + "belongs", + "characterizes", + "constrains", + "contradicts", + "details", + "disjoins", + "duplicates", + "excepts", + "explains", + "extends", + "follows", + "repeats", + "shares" ], "mappedType": "enum" }, - "primary_actor_id": { - "name": "primary_actor_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "follows_id": { - "name": "follows_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "functional_behavior_id": { - "name": "functional_behavior_id", - "type": "uuid", - "unsigned": false, - "autoincrement": false, - "primary": false, - "nullable": true, - "mappedType": "uuid" - }, - "outcome_id": { - "name": "outcome_id", + "left_1_id": { + "name": "left_1_id", "type": "uuid", "unsigned": false, "autoincrement": false, @@ -4115,95 +944,96 @@ "mappedType": "uuid" } }, - "name": "user_story", + "name": "requirement_relation", "schema": "public", "indexes": [ { - "keyName": "user_story_pkey", "columnNames": [ - "id" + "left_id" ], "composite": false, + "keyName": "requirement_relation_left_id_unique", "constraint": true, - "primary": true, + "primary": false, "unique": true - } - ], - "checks": [], - "foreignKeys": { - "user_story_solution_id_foreign": { - "constraintName": "user_story_solution_id_foreign", + }, + { "columnNames": [ - "solution_id" + "right_id" ], - "localTableName": "public.user_story", - "referencedColumnNames": [ - "id" - ], - "referencedTableName": "public.solution", - "updateRule": "cascade" + "composite": false, + "keyName": "requirement_relation_right_id_unique", + "constraint": true, + "primary": false, + "unique": true }, - "user_story_modified_by_id_foreign": { - "constraintName": "user_story_modified_by_id_foreign", + { "columnNames": [ - "modified_by_id" - ], - "localTableName": "public.user_story", - "referencedColumnNames": [ - "id" + "rel_type" ], - "referencedTableName": "public.app_user", - "updateRule": "cascade" + "composite": false, + "keyName": "requirement_relation_rel_type_index", + "constraint": false, + "primary": false, + "unique": false }, - "user_story_primary_actor_id_foreign": { - "constraintName": "user_story_primary_actor_id_foreign", + { "columnNames": [ - "primary_actor_id" + "left_1_id" ], - "localTableName": "public.user_story", - "referencedColumnNames": [ + "composite": false, + "keyName": "requirement_relation_left_1_id_unique", + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "requirement_relation_pkey", + "columnNames": [ "id" ], - "referencedTableName": "public.stakeholder", - "deleteRule": "set null", - "updateRule": "cascade" - }, - "user_story_follows_id_foreign": { - "constraintName": "user_story_follows_id_foreign", + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "requirement_relation_left_id_foreign": { + "constraintName": "requirement_relation_left_id_foreign", "columnNames": [ - "follows_id" + "left_id" ], - "localTableName": "public.user_story", + "localTableName": "public.requirement_relation", "referencedColumnNames": [ "id" ], - "referencedTableName": "public.parsed_requirement", - "deleteRule": "set null", + "referencedTableName": "public.requirement", "updateRule": "cascade" }, - "user_story_functional_behavior_id_foreign": { - "constraintName": "user_story_functional_behavior_id_foreign", + "requirement_relation_right_id_foreign": { + "constraintName": "requirement_relation_right_id_foreign", "columnNames": [ - "functional_behavior_id" + "right_id" ], - "localTableName": "public.user_story", + "localTableName": "public.requirement_relation", "referencedColumnNames": [ "id" ], - "referencedTableName": "public.functional_behavior", - "deleteRule": "set null", + "referencedTableName": "public.requirement", "updateRule": "cascade" }, - "user_story_outcome_id_foreign": { - "constraintName": "user_story_outcome_id_foreign", + "requirement_relation_left_1_id_foreign": { + "constraintName": "requirement_relation_left_1_id_foreign", "columnNames": [ - "outcome_id" + "left_1_id" ], - "localTableName": "public.user_story", + "localTableName": "public.requirement_relation", "referencedColumnNames": [ "id" ], - "referencedTableName": "public.outcome", + "referencedTableName": "public.requirement", "deleteRule": "set null", "updateRule": "cascade" } diff --git a/migrations/Migration20241015194316.ts b/migrations/Migration20241015194316.ts new file mode 100644 index 00000000..1246094b --- /dev/null +++ b/migrations/Migration20241015194316.ts @@ -0,0 +1,424 @@ +import { Migration } from '@mikro-orm/migrations'; + +export class Migration20241015194316 extends Migration { + + override async up(): Promise { + this.addSql(`alter table "person" drop constraint "person_follows_id_foreign";`); + + this.addSql(`alter table "outcome" drop constraint "outcome_follows_id_foreign";`); + + this.addSql(`alter table "obstacle" drop constraint "obstacle_follows_id_foreign";`); + + this.addSql(`alter table "non_functional_behavior" drop constraint "non_functional_behavior_follows_id_foreign";`); + + this.addSql(`alter table "limit" drop constraint "limit_follows_id_foreign";`); + + this.addSql(`alter table "justification" drop constraint "justification_follows_id_foreign";`); + + this.addSql(`alter table "invariant" drop constraint "invariant_follows_id_foreign";`); + + this.addSql(`alter table "glossary_term" drop constraint "glossary_term_follows_id_foreign";`); + + this.addSql(`alter table "functional_behavior" drop constraint "functional_behavior_follows_id_foreign";`); + + this.addSql(`alter table "environment_component" drop constraint "environment_component_follows_id_foreign";`); + + this.addSql(`alter table "effect" drop constraint "effect_follows_id_foreign";`); + + this.addSql(`alter table "constraint" drop constraint "constraint_follows_id_foreign";`); + + this.addSql(`alter table "assumption" drop constraint "assumption_follows_id_foreign";`); + + this.addSql(`alter table "stakeholder" drop constraint "stakeholder_follows_id_foreign";`); + + this.addSql(`alter table "system_component" drop constraint "system_component_follows_id_foreign";`); + + this.addSql(`alter table "use_case" drop constraint "use_case_follows_id_foreign";`); + + this.addSql(`alter table "user_story" drop constraint "user_story_follows_id_foreign";`); + + this.addSql(`alter table "user_story" drop constraint "user_story_outcome_id_foreign";`); + + this.addSql(`alter table "glossary_term" drop constraint "glossary_term_parent_component_id_foreign";`); + + this.addSql(`alter table "user_story" drop constraint "user_story_functional_behavior_id_foreign";`); + + this.addSql(`alter table "environment_component" drop constraint "environment_component_parent_component_id_foreign";`); + + this.addSql(`alter table "use_case" drop constraint "use_case_success_guarantee_id_foreign";`); + + this.addSql(`alter table "use_case" drop constraint "use_case_precondition_id_foreign";`); + + this.addSql(`alter table "stakeholder" drop constraint "stakeholder_parent_component_id_foreign";`); + + this.addSql(`alter table "use_case" drop constraint "use_case_primary_actor_id_foreign";`); + + this.addSql(`alter table "user_story" drop constraint "user_story_primary_actor_id_foreign";`); + + this.addSql(`alter table "system_component" drop constraint "system_component_parent_component_id_foreign";`); + + this.addSql(`create table "requirement" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "req_type" text check ("req_type" in ('assumption', 'constraint', 'effect', 'environment_component', 'functional_behavior', 'glossary_term', 'hint', 'invariant', 'justification', 'limit', 'noise', 'non_functional_behavior', 'obstacle', 'outcome', 'parsed_requirement', 'person', 'product', 'responsibility', 'role', 'silence', 'stakeholder', 'system_component', 'task', 'test_case', 'use_case', 'user_story')) not null, "priority" text check ("priority" in ('MUST', 'SHOULD', 'COULD', 'WONT')) null, "parent_component_id" uuid null, "email" varchar(254) null, "primary_actor_id" uuid null, "segmentation" text check ("segmentation" in ('Client', 'Vendor')) null, "category" text check ("category" in ('Business Rule', 'Physical Law', 'Engineering Decision', 'Key Stakeholder', 'Shadow Influencer', 'Fellow Traveler', 'Observer')) null, "availability" int null, "influence" int null, "parent_component_1_id" uuid null, "scope" varchar(255) null, "level" varchar(255) null, "goal_in_context" varchar(255) null, "precondition_id" uuid null, "trigger_id" uuid null, "main_success_scenario" varchar(255) null, "success_guarantee_id" uuid null, "extensions" varchar(255) null, "follows_id" uuid null, "functional_behavior_id" uuid null, "outcome_id" uuid null, constraint "requirement_pkey" primary key ("id"));`); + this.addSql(`create index "requirement_req_type_index" on "requirement" ("req_type");`); + + this.addSql(`alter table "requirement" add constraint "requirement_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "requirement" add constraint "requirement_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "requirement" add constraint "requirement_parent_component_id_foreign" foreign key ("parent_component_id") references "requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "requirement" add constraint "requirement_primary_actor_id_foreign" foreign key ("primary_actor_id") references "requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "requirement" add constraint "requirement_parent_component_1_id_foreign" foreign key ("parent_component_1_id") references "requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "requirement" add constraint "requirement_precondition_id_foreign" foreign key ("precondition_id") references "requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "requirement" add constraint "requirement_success_guarantee_id_foreign" foreign key ("success_guarantee_id") references "requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "requirement" add constraint "requirement_follows_id_foreign" foreign key ("follows_id") references "requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "requirement" add constraint "requirement_functional_behavior_id_foreign" foreign key ("functional_behavior_id") references "requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "requirement" add constraint "requirement_outcome_id_foreign" foreign key ("outcome_id") references "requirement" ("id") on update cascade on delete set null;`); + + /* + For each entity, move the data to the requirement table and drop the entity table + */ + + // A helper function to perform the data migration + this.addSql(` + CREATE OR REPLACE FUNCTION migrate_table(old_table TEXT, req_type TEXT) + RETURNS VOID AS $$ + DECLARE + cols TEXT; + BEGIN + -- Find matching columns between the old table and the 'requirement' table + SELECT string_agg(c.column_name, ', ') INTO cols + FROM information_schema.columns c + WHERE c.table_name = old_table + AND c.column_name IN ( + SELECT column_name + FROM information_schema.columns + WHERE table_name = 'requirement' + ); + + -- Execute the dynamic insert statement + EXECUTE format( + 'INSERT INTO "requirement" (req_type, %s) + SELECT ''%s'', %s FROM %I', + cols, req_type, cols, old_table + ); + END; + $$ LANGUAGE plpgsql; + `) + + this.addSql(`select migrate_table('silence', 'silence');`); + this.addSql(`drop table if exists "silence" cascade;`); + + this.addSql(`select migrate_table('role', 'role');`); + this.addSql(`drop table if exists "role" cascade;`); + + this.addSql(`select migrate_table('responsibility', 'responsibility');`); + this.addSql(`drop table if exists "responsibility" cascade;`); + + this.addSql(`select migrate_table('product', 'product');`); + this.addSql(`drop table if exists "product" cascade;`); + + this.addSql(`select migrate_table('parsed_requirement', 'parsed_requirement');`); + this.addSql(`drop table if exists "parsed_requirement" cascade;`); + + this.addSql(`select migrate_table('person', 'person');`); + this.addSql(`drop table if exists "person" cascade;`); + + this.addSql(`select migrate_table('outcome', 'outcome');`); + this.addSql(`drop table if exists "outcome" cascade;`); + + this.addSql(`select migrate_table('obstacle', 'obstacle');`); + this.addSql(`drop table if exists "obstacle" cascade;`); + + this.addSql(`select migrate_table('non_functional_behavior', 'non_functional_behavior');`); + this.addSql(`drop table if exists "non_functional_behavior" cascade;`); + + this.addSql(`select migrate_table('noise', 'noise');`); + this.addSql(`drop table if exists "noise" cascade;`); + + this.addSql(`select migrate_table('limit', 'limit');`); + this.addSql(`drop table if exists "limit" cascade;`); + + this.addSql(`select migrate_table('justification', 'justification');`); + this.addSql(`drop table if exists "justification" cascade;`); + + this.addSql(`select migrate_table('invariant', 'invariant');`); + this.addSql(`drop table if exists "invariant" cascade;`); + + this.addSql(`select migrate_table('hint', 'hint');`); + this.addSql(`drop table if exists "hint" cascade;`); + + this.addSql(`select migrate_table('glossary_term', 'glossary_term');`); + this.addSql(`drop table if exists "glossary_term" cascade;`); + + this.addSql(`select migrate_table('functional_behavior', 'functional_behavior');`); + this.addSql(`drop table if exists "functional_behavior" cascade;`); + + this.addSql(`select migrate_table('environment_component', 'environment_component');`); + this.addSql(`drop table if exists "environment_component" cascade;`); + + this.addSql(`select migrate_table('effect', 'effect');`); + this.addSql(`drop table if exists "effect" cascade;`); + + this.addSql(`select migrate_table('constraint', 'constraint');`); + this.addSql(`drop table if exists "constraint" cascade;`); + + this.addSql(`select migrate_table('assumption', 'assumption');`); + this.addSql(`drop table if exists "assumption" cascade;`); + + this.addSql(`select migrate_table('stakeholder', 'stakeholder');`); + this.addSql(`drop table if exists "stakeholder" cascade;`); + + this.addSql(`select migrate_table('system_component', 'system_component');`); + this.addSql(`drop table if exists "system_component" cascade;`); + + this.addSql(`select migrate_table('task', 'task');`); + this.addSql(`drop table if exists "task" cascade;`); + + this.addSql(`select migrate_table('test_case', 'test_case');`); + this.addSql(`drop table if exists "test_case" cascade;`); + + this.addSql(`select migrate_table('use_case', 'use_case');`); + this.addSql(`drop table if exists "use_case" cascade;`); + + this.addSql(`select migrate_table('user_story', 'user_story');`); + this.addSql(`drop table if exists "user_story" cascade;`); + + // cleanup function + this.addSql(`drop function migrate_table;`); + + this.addSql(`alter table "audit_log" alter column "entity" type jsonb using ("entity"::jsonb);`); + this.addSql(`alter table "audit_log" alter column "entity" set not null;`); + } + + override async down(): Promise { + this.addSql(`alter table "requirement" drop constraint "requirement_parent_component_id_foreign";`); + + this.addSql(`alter table "requirement" drop constraint "requirement_primary_actor_id_foreign";`); + + this.addSql(`alter table "requirement" drop constraint "requirement_parent_component_1_id_foreign";`); + + this.addSql(`alter table "requirement" drop constraint "requirement_precondition_id_foreign";`); + + this.addSql(`alter table "requirement" drop constraint "requirement_success_guarantee_id_foreign";`); + + this.addSql(`alter table "requirement" drop constraint "requirement_follows_id_foreign";`); + + this.addSql(`alter table "requirement" drop constraint "requirement_functional_behavior_id_foreign";`); + + this.addSql(`alter table "requirement" drop constraint "requirement_outcome_id_foreign";`); + + this.addSql(` + CREATE OR REPLACE FUNCTION migrate_to_old_table(old_table TEXT, req_type TEXT) + RETURNS VOID AS $$ + DECLARE + cols TEXT; + BEGIN + -- Find matching columns between 'requirement' and the old table + SELECT string_agg(c.column_name, ', ') INTO cols + FROM information_schema.columns c + WHERE c.table_name = old_table + AND c.column_name IN ( + SELECT column_name + FROM information_schema.columns + WHERE table_name = 'requirement' + ); + + -- Execute the dynamic insert statement + EXECUTE format( + 'INSERT INTO %I (%s) + SELECT %s FROM "requirement" WHERE req_type = ''%s''', + old_table, cols, cols, req_type + ); + END; + $$ LANGUAGE plpgsql; + `) + + this.addSql(`create table "silence" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, constraint "silence_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('silence', 'silence');`); + + this.addSql(`create table "role" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, constraint "role_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('role', 'role');`); + + this.addSql(`create table "responsibility" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, constraint "responsibility_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('responsibility', 'responsibility');`); + + this.addSql(`create table "product" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, constraint "product_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('product', 'product');`); + + this.addSql(`create table "parsed_requirement" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, constraint "parsed_requirement_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('parsed_requirement', 'parsed_requirement');`); + + this.addSql(`create table "person" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "email" varchar(254) null, "follows_id" uuid null, constraint "person_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('person', 'person');`); + + this.addSql(`create table "outcome" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "follows_id" uuid null, constraint "outcome_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('outcome', 'outcome');`); + + this.addSql(`create table "obstacle" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "follows_id" uuid null, constraint "obstacle_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('obstacle', 'obstacle');`); + + this.addSql(`create table "non_functional_behavior" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "priority" text check ("priority" in ('MUST', 'SHOULD', 'COULD', 'WONT')) not null, "follows_id" uuid null, constraint "non_functional_behavior_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('non_functional_behavior', 'non_functional_behavior');`); + + this.addSql(`create table "noise" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, constraint "noise_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('noise', 'noise');`); + + this.addSql(`create table "limit" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "follows_id" uuid null, constraint "limit_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('limit', 'limit');`); + + this.addSql(`create table "justification" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "follows_id" uuid null, constraint "justification_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('justification', 'justification');`); + + this.addSql(`create table "invariant" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "follows_id" uuid null, constraint "invariant_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('invariant', 'invariant');`); + + this.addSql(`create table "hint" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, constraint "hint_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('hint', 'hint');`); + + this.addSql(`create table "glossary_term" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "parent_component_id" uuid null, "follows_id" uuid null, constraint "glossary_term_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('glossary_term', 'glossary_term');`); + + this.addSql(`create table "functional_behavior" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "priority" text check ("priority" in ('MUST', 'SHOULD', 'COULD', 'WONT')) not null, "follows_id" uuid null, constraint "functional_behavior_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('functional_behavior', 'functional_behavior');`); + + this.addSql(`create table "environment_component" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "parent_component_id" uuid null, "follows_id" uuid null, constraint "environment_component_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('environment_component', 'environment_component');`); + + this.addSql(`create table "effect" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "follows_id" uuid null, constraint "effect_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('effect', 'effect');`); + + this.addSql(`create table "constraint" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "category" text check ("category" in ('Business Rule', 'Physical Law', 'Engineering Decision')) null, "follows_id" uuid null, constraint "constraint_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('constraint', 'constraint');`); + + this.addSql(`create table "assumption" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "follows_id" uuid null, constraint "assumption_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('assumption', 'assumption');`); + + this.addSql(`create table "stakeholder" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "follows_id" uuid null, "parent_component_id" uuid null, "segmentation" text check ("segmentation" in ('Client', 'Vendor')) null, "category" text check ("category" in ('Key Stakeholder', 'Shadow Influencer', 'Fellow Traveler', 'Observer')) null, "availability" int not null, "influence" int not null, constraint "stakeholder_pkey" primary key ("id"), constraint stakeholder_availability_check check (availability >= 0 AND availability <= 100), constraint stakeholder_influence_check check (influence >= 0 AND influence <= 100));`); + this.addSql(`select migrate_to_old_table('stakeholder', 'stakeholder');`); + + this.addSql(`create table "system_component" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "follows_id" uuid null, "parent_component_id" uuid null, constraint "system_component_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('system_component', 'system_component');`); + + this.addSql(`create table "task" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, constraint "task_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('task', 'task');`); + + this.addSql(`create table "test_case" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "priority" text check ("priority" in ('MUST', 'SHOULD', 'COULD', 'WONT')) not null, constraint "test_case_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('test_case', 'test_case');`); + + this.addSql(`create table "use_case" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "priority" text check ("priority" in ('MUST', 'SHOULD', 'COULD', 'WONT')) not null, "primary_actor_id" uuid null, "follows_id" uuid null, "scope" varchar(255) not null, "level" varchar(255) not null, "goal_in_context" varchar(255) not null, "precondition_id" uuid null, "trigger_id" uuid null, "main_success_scenario" varchar(255) not null, "success_guarantee_id" uuid null, "extensions" varchar(255) not null, constraint "use_case_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('use_case', 'use_case');`); + + this.addSql(`create table "user_story" ("id" uuid not null, "name" varchar(255) not null, "statement" varchar(1000) not null, "solution_id" uuid not null, "last_modified" timestamptz not null default now(), "modified_by_id" uuid not null default 'ac594919-50e3-438a-b9bc-efb8a8654243', "is_silence" boolean not null default false, "priority" text check ("priority" in ('MUST', 'SHOULD', 'COULD', 'WONT')) not null, "primary_actor_id" uuid null, "follows_id" uuid null, "functional_behavior_id" uuid null, "outcome_id" uuid null, constraint "user_story_pkey" primary key ("id"));`); + this.addSql(`select migrate_to_old_table('user_story', 'user_story');`); + + // cleanup function + this.addSql(`drop function migrate_to_old_table;`); + + this.addSql(`alter table "silence" add constraint "silence_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "silence" add constraint "silence_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + + this.addSql(`alter table "role" add constraint "role_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "role" add constraint "role_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + + this.addSql(`alter table "responsibility" add constraint "responsibility_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "responsibility" add constraint "responsibility_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + + this.addSql(`alter table "product" add constraint "product_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "product" add constraint "product_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + + this.addSql(`alter table "parsed_requirement" add constraint "parsed_requirement_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "parsed_requirement" add constraint "parsed_requirement_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + + this.addSql(`alter table "person" add constraint "person_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "person" add constraint "person_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "person" add constraint "person_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "outcome" add constraint "outcome_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "outcome" add constraint "outcome_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "outcome" add constraint "outcome_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "obstacle" add constraint "obstacle_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "obstacle" add constraint "obstacle_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "obstacle" add constraint "obstacle_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "non_functional_behavior" add constraint "non_functional_behavior_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "non_functional_behavior" add constraint "non_functional_behavior_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "non_functional_behavior" add constraint "non_functional_behavior_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "noise" add constraint "noise_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "noise" add constraint "noise_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + + this.addSql(`alter table "limit" add constraint "limit_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "limit" add constraint "limit_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "limit" add constraint "limit_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "justification" add constraint "justification_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "justification" add constraint "justification_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "justification" add constraint "justification_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "invariant" add constraint "invariant_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "invariant" add constraint "invariant_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "invariant" add constraint "invariant_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "hint" add constraint "hint_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "hint" add constraint "hint_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + + this.addSql(`alter table "glossary_term" add constraint "glossary_term_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "glossary_term" add constraint "glossary_term_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "glossary_term" add constraint "glossary_term_parent_component_id_foreign" foreign key ("parent_component_id") references "glossary_term" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "glossary_term" add constraint "glossary_term_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "functional_behavior" add constraint "functional_behavior_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "functional_behavior" add constraint "functional_behavior_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "functional_behavior" add constraint "functional_behavior_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "environment_component" add constraint "environment_component_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "environment_component" add constraint "environment_component_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "environment_component" add constraint "environment_component_parent_component_id_foreign" foreign key ("parent_component_id") references "environment_component" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "environment_component" add constraint "environment_component_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "effect" add constraint "effect_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "effect" add constraint "effect_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "effect" add constraint "effect_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "constraint" add constraint "constraint_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "constraint" add constraint "constraint_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "constraint" add constraint "constraint_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "assumption" add constraint "assumption_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "assumption" add constraint "assumption_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "assumption" add constraint "assumption_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "stakeholder" add constraint "stakeholder_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "stakeholder" add constraint "stakeholder_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "stakeholder" add constraint "stakeholder_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "stakeholder" add constraint "stakeholder_parent_component_id_foreign" foreign key ("parent_component_id") references "stakeholder" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "system_component" add constraint "system_component_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "system_component" add constraint "system_component_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "system_component" add constraint "system_component_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "system_component" add constraint "system_component_parent_component_id_foreign" foreign key ("parent_component_id") references "system_component" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "task" add constraint "task_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "task" add constraint "task_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + + this.addSql(`alter table "test_case" add constraint "test_case_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "test_case" add constraint "test_case_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + + this.addSql(`alter table "use_case" add constraint "use_case_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "use_case" add constraint "use_case_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "use_case" add constraint "use_case_primary_actor_id_foreign" foreign key ("primary_actor_id") references "stakeholder" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "use_case" add constraint "use_case_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "use_case" add constraint "use_case_precondition_id_foreign" foreign key ("precondition_id") references "assumption" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "use_case" add constraint "use_case_success_guarantee_id_foreign" foreign key ("success_guarantee_id") references "effect" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "user_story" add constraint "user_story_solution_id_foreign" foreign key ("solution_id") references "solution" ("id") on update cascade;`); + this.addSql(`alter table "user_story" add constraint "user_story_modified_by_id_foreign" foreign key ("modified_by_id") references "app_user" ("id") on update cascade;`); + this.addSql(`alter table "user_story" add constraint "user_story_primary_actor_id_foreign" foreign key ("primary_actor_id") references "stakeholder" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "user_story" add constraint "user_story_follows_id_foreign" foreign key ("follows_id") references "parsed_requirement" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "user_story" add constraint "user_story_functional_behavior_id_foreign" foreign key ("functional_behavior_id") references "functional_behavior" ("id") on update cascade on delete set null;`); + this.addSql(`alter table "user_story" add constraint "user_story_outcome_id_foreign" foreign key ("outcome_id") references "outcome" ("id") on update cascade on delete set null;`); + + this.addSql(`drop table if exists "requirement" cascade;`); + + this.addSql(`alter table "audit_log" alter column "entity" type jsonb using ("entity"::jsonb);`); + this.addSql(`alter table "audit_log" alter column "entity" drop not null;`); + } +} diff --git a/migrations/Migration20241015215709.ts b/migrations/Migration20241015215709.ts new file mode 100644 index 00000000..1fcedfa5 --- /dev/null +++ b/migrations/Migration20241015215709.ts @@ -0,0 +1,29 @@ +import { Migration } from '@mikro-orm/migrations'; + +export class Migration20241015215709 extends Migration { + + override async up(): Promise { + this.addSql(`create table "requirement_relation" ("id" uuid not null, "left_id" uuid not null, "right_id" uuid not null, "rel_type" text check ("rel_type" in ('belongs', 'characterizes', 'constrains', 'contradicts', 'details', 'disjoins', 'duplicates', 'excepts', 'explains', 'extends', 'follows', 'repeats', 'shares')) not null, "left_1_id" uuid null, constraint "requirement_relation_pkey" primary key ("id"));`); + this.addSql(`alter table "requirement_relation" add constraint "requirement_relation_left_id_unique" unique ("left_id");`); + this.addSql(`alter table "requirement_relation" add constraint "requirement_relation_right_id_unique" unique ("right_id");`); + this.addSql(`create index "requirement_relation_rel_type_index" on "requirement_relation" ("rel_type");`); + this.addSql(`alter table "requirement_relation" add constraint "requirement_relation_left_1_id_unique" unique ("left_1_id");`); + + this.addSql(`alter table "requirement_relation" add constraint "requirement_relation_left_id_foreign" foreign key ("left_id") references "requirement" ("id") on update cascade;`); + this.addSql(`alter table "requirement_relation" add constraint "requirement_relation_right_id_foreign" foreign key ("right_id") references "requirement" ("id") on update cascade;`); + this.addSql(`alter table "requirement_relation" add constraint "requirement_relation_left_1_id_foreign" foreign key ("left_1_id") references "requirement" ("id") on update cascade on delete set null;`); + + this.addSql(`alter table "requirement" drop constraint if exists "requirement_req_type_check";`); + + this.addSql(`alter table "requirement" add constraint "requirement_req_type_check" check("req_type" in ('assumption', 'constraint', 'effect', 'environment_component', 'functional_behavior', 'glossary_term', 'hint', 'invariant', 'justification', 'limit', 'meta_requirement', 'noise', 'non_functional_behavior', 'obstacle', 'outcome', 'parsed_requirement', 'person', 'product', 'responsibility', 'role', 'silence', 'stakeholder', 'system_component', 'task', 'test_case', 'use_case', 'user_story'));`); + } + + override async down(): Promise { + this.addSql(`drop table if exists "requirement_relation" cascade;`); + + this.addSql(`alter table "requirement" drop constraint if exists "requirement_req_type_check";`); + + this.addSql(`alter table "requirement" add constraint "requirement_req_type_check" check("req_type" in ('assumption', 'constraint', 'effect', 'environment_component', 'functional_behavior', 'glossary_term', 'hint', 'invariant', 'justification', 'limit', 'noise', 'non_functional_behavior', 'obstacle', 'outcome', 'parsed_requirement', 'person', 'product', 'responsibility', 'role', 'silence', 'stakeholder', 'system_component', 'task', 'test_case', 'use_case', 'user_story'));`); + } + +} diff --git a/mikro-orm.config.ts b/mikro-orm.config.ts index d0dee48e..b5a33c87 100644 --- a/mikro-orm.config.ts +++ b/mikro-orm.config.ts @@ -6,6 +6,7 @@ import { type Options, PostgreSqlDriver } from '@mikro-orm/postgresql'; import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; import { Migrator } from '@mikro-orm/migrations'; import * as entities from "./server/domain/index.js"; +import * as relations from "./server/domain/relations/index.js"; import AuditSubscriber from "./server/data/subscribers/AuditSubscriber.js"; dotenv.config(); @@ -21,8 +22,10 @@ const config: Options = { driverOptions: { connection: { ssl: true } }, - entities: Object.values(entities) - .filter((entity) => typeof entity === 'function'), + entities: [ + ...Object.values(entities), + ...Object.values(relations) + ].filter((entity) => typeof entity === 'function'), discovery: { disableDynamicFileAccess: true }, seeder: {}, subscribers: [new AuditSubscriber()], diff --git a/package-lock.json b/package-lock.json index a5ffcc4b..d83d7bec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@final-hill/cathedral", - "version": "0.16.0", + "version": "0.17.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@final-hill/cathedral", - "version": "0.16.0", + "version": "0.17.0", "hasInstallScript": true, "license": "AGPL-3.0-only", "dependencies": { diff --git a/package.json b/package.json index 50826209..b9694a33 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@final-hill/cathedral", - "version": "0.16.0", + "version": "0.17.0", "description": "Requirements management system", "keywords": [], "private": true, diff --git a/server/domain/Assumption.ts b/server/domain/Assumption.ts index e09677e9..3c9dc0cf 100644 --- a/server/domain/Assumption.ts +++ b/server/domain/Assumption.ts @@ -15,6 +15,6 @@ export class Assumption extends Requirement { /** * Requirement that this assumption follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement } \ No newline at end of file diff --git a/server/domain/AuditLog.ts b/server/domain/AuditLog.ts index b1413368..8e76822a 100644 --- a/server/domain/AuditLog.ts +++ b/server/domain/AuditLog.ts @@ -1,6 +1,5 @@ import { v7 as uuidv7 } from 'uuid'; -import { ChangeSetType, Entity, Enum, ManyToOne, Property } from "@mikro-orm/core"; -import { Solution } from './Solution.js'; +import { ChangeSetType, Entity, Enum, Property } from "@mikro-orm/core"; /** * The AuditLog class is responsible for tracking changes to entities in the database. @@ -41,7 +40,7 @@ export class AuditLog { /** * The entity that was changed */ - @Property({ type: 'json', nullable: true }) + @Property({ type: 'json' }) entity: string /** diff --git a/server/domain/Behavior.ts b/server/domain/Behavior.ts index 615c0c1e..ba2e4008 100644 --- a/server/domain/Behavior.ts +++ b/server/domain/Behavior.ts @@ -15,6 +15,6 @@ export abstract class Behavior extends Requirement { /** * The priority of the behavior. */ - @Enum({ items: () => MoscowPriority, nullable: false }) + @Enum({ items: () => MoscowPriority }) priority: MoscowPriority; } \ No newline at end of file diff --git a/server/domain/Constraint.ts b/server/domain/Constraint.ts index 70f71523..4b554410 100644 --- a/server/domain/Constraint.ts +++ b/server/domain/Constraint.ts @@ -17,12 +17,12 @@ export class Constraint extends Requirement { /** * Category of the constraint */ - @Enum({ items: () => ConstraintCategory, nullable: true }) + @Enum({ items: () => ConstraintCategory }) category?: ConstraintCategory; /** * Requirement that this constraint follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/Effect.ts b/server/domain/Effect.ts index de3123c4..81dabe05 100644 --- a/server/domain/Effect.ts +++ b/server/domain/Effect.ts @@ -15,6 +15,6 @@ export class Effect extends Requirement { /** * Requirement that this effect follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/EnvironmentComponent.ts b/server/domain/EnvironmentComponent.ts index 78bef3df..39f405d3 100644 --- a/server/domain/EnvironmentComponent.ts +++ b/server/domain/EnvironmentComponent.ts @@ -16,12 +16,12 @@ export class EnvironmentComponent extends Component { /** * The parent component of the current environment component if any */ - @ManyToOne({ entity: () => EnvironmentComponent, nullable: true }) + @ManyToOne({ entity: () => EnvironmentComponent }) parentComponent?: EnvironmentComponent; /** * Requirement that this environment component follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/FunctionalBehavior.ts b/server/domain/FunctionalBehavior.ts index 02e87eff..e0baa33e 100644 --- a/server/domain/FunctionalBehavior.ts +++ b/server/domain/FunctionalBehavior.ts @@ -17,6 +17,6 @@ export class FunctionalBehavior extends Functionality { /** * Requirement that this functional behavior follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/GlossaryTerm.ts b/server/domain/GlossaryTerm.ts index 8227db89..6330bc74 100644 --- a/server/domain/GlossaryTerm.ts +++ b/server/domain/GlossaryTerm.ts @@ -16,12 +16,12 @@ export class GlossaryTerm extends Component { /** * The parent term of the glossary term, if any. */ - @ManyToOne({ entity: () => GlossaryTerm, nullable: true }) + @ManyToOne({ entity: () => GlossaryTerm }) parentComponent?: GlossaryTerm; /** * Requirement that this glossary term follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/Invariant.ts b/server/domain/Invariant.ts index f4632278..675198c0 100644 --- a/server/domain/Invariant.ts +++ b/server/domain/Invariant.ts @@ -17,6 +17,6 @@ export class Invariant extends Requirement { /** * Requirement that this invariant follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/Justification.ts b/server/domain/Justification.ts index d7a37362..fc7ab12b 100644 --- a/server/domain/Justification.ts +++ b/server/domain/Justification.ts @@ -15,6 +15,6 @@ export class Justification extends MetaRequirement { /** * Requirement that this justification follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/Limit.ts b/server/domain/Limit.ts index 08a63c1e..1e274875 100644 --- a/server/domain/Limit.ts +++ b/server/domain/Limit.ts @@ -15,6 +15,6 @@ export class Limit extends Requirement { /** * Requirement that this limit follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/MetaRequirement.ts b/server/domain/MetaRequirement.ts index eaaaf83c..7efacb9a 100644 --- a/server/domain/MetaRequirement.ts +++ b/server/domain/MetaRequirement.ts @@ -4,5 +4,5 @@ import { Requirement } from "./Requirement.js"; /** * Property of requirements themselves (not of the Project, Environment, Goals, or System) */ -@Entity({ abstract: true }) -export abstract class MetaRequirement extends Requirement { } \ No newline at end of file +@Entity() +export class MetaRequirement extends Requirement { } \ No newline at end of file diff --git a/server/domain/NonFunctionalBehavior.ts b/server/domain/NonFunctionalBehavior.ts index 22b818dd..15fc750b 100644 --- a/server/domain/NonFunctionalBehavior.ts +++ b/server/domain/NonFunctionalBehavior.ts @@ -17,6 +17,6 @@ export class NonFunctionalBehavior extends Functionality { /** * Requirement that this non-functional behavior follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/Obstacle.ts b/server/domain/Obstacle.ts index d5f0ffd5..5b3a2eca 100644 --- a/server/domain/Obstacle.ts +++ b/server/domain/Obstacle.ts @@ -15,6 +15,6 @@ export class Obstacle extends Goal { /** * Requirement that this obstacle follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/Outcome.ts b/server/domain/Outcome.ts index 02ec7f81..04b5ae14 100644 --- a/server/domain/Outcome.ts +++ b/server/domain/Outcome.ts @@ -15,6 +15,6 @@ export class Outcome extends Goal { /** * Requirement that this outcome follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/Person.ts b/server/domain/Person.ts index 3da19c49..1f924fbb 100644 --- a/server/domain/Person.ts +++ b/server/domain/Person.ts @@ -17,12 +17,12 @@ export class Person extends Actor { * Email address of the person */ // email address: https://stackoverflow.com/a/574698 - @Property({ type: 'string', length: 254, nullable: true }) + @Property({ type: 'string', length: 254 }) email?: string; /** * Requirement that this person follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; } \ No newline at end of file diff --git a/server/domain/Requirement.ts b/server/domain/Requirement.ts index f0f98375..b1528619 100644 --- a/server/domain/Requirement.ts +++ b/server/domain/Requirement.ts @@ -6,7 +6,10 @@ import { Solution } from './Solution.js'; /** * A Requirement is a statement that specifies a property. */ -@Entity({ abstract: true }) +@Entity({ + discriminatorColumn: 'req_type', + abstract: true +}) export abstract class Requirement { constructor(props: Omit) { this.id = uuidv7(); @@ -31,26 +34,26 @@ export abstract class Requirement { /** * A short name for the requirement */ - @Property({ type: 'string', nullable: false }) + @Property({ type: 'string' }) name: string; /** * A human-readable description of a property * @throws {Error} if the statement is longer than 1000 characters */ - @Property({ type: 'string', length: 1000, nullable: false }) + @Property({ type: 'string', length: 1000 }) statement: string; /** * The solution that owns this requirement */ - @ManyToOne({ entity: () => Solution, nullable: false }) + @ManyToOne({ entity: () => Solution }) solution: Solution; /** * The date and time when the requirement was last modified */ - @Property({ type: 'datetime', nullable: false, onCreate: () => new Date(), onUpdate: () => new Date(), defaultRaw: 'now()' }) + @Property({ type: 'datetime', onCreate: () => new Date(), onUpdate: () => new Date(), defaultRaw: 'now()' }) lastModified: Date; /** @@ -58,13 +61,13 @@ export abstract class Requirement { */ // System Admin is the default user for the initial migration // This can be removed in v0.14.0 or later - @ManyToOne({ entity: () => AppUser, nullable: false, default: 'ac594919-50e3-438a-b9bc-efb8a8654243' }) + @ManyToOne({ entity: () => AppUser, default: 'ac594919-50e3-438a-b9bc-efb8a8654243' }) modifiedBy: AppUser; /** * Whether the requirement is a silence requirement. * (i.e. a requirement that is not included in the solution) */ - @Property({ type: 'boolean', nullable: false, default: false }) + @Property({ type: 'boolean', default: false }) isSilence: boolean; } \ No newline at end of file diff --git a/server/domain/Scenario.ts b/server/domain/Scenario.ts index 017f0925..7a52b779 100644 --- a/server/domain/Scenario.ts +++ b/server/domain/Scenario.ts @@ -16,6 +16,6 @@ export abstract class Scenario extends Example { /** * Primary actor involved in the scenario */ - @ManyToOne({ entity: () => Stakeholder, nullable: true }) + @ManyToOne({ entity: () => Stakeholder }) primaryActor?: Stakeholder; } \ No newline at end of file diff --git a/server/domain/Stakeholder.ts b/server/domain/Stakeholder.ts index b0ce6972..1255bdb7 100644 --- a/server/domain/Stakeholder.ts +++ b/server/domain/Stakeholder.ts @@ -23,36 +23,36 @@ export class Stakeholder extends Component { /** * Requirement that this stakeholder follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; /** * The parent component of the stakeholder, if any. */ - @ManyToOne({ entity: () => Stakeholder, nullable: true }) + @ManyToOne({ entity: () => Stakeholder }) parentComponent?: Stakeholder; /** * The segmentation of the stakeholder. */ - @Enum({ items: () => StakeholderSegmentation, nullable: true }) + @Enum({ items: () => StakeholderSegmentation }) segmentation?: StakeholderSegmentation; /** * The category of the stakeholder. */ - @Enum({ items: () => StakeholderCategory, nullable: true }) + @Enum({ items: () => StakeholderCategory }) category?: StakeholderCategory; /** * The availability of the stakeholder. */ - @Property({ type: 'number', nullable: false, check: 'availability >= 0 AND availability <= 100' }) + @Property({ type: 'number', check: 'availability >= 0 AND availability <= 100' }) availability: number; /** * The influence of the stakeholder. */ - @Property({ type: 'number', nullable: false, check: 'influence >= 0 AND influence <= 100' }) + @Property({ type: 'number', check: 'influence >= 0 AND influence <= 100' }) influence: number; } \ No newline at end of file diff --git a/server/domain/SystemComponent.ts b/server/domain/SystemComponent.ts index 3c044ff3..43c6822b 100644 --- a/server/domain/SystemComponent.ts +++ b/server/domain/SystemComponent.ts @@ -16,12 +16,12 @@ export class SystemComponent extends Component { /** * Requirement that this system component follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; /** * Parent component of the current system component */ - @ManyToOne({ entity: () => SystemComponent, nullable: true }) + @ManyToOne({ entity: () => SystemComponent }) parentComponent?: SystemComponent; } \ No newline at end of file diff --git a/server/domain/UseCase.ts b/server/domain/UseCase.ts index 285e724d..be4976e9 100644 --- a/server/domain/UseCase.ts +++ b/server/domain/UseCase.ts @@ -27,40 +27,40 @@ export class UseCase extends Scenario { /** * Requirement that this use case follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; /** * The scope of the use case. */ // TODO: - @Property({ type: 'string', nullable: false }) + @Property({ type: 'string' }) scope: string; /** * The level of the use case. */ // TODO: - @Property({ type: 'string', nullable: false }) + @Property({ type: 'string' }) level: string; /** * The goal in context of the use case. */ // TODO: is this just the Goal.description? - @Property({ type: 'string', nullable: false }) + @Property({ type: 'string' }) goalInContext: string; /** * The precondition is an Assumption that must be true before the use case can start. */ - @ManyToOne({ entity: () => Assumption, nullable: true }) + @ManyToOne({ entity: () => Assumption }) precondition?: Assumption; /** * The action upon the system that starts the use case. */ - @Property({ type: 'uuid', nullable: true }) + @Property({ type: 'uuid' }) triggerId?: string; /** @@ -72,20 +72,20 @@ export class UseCase extends Scenario { * ... */ //mainSuccessScenario: [FunctionalRequirement | Constraint | Role | Responsibility][] - @Property({ type: 'string', nullable: false }) + @Property({ type: 'string' }) mainSuccessScenario: string /** * An Effect that is guaranteed to be true after the use case is completed. */ - @ManyToOne({ entity: () => Effect, nullable: true }) + @ManyToOne({ entity: () => Effect }) successGuarantee?: Effect; /** * Extensions of the use case. */ // extensions: [FunctionalRequirement | Constraint | Role | Responsibility][] - @Property({ type: 'string', nullable: false }) + @Property({ type: 'string' }) extensions: string // TODO: diff --git a/server/domain/UserStory.ts b/server/domain/UserStory.ts index 11032820..fbf4a76a 100644 --- a/server/domain/UserStory.ts +++ b/server/domain/UserStory.ts @@ -25,18 +25,18 @@ export class UserStory extends Scenario { /** * Requirement that this user story follows from */ - @ManyToOne({ entity: () => ParsedRequirement, nullable: true }) + @ManyToOne({ entity: () => ParsedRequirement }) follows?: ParsedRequirement; /** * The action that the user wants to perform. */ - @ManyToOne({ entity: () => FunctionalBehavior, nullable: true }) + @ManyToOne({ entity: () => FunctionalBehavior }) functionalBehavior?: FunctionalBehavior; /** * The outcome that the story is aiming to achieve. */ - @ManyToOne({ entity: () => Outcome, nullable: true }) + @ManyToOne({ entity: () => Outcome }) outcome?: Outcome; } \ No newline at end of file diff --git a/server/domain/relations/Belongs.ts b/server/domain/relations/Belongs.ts new file mode 100644 index 00000000..2dcb3392 --- /dev/null +++ b/server/domain/relations/Belongs.ts @@ -0,0 +1,10 @@ +import { Entity } from "@mikro-orm/core"; +import { RequirementRelation } from "./RequirementRelation.js"; + +/** + * X ⊆ Y + * X is a sub-requirement of Y + * X is textually included in Y + */ +@Entity() +export class Belongs extends RequirementRelation { } \ No newline at end of file diff --git a/server/domain/relations/Characterizes.ts b/server/domain/relations/Characterizes.ts new file mode 100644 index 00000000..1a640084 --- /dev/null +++ b/server/domain/relations/Characterizes.ts @@ -0,0 +1,19 @@ +import { Entity, OneToOne } from "@mikro-orm/core"; +import { RequirementRelation } from "./RequirementRelation.js"; +import { MetaRequirement } from "../MetaRequirement.js"; + +/** + * X → Y + * X is a meta-requirement involving Y + * Meta-requirement X applies to requirement Y + */ +@Entity() +export class Characterizes extends RequirementRelation { + constructor(props: Omit) { + super(props); + this.left = props.left; + } + + @OneToOne({ entity: () => MetaRequirement }) + override left: MetaRequirement +} \ No newline at end of file diff --git a/server/domain/relations/Constrains.ts b/server/domain/relations/Constrains.ts new file mode 100644 index 00000000..9d84fc6e --- /dev/null +++ b/server/domain/relations/Constrains.ts @@ -0,0 +1,9 @@ +import { Entity } from "@mikro-orm/core"; +import { RequirementRelation } from "./RequirementRelation.js"; + +/** + * X ▸ Y + * Constraint X applies to Y + */ +@Entity() +export class Constrains extends RequirementRelation { } \ No newline at end of file diff --git a/server/domain/relations/Contradicts.ts b/server/domain/relations/Contradicts.ts new file mode 100644 index 00000000..78c55169 --- /dev/null +++ b/server/domain/relations/Contradicts.ts @@ -0,0 +1,10 @@ +import { Entity } from "@mikro-orm/core"; +import { RequirementRelation } from "./RequirementRelation.js"; + +/** + * X ⊕ Y + * X contradicts Y + * Properties specified by X and Y cannot both hold + */ +@Entity() +export class Contradicts extends RequirementRelation { } \ No newline at end of file diff --git a/server/domain/relations/Details.ts b/server/domain/relations/Details.ts new file mode 100644 index 00000000..1f9f98d5 --- /dev/null +++ b/server/domain/relations/Details.ts @@ -0,0 +1,9 @@ +import { Entity } from "@mikro-orm/core"; +import { Extends } from "./Extends.js"; + +/** + * X » Y + * X adds detail to properties of Y + */ +@Entity() +export class Details extends Extends { } \ No newline at end of file diff --git a/server/domain/relations/Disjoins.ts b/server/domain/relations/Disjoins.ts new file mode 100644 index 00000000..847d9f5f --- /dev/null +++ b/server/domain/relations/Disjoins.ts @@ -0,0 +1,9 @@ +import { Entity } from "@mikro-orm/core"; +import { RequirementRelation } from "./RequirementRelation.js"; + +/** + * X || Y + * X and Y are unrelated + */ +@Entity() +export class Disjoins extends RequirementRelation { } \ No newline at end of file diff --git a/server/domain/relations/Duplicates.ts b/server/domain/relations/Duplicates.ts new file mode 100644 index 00000000..3de5b9b9 --- /dev/null +++ b/server/domain/relations/Duplicates.ts @@ -0,0 +1,12 @@ +import { Entity } from "@mikro-orm/core"; +import { Repeats } from "./Repeats.js"; + +/** + * X ≡ Y + * + * X ⇔ Y, and X has the same type as Y + * In other words, X and Y are redundant + * Same properties, same type (notation-wise, X ≡ Y) + */ +@Entity() +export class Duplicates extends Repeats { } \ No newline at end of file diff --git a/server/domain/relations/Excepts.ts b/server/domain/relations/Excepts.ts new file mode 100644 index 00000000..c36f2d9d --- /dev/null +++ b/server/domain/relations/Excepts.ts @@ -0,0 +1,9 @@ +import { Entity } from "@mikro-orm/core"; +import { RequirementRelation } from "./RequirementRelation.js"; + +/** + * X \\ Y + * X specifies an exception to the property specified by Y. + */ +@Entity() +export class Excepts extends RequirementRelation { } \ No newline at end of file diff --git a/server/domain/relations/Explains.ts b/server/domain/relations/Explains.ts new file mode 100644 index 00000000..e8d1bbbc --- /dev/null +++ b/server/domain/relations/Explains.ts @@ -0,0 +1,14 @@ +import { Entity } from "@mikro-orm/core"; +import { Repeats } from "./Repeats.js"; + +/** + * X ≅ Y + * + * X ⇔ Y, and X has a different type from Y. + * + * In other words, Y introduces no new property but helps understand X better. + * + * Same properties, different type (notation-wise) + */ +@Entity() +export class Explains extends Repeats { } \ No newline at end of file diff --git a/server/domain/relations/Extends.ts b/server/domain/relations/Extends.ts new file mode 100644 index 00000000..44efded3 --- /dev/null +++ b/server/domain/relations/Extends.ts @@ -0,0 +1,11 @@ +import { Entity } from "@mikro-orm/core"; +import { RequirementRelation } from "./RequirementRelation.js"; + +/** + * X > Y + * aka "refines" + * X assumes Y and specifies a property that Y does not + * X adds to properties of Y + */ +@Entity() +export class Extends extends RequirementRelation { } \ No newline at end of file diff --git a/server/domain/relations/Follows.ts b/server/domain/relations/Follows.ts new file mode 100644 index 00000000..b16d73af --- /dev/null +++ b/server/domain/relations/Follows.ts @@ -0,0 +1,9 @@ +import { Entity } from "@mikro-orm/core"; +import { RequirementRelation } from "./RequirementRelation.js"; + +/** + * X ⊣ Y + * X is a consequence of the property specified by Y + */ +@Entity() +export class Follows extends RequirementRelation { } \ No newline at end of file diff --git a/server/domain/relations/Repeats.ts b/server/domain/relations/Repeats.ts new file mode 100644 index 00000000..982096d6 --- /dev/null +++ b/server/domain/relations/Repeats.ts @@ -0,0 +1,9 @@ +import { Entity } from "@mikro-orm/core"; +import { RequirementRelation } from "./RequirementRelation.js"; + +/** + * X ⇔ Y + * X specifies the same property as Y + */ +@Entity() +export class Repeats extends RequirementRelation { } \ No newline at end of file diff --git a/server/domain/relations/RequirementRelation.ts b/server/domain/relations/RequirementRelation.ts new file mode 100644 index 00000000..d9f80536 --- /dev/null +++ b/server/domain/relations/RequirementRelation.ts @@ -0,0 +1,27 @@ +import { v7 as uuidv7 } from 'uuid'; +import { Entity, OneToOne, Property } from "@mikro-orm/core"; +import { Requirement } from '../Requirement.js' + +/** + * Abstract class for relations between requirements + */ +@Entity({ abstract: true, discriminatorColumn: 'rel_type' }) +export abstract class RequirementRelation { + constructor(props: Omit) { + this.id = uuidv7(); + this.left = props.left; + this.right = props.right; + } + + /** + * The unique identifier of the RequirementRelation + */ + @Property({ type: 'uuid', primary: true }) + id: string; + + @OneToOne({ entity: () => Requirement }) + left: Requirement + + @OneToOne({ entity: () => Requirement }) + right: Requirement +} \ No newline at end of file diff --git a/server/domain/relations/Shares.ts b/server/domain/relations/Shares.ts new file mode 100644 index 00000000..8a1ea7e0 --- /dev/null +++ b/server/domain/relations/Shares.ts @@ -0,0 +1,12 @@ +import { Entity } from "@mikro-orm/core"; +import { Repeats } from "./Repeats.js"; + +/** + * X ∩ Y + * + * X' ⇔ Y' for some sub-requirements X' and Y' of X and Y. + * (Involve Repeats) + * Some subrequirement is in common between X and Y. + */ +@Entity() +export class Shares extends Repeats { } \ No newline at end of file diff --git a/server/domain/relations/index.ts b/server/domain/relations/index.ts new file mode 100644 index 00000000..d8c1207a --- /dev/null +++ b/server/domain/relations/index.ts @@ -0,0 +1,14 @@ +export * from './RequirementRelation.js' +export * from './Belongs.js' +export * from './Characterizes.js' +export * from './Constrains.js' +export * from './Contradicts.js' +export * from './Details.js' +export * from './Disjoins.js' +export * from './Duplicates.js' +export * from './Excepts.js' +export * from './Explains.js' +export * from './Extends.js' +export * from './Follows.js' +export * from './Repeats.js' +export * from './Shares.js' \ No newline at end of file