From f453e86e4b67582257dc16c27b8bfe28d6ca2d44 Mon Sep 17 00:00:00 2001 From: Salman <114740396+hrazasalman@users.noreply.github.com> Date: Tue, 10 Dec 2024 08:52:10 +1100 Subject: [PATCH] db(entityTypes): MAUI-4899: Add new entity types (document_group and document) (#6022) new entities --- ...nagementProjectEntities-modifies-schema.js | 28 +++++++++++++++++++ packages/types/src/schemas/schemas.ts | 2 ++ packages/types/src/types/models.ts | 2 ++ 3 files changed, 32 insertions(+) create mode 100644 packages/database/src/migrations/20241205044234-addDocumentManagementProjectEntities-modifies-schema.js diff --git a/packages/database/src/migrations/20241205044234-addDocumentManagementProjectEntities-modifies-schema.js b/packages/database/src/migrations/20241205044234-addDocumentManagementProjectEntities-modifies-schema.js new file mode 100644 index 0000000000..a2fd8093d9 --- /dev/null +++ b/packages/database/src/migrations/20241205044234-addDocumentManagementProjectEntities-modifies-schema.js @@ -0,0 +1,28 @@ +'use strict'; + +var dbm; +var type; +var seed; + +/** + * We receive the dbmigrate dependency from dbmigrate initially. + * This enables us to not have to rely on NODE_PATH. + */ +exports.setup = function (options, seedLink) { + dbm = options.dbmigrate; + type = dbm.dataType; + seed = seedLink; +}; + +exports.up = function (db) { + return db.runSql(`ALTER TYPE public.entity_type ADD VALUE IF NOT EXISTS 'document_group'; + ALTER TYPE public.entity_type ADD VALUE IF NOT EXISTS 'document';`); +}; + +exports.down = function (db) { + return null; +}; + +exports._meta = { + version: 1, +}; diff --git a/packages/types/src/schemas/schemas.ts b/packages/types/src/schemas/schemas.ts index 73bd76f07b..5afb7fb455 100644 --- a/packages/types/src/schemas/schemas.ts +++ b/packages/types/src/schemas/schemas.ts @@ -84700,6 +84700,8 @@ export const EntityTypeEnumSchema = { "disaster", "district", "district_operational", + "document", + "document_group", "enumeration_area", "facility", "facility_building", diff --git a/packages/types/src/types/models.ts b/packages/types/src/types/models.ts index c013ad7760..0270d3b9c9 100644 --- a/packages/types/src/types/models.ts +++ b/packages/types/src/types/models.ts @@ -1882,6 +1882,8 @@ export enum EntityTypeEnum { 'pacmossi_village' = 'pacmossi_village', 'pacmossi_spraying_site' = 'pacmossi_spraying_site', 'pacmossi_insecticide_test' = 'pacmossi_insecticide_test', + 'document_group' = 'document_group', + 'document' = 'document', } export enum DataTableType { 'analytics' = 'analytics',