Socket
Socket
Sign inDemoInstall

@nextcode/postgres-migrator

Package Overview
Dependencies
1
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.9 to 1.0.10

2

dist/Connector.d.ts

@@ -36,6 +36,6 @@ import { Migration } from './types';

private dropIndex;
private getMigrationVersions;
private insertMigrationVersion;
private deleteMigrationVersion;
private init;
getMigrationVersions(): Promise<string[]>;
tableExists(): Promise<boolean>;

@@ -42,0 +42,0 @@ createDatabase(): Promise<void>;

@@ -59,10 +59,2 @@ "use strict";

}
getMigrationVersions() {
return __awaiter(this, void 0, void 0, function* () {
const result = yield this.sql.unsafe(`
SELECT version FROM "${this.tableName}"
`);
return result.map((row) => row.version);
});
}
insertMigrationVersion(sql, version) {

@@ -105,2 +97,10 @@ return __awaiter(this, void 0, void 0, function* () {

}
getMigrationVersions() {
return __awaiter(this, void 0, void 0, function* () {
const result = yield this.sql.unsafe(`
SELECT version FROM "${this.tableName}"
`);
return result.map((row) => row.version);
});
}
tableExists() {

@@ -107,0 +107,0 @@ return __awaiter(this, void 0, void 0, function* () {

import { ConnectionConfig } from './Connector';
import { Migration } from './types';
import { Dict, Migration } from './types';
export declare class Migrator {

@@ -18,2 +18,6 @@ tableName: string;

down(migration: Migration): Promise<void>;
getStatusOfMigrations(migrations: Migration[]): Promise<Dict<{
name?: string;
isApplied: boolean;
}>>;
static getMigrationFileNamesFromPath(path: string): string[];

@@ -20,0 +24,0 @@ static readMigrationFromPath(path: string, fileName: string): any;

@@ -15,2 +15,3 @@ "use strict";

const fs_1 = require("fs");
const punycode_1 = require("punycode");
class Migrator {

@@ -120,2 +121,23 @@ constructor(config) {

}
getStatusOfMigrations(migrations) {
return __awaiter(this, void 0, void 0, function* () {
const connector = this.connect();
const status = {};
for (const migration of migrations) {
const { name } = migration;
status[punycode_1.version] = { name, isApplied: false };
}
try {
const versions = yield connector.getMigrationVersions();
for (const version of versions) {
status[version] = status[version] || { isApplied: true };
status[version].isApplied = status[version].isApplied || true;
}
}
finally {
yield connector.disconnect();
}
return status;
});
}
static getMigrationFileNamesFromPath(path) {

@@ -122,0 +144,0 @@ const files = fs_1.readdirSync(path);

@@ -5,2 +5,3 @@ export interface Dict<T> {

export interface Migration {
name?: string;
version: string;

@@ -7,0 +8,0 @@ up(sql: any): Promise<any>;

{
"name": "@nextcode/postgres-migrator",
"version": "1.0.9",
"version": "1.0.10",
"description": "Postgres migration package with zero dependencies",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc