@kipicore/dbcore 1.1.428 → 1.1.430

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const up = async (queryInterface, Sequelize) => {
3
- const tableName = 'visitor_book';
3
+ const tableName = 'visitor_books';
4
4
  const tableExists = await queryInterface
5
5
  .describeTable(tableName)
6
6
  .then(() => true)
@@ -10,7 +10,7 @@ const up = async (queryInterface, Sequelize) => {
10
10
  id: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV4, allowNull: false, primaryKey: true },
11
11
  fileStorageId: {
12
12
  type: Sequelize.UUID,
13
- allowNull: false,
13
+ allowNull: true,
14
14
  field: 'file_storage_id',
15
15
  },
16
16
  date: {
@@ -78,7 +78,7 @@ const up = async (queryInterface, Sequelize) => {
78
78
  id: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV4, allowNull: false, primaryKey: true },
79
79
  fileStorageId: {
80
80
  type: Sequelize.UUID,
81
- allowNull: false,
81
+ allowNull: true,
82
82
  field: 'file_storage_id',
83
83
  },
84
84
  date: {
@@ -149,7 +149,7 @@ const up = async (queryInterface, Sequelize) => {
149
149
  }
150
150
  };
151
151
  const down = async (queryInterface) => {
152
- const tableName = 'visitor_book';
152
+ const tableName = 'visitor_books';
153
153
  const tableExists = await queryInterface
154
154
  .describeTable(tableName)
155
155
  .then(() => true)
@@ -1,22 +1,19 @@
1
1
  'use strict';
2
2
  const up = async (queryInterface, Sequelize) => {
3
- const table = await queryInterface.describeTable('visitor_book');
4
- if (table.file_storage_id) {
5
- await queryInterface.changeColumn('visitor_book', 'file_storage_id', {
3
+ const table = await queryInterface.describeTable('visitor_books');
4
+ if (table.file_storage_id && table.file_storage_id.allowNull === false) {
5
+ await queryInterface.changeColumn('visitor_books', 'file_storage_id', {
6
6
  type: Sequelize.UUID,
7
7
  allowNull: true,
8
- field: 'file_storage_id',
9
8
  });
10
9
  }
11
10
  };
12
11
  const down = async (queryInterface, Sequelize) => {
13
- const table = await queryInterface.describeTable('visitor_book');
14
- // Remove only if column exists
12
+ const table = await queryInterface.describeTable('visitor_books');
15
13
  if (table.file_storage_id) {
16
- await queryInterface.changeColumn('visitor_book', 'file_storage_id', {
14
+ await queryInterface.changeColumn('visitor_books', 'file_storage_id', {
17
15
  type: Sequelize.UUID,
18
- allowNull: false,
19
- field: 'file_storage_id',
16
+ allowNull: true,
20
17
  });
21
18
  }
22
19
  };
@@ -62,7 +62,6 @@ VisitorBookModel.init({
62
62
  date: {
63
63
  type: sequelize_1.DataTypes.DATE,
64
64
  allowNull: true,
65
- field: 'start_date',
66
65
  },
67
66
  name: {
68
67
  type: sequelize_1.DataTypes.STRING,
@@ -89,7 +88,7 @@ VisitorBookModel.init({
89
88
  },
90
89
  }, {
91
90
  modelName: 'VisitorBookModel',
92
- tableName: 'visitor_book',
91
+ tableName: 'visitor_books',
93
92
  timestamps: true,
94
93
  sequelize: index_1.sequelize,
95
94
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.428",
3
+ "version": "1.1.430",
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",