whitelabel-db 1.2.1 → 1.2.2

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.
@@ -0,0 +1,3 @@
1
+ import { QueryInterface } from 'sequelize';
2
+ export declare const up: (queryInterface: QueryInterface) => Promise<void>;
3
+ export declare const down: (queryInterface: QueryInterface) => Promise<void>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.down = exports.up = void 0;
13
+ // Purpose: Add deletedAt column to static_hotels table for soft delete functionality.
14
+ const sequelize_1 = require("sequelize");
15
+ const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
16
+ try {
17
+ // Add deletedAt column to static_hotels table
18
+ yield queryInterface.addColumn('static_hotels', 'deletedAt', {
19
+ type: sequelize_1.DataTypes.DATE,
20
+ allowNull: true,
21
+ });
22
+ yield queryInterface.addColumn('static_hotels', 'primaryId', {
23
+ type: sequelize_1.DataTypes.STRING,
24
+ allowNull: true,
25
+ });
26
+ // Add index for better query performance on deletedAt
27
+ yield queryInterface.addIndex('static_hotels', ['deletedAt'], {
28
+ name: 'idx_static_hotels_deleted_at',
29
+ });
30
+ console.log('deletedAt column and index added successfully to static_hotels table.');
31
+ }
32
+ catch (error) {
33
+ console.error('Error while adding deletedAt column:', error.message);
34
+ }
35
+ });
36
+ exports.up = up;
37
+ const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
38
+ try {
39
+ // Remove the index first
40
+ yield queryInterface.removeColumn('static_hotels', 'primaryId');
41
+ // Remove the index first
42
+ yield queryInterface.removeIndex('static_hotels', 'idx_static_hotels_deleted_at');
43
+ // Remove deletedAt column
44
+ yield queryInterface.removeColumn('static_hotels', 'deletedAt');
45
+ console.log('deletedAt column and index removed successfully from static_hotels table.');
46
+ }
47
+ catch (error) {
48
+ console.error('Error while removing deletedAt column:', error.message);
49
+ }
50
+ });
51
+ exports.down = down;
@@ -109,6 +109,8 @@ export declare class Hotel extends Model<Partial<Hotel>> {
109
109
  parking?: string;
110
110
  video?: string;
111
111
  bookingsLast30Days: number;
112
+ deletedAt?: Date;
113
+ primaryId: string;
112
114
  accessibility: HotelAccessibility;
113
115
  translations: HotelTranslation[];
114
116
  hotelFacilityRelations: HotelFacility[];
@@ -452,6 +452,20 @@ __decorate([
452
452
  }),
453
453
  __metadata("design:type", Number)
454
454
  ], Hotel.prototype, "bookingsLast30Days", void 0);
455
+ __decorate([
456
+ (0, sequelize_typescript_1.Column)({
457
+ type: sequelize_typescript_1.DataType.DATE,
458
+ allowNull: true,
459
+ }),
460
+ __metadata("design:type", Date)
461
+ ], Hotel.prototype, "deletedAt", void 0);
462
+ __decorate([
463
+ (0, sequelize_typescript_1.Column)({
464
+ type: sequelize_typescript_1.DataType.STRING,
465
+ allowNull: true,
466
+ }),
467
+ __metadata("design:type", String)
468
+ ], Hotel.prototype, "primaryId", void 0);
455
469
  __decorate([
456
470
  (0, sequelize_typescript_1.HasOne)(() => HotelAccessibility_1.HotelAccessibility),
457
471
  __metadata("design:type", HotelAccessibility_1.HotelAccessibility)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",