diff --git a/permission-engine/src/database/dbml/tables.dbml b/permission-engine/src/database/dbml/tables.dbml index 170a644..80614a9 100644 --- a/permission-engine/src/database/dbml/tables.dbml +++ b/permission-engine/src/database/dbml/tables.dbml @@ -72,6 +72,7 @@ Table space_equipment { space_id uuid name varchar [not null] type varchar + quantity integer [not null, default: 1] details text is_active bool [not null, default: true] created_at timestamptz [default: `CURRENT_TIMESTAMP`] diff --git a/permission-engine/src/database/sql/migrations/space-equipment-add-column-quantity.sql b/permission-engine/src/database/sql/migrations/space-equipment-add-column-quantity.sql new file mode 100644 index 0000000..74ad408 --- /dev/null +++ b/permission-engine/src/database/sql/migrations/space-equipment-add-column-quantity.sql @@ -0,0 +1,11 @@ +DO $$ +BEGIN + IF NOT EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'space_equipment' + AND column_name = 'quantity' + ) THEN + EXECUTE 'ALTER TABLE space_equipment ADD COLUMN quantity INTEGER NOT NULL DEFAULT 1'; + END IF; +END $$; diff --git a/permission-engine/src/lib/type/index.ts b/permission-engine/src/lib/type/index.ts index 7029f05..afe95c5 100644 --- a/permission-engine/src/lib/type/index.ts +++ b/permission-engine/src/lib/type/index.ts @@ -32,6 +32,7 @@ export enum RuleBlockType { // spaceEvent spaceEventGeneral = 'space_event:general', spaceEventAccess = 'space_event:access', + spaceEventRequireEquipment = 'space_event:require_equipment', } export enum PermissionRequestStatus {