UNPKG

@sphereon/ssi-sdk.data-store

Version:

78 lines 4.12 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.CreateContacts1690925872318 = void 0; const debug_1 = __importDefault(require("debug")); const _1690925872693_CreateContacts_1 = require("../sqlite/1690925872693-CreateContacts"); const _1690925872592_CreateContacts_1 = require("../postgres/1690925872592-CreateContacts"); const debug = (0, debug_1.default)('sphereon:ssi-sdk:migrations'); class CreateContacts1690925872318 { constructor() { this.name = 'CreateContacts1690925872318'; } up(queryRunner) { return __awaiter(this, void 0, void 0, function* () { debug('migration: creating contacts tables'); const dbType = queryRunner.connection.driver.options.type; switch (dbType) { case 'postgres': { debug('using postgres migration file'); const mig = new _1690925872592_CreateContacts_1.CreateContacts1690925872592(); 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 _1690925872693_CreateContacts_1.CreateContacts1690925872693(); 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 contacts tables'); const dbType = queryRunner.connection.driver.options.type; switch (dbType) { case 'postgres': { debug('using postgres migration file'); const mig = new _1690925872592_CreateContacts_1.CreateContacts1690925872592(); 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 _1690925872693_CreateContacts_1.CreateContacts1690925872693(); 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.CreateContacts1690925872318 = CreateContacts1690925872318; //# sourceMappingURL=3-CreateContacts.js.map