@kipicore/dbcore 1.1.175 → 1.1.176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ const up = async (queryInterface, Sequelize) => {
12
12
  }
13
13
  if (!institutesTable.taluka) {
14
14
  await queryInterface.addColumn('institutes', 'taluka', {
15
- type: Sequelize.UUID,
15
+ type: Sequelize.STRING,
16
16
  defaultValue: null,
17
17
  allowNull: true,
18
18
  field: 'taluka',
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('institutes');
4
+ // Case 1: taluka column does NOT exist → add as STRING
5
+ if (!table.taluka) {
6
+ await queryInterface.addColumn('institutes', 'taluka', {
7
+ type: Sequelize.STRING,
8
+ allowNull: true,
9
+ defaultValue: null,
10
+ });
11
+ }
12
+ // Case 2: taluka exists AND type is UUID → change to STRING
13
+ else if (table.taluka.type &&
14
+ table.taluka.type.toLowerCase().includes('uuid')) {
15
+ await queryInterface.changeColumn('institutes', 'taluka', {
16
+ type: Sequelize.STRING,
17
+ allowNull: true,
18
+ });
19
+ }
20
+ };
21
+ const down = async (queryInterface, Sequelize) => {
22
+ const table = await queryInterface.describeTable('institutes');
23
+ if (table.taluka) {
24
+ await queryInterface.removeColumn('institutes', 'taluka');
25
+ }
26
+ };
27
+ module.exports = {
28
+ up,
29
+ down,
30
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.175",
3
+ "version": "1.1.176",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",