whitelabel-db 1.1.88 → 1.1.89

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,47 @@
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 paymentMethod and refundStatus columns to bookings table.
14
+ const sequelize_1 = require("sequelize");
15
+ const columns = [
16
+ { name: 'source', type: sequelize_1.DataTypes.STRING, allowNull: true },
17
+ { name: 'variant', type: sequelize_1.DataTypes.STRING, allowNull: true },
18
+ ];
19
+ const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
20
+ try {
21
+ // Add all columns in parallel
22
+ yield Promise.all(columns.map((column) => queryInterface.addColumn('bookings', column.name, {
23
+ type: column.type,
24
+ allowNull: column.allowNull,
25
+ })));
26
+ console.log('All columns added successfully.');
27
+ console.log('All columns added successfully.');
28
+ }
29
+ catch (error) {
30
+ console.error('Error while adding columns:', error.message);
31
+ }
32
+ });
33
+ exports.up = up;
34
+ const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
35
+ try {
36
+ // Remove columns
37
+ for (const column of columns.reverse()) {
38
+ console.log(`Removing column: ${column.name}`);
39
+ yield queryInterface.removeColumn('bookings', column.name);
40
+ }
41
+ console.log('All columns removed successfully.');
42
+ }
43
+ catch (error) {
44
+ console.error('Error while removing columns:', error.message);
45
+ }
46
+ });
47
+ exports.down = down;
@@ -24,5 +24,7 @@ export declare class Booking extends Model<Partial<Booking>> {
24
24
  lastCancellationDate?: Date;
25
25
  paymentMethod?: string;
26
26
  refundStatus?: string;
27
+ bookingSource?: string;
28
+ variant?: string;
27
29
  paymentProvider?: string;
28
30
  }
@@ -176,6 +176,20 @@ __decorate([
176
176
  }),
177
177
  __metadata("design:type", String)
178
178
  ], Booking.prototype, "refundStatus", void 0);
179
+ __decorate([
180
+ (0, sequelize_typescript_1.Column)({
181
+ type: sequelize_typescript_1.DataType.STRING,
182
+ allowNull: true,
183
+ }),
184
+ __metadata("design:type", String)
185
+ ], Booking.prototype, "bookingSource", void 0);
186
+ __decorate([
187
+ (0, sequelize_typescript_1.Column)({
188
+ type: sequelize_typescript_1.DataType.STRING,
189
+ allowNull: true,
190
+ }),
191
+ __metadata("design:type", String)
192
+ ], Booking.prototype, "variant", void 0);
179
193
  __decorate([
180
194
  (0, sequelize_typescript_1.Column)({
181
195
  type: sequelize_typescript_1.DataType.STRING,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.1.88",
3
+ "version": "1.1.89",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",