diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 30a423fa..3dfff5ca 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,7 +17,8 @@ "Nuxtr.nuxtr-vscode", "Vue.volar", "EditorConfig.EditorConfig", - "github.vscode-github-actions" + "github.vscode-github-actions", + "AlexShen.classdiagram-ts" ] } } diff --git a/data/MigrationManager.ts b/data/MigrationManager.ts index 40737419..f0543728 100644 --- a/data/MigrationManager.ts +++ b/data/MigrationManager.ts @@ -1,6 +1,7 @@ import { PGlite } from "@electric-sql/pglite"; import Migration from "./Migration"; import InitDatabase_00001 from "./migrations/00001-InitDatabase"; +import Functionality_00002 from "./migrations/00002-Functionality"; type MigrationName = `${number}-${string}` @@ -9,7 +10,8 @@ type MigrationName = `${number}-${string}` */ export default class MigrationManager { private _migrations = new Map([ - ["00001-InitDatabase", InitDatabase_00001] + ["00001-InitDatabase", InitDatabase_00001], + ["00002-Functionality", Functionality_00002] ]) constructor( diff --git a/data/migrations/00001-InitDatabase.ts b/data/migrations/00001-InitDatabase.ts index 5836baa9..a4618794 100644 --- a/data/migrations/00001-InitDatabase.ts +++ b/data/migrations/00001-InitDatabase.ts @@ -196,7 +196,7 @@ export default class InitDatabase_00001 extends Migration { extensions VARCHAR(200) NOT NULL ) INHERITS (scenario); -` + ` await db.exec(sql) } diff --git a/data/migrations/00002-Functionality.ts b/data/migrations/00002-Functionality.ts new file mode 100644 index 00000000..715cedeb --- /dev/null +++ b/data/migrations/00002-Functionality.ts @@ -0,0 +1,29 @@ +import type { PGliteInterface } from "@electric-sql/pglite"; +import Migration from "../Migration"; + +export default class Functionality_00002 extends Migration { + override async up(db: PGliteInterface): Promise { + const sql = ` + CREATE TABLE cathedral.functionality ( + -- Additional columns can be added here if needed + ) + INHERITS (cathedral.behavior); + + ALTER TABLE cathedral.functional_behavior INHERIT cathedral.functionality; + ALTER TABLE cathedral.non_functional_behavior INHERIT cathedral.functionality; + ` + + await db.exec(sql) + } + override async down(db: PGliteInterface): Promise { + const sql = ` + ALTER TABLE cathedral.functional_behavior NO INHERIT cathedral.behavior; + ALTER TABLE cathedral.non_functional_behavior NO INHERIT cathedral.behavior; + + DROP TABLE cathedral.functionality; + ` + + await db.exec(sql) + } + +} \ No newline at end of file diff --git a/domain/FunctionalBehavior.ts b/domain/FunctionalBehavior.ts index 534105d0..c71fba8e 100644 --- a/domain/FunctionalBehavior.ts +++ b/domain/FunctionalBehavior.ts @@ -1,6 +1,8 @@ -import Behavior from "./Behavior"; +import Functionality from "./Functionality"; /** - * Outcome produced by the system or one of its components + * FunctionalBehavior specifies what behavior the system should exhibit, i.e., + * the actions that the system must perform. + * Generally expressed in the form "system must do ," */ -export default class FunctionalBehavior extends Behavior { } +export default class FunctionalBehavior extends Functionality { } diff --git a/domain/Functionality.ts b/domain/Functionality.ts new file mode 100644 index 00000000..7d00bb0d --- /dev/null +++ b/domain/Functionality.ts @@ -0,0 +1,3 @@ +import Behavior from "./Behavior"; + +export default class Functionality extends Behavior { } \ No newline at end of file diff --git a/domain/NonFunctionalBehavior.ts b/domain/NonFunctionalBehavior.ts index b5e578ed..c321c65c 100644 --- a/domain/NonFunctionalBehavior.ts +++ b/domain/NonFunctionalBehavior.ts @@ -1,3 +1,8 @@ -import Behavior from "./Behavior"; +import Functionality from "./Functionality"; -export default class NonFunctionalBehavior extends Behavior { } +/** + * NonFunctionalBehavior is a type of Behavior that is not directly related to the functionality of a system. + * It specifies how the system should behave, i.e., the qualities that the system must exhibit. + * Generally expressed in the form "system shall be ." + */ +export default class NonFunctionalBehavior extends Functionality { } \ No newline at end of file