UNPKG

@sphereon/ssi-sdk.data-store

Version:

78 lines 4.13 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateContacts1715761125000 = void 0; const debug_1 = __importDefault(require("debug")); const _1715761125001_CreateContacts_1 = require("../postgres/1715761125001-CreateContacts"); const _1715761125002_CreateContacts_1 = require("../sqlite/1715761125002-CreateContacts"); const debug = (0, debug_1.default)('sphereon:ssi-sdk:migrations'); class CreateContacts1715761125000 { constructor() { this.name = 'CreateContacts1715761125000'; } up(queryRunner) { return __awaiter(this, void 0, void 0, function* () { debug('migration: updating contact tables'); const dbType = queryRunner.connection.driver.options.type; switch (dbType) { case 'postgres': { debug('using postgres migration file'); const mig = new _1715761125001_CreateContacts_1.CreateContacts1715761125001(); yield mig.up(queryRunner); debug('Migration statements executed'); return; } case 'sqlite': case 'expo': case 'react-native': { debug('using sqlite/react-native migration file'); const mig = new _1715761125002_CreateContacts_1.CreateContacts1715761125002(); yield mig.up(queryRunner); debug('Migration statements executed'); return; } default: return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`); } }); } down(queryRunner) { return __awaiter(this, void 0, void 0, function* () { debug('migration: reverting machine state tables'); const dbType = queryRunner.connection.driver.options.type; switch (dbType) { case 'postgres': { debug('using postgres migration file'); const mig = new _1715761125001_CreateContacts_1.CreateContacts1715761125001(); yield mig.down(queryRunner); debug('Migration statements executed'); return; } case 'sqlite': case 'expo': case 'react-native': { debug('using sqlite/react-native migration file'); const mig = new _1715761125002_CreateContacts_1.CreateContacts1715761125002(); yield mig.down(queryRunner); debug('Migration statements executed'); return; } default: return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`); } }); } } exports.CreateContacts1715761125000 = CreateContacts1715761125000; //# sourceMappingURL=9-CreateContacts.js.map