🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@contember/schema-migrations

Package Overview
Dependencies
Maintainers
5
Versions
307
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/schema-migrations - npm Package Compare versions

Comparing version

to
0.10.0-alpha.7

7

dist/src/MigrationCreator.d.ts

@@ -12,9 +12,10 @@ import { MigrationFilesManager } from './MigrationFilesManager';

createEmpty(migrationName: string): Promise<string>;
createDiff(newSchema: Schema, migrationName: string): Promise<{
prepareDiff(newSchema: Schema, migrationName: string): Promise<{
migration: Migration;
filename: string;
initialSchema: Schema;
} | null>;
static createContent(modifications: Migration.Modification[]): string;
saveDiff(migration: Migration): Promise<string>;
private createMigration;
static createContent({ modifications, formatVersion }: Migration): string;
}
//# sourceMappingURL=MigrationCreator.d.ts.map

@@ -14,7 +14,7 @@ "use strict";

await this.migrationFilesManager.createDirIfNotExist();
const jsonDiff = MigrationCreator.createContent([]);
const version = MigrationVersionHelper_1.MigrationVersionHelper.createVersion(migrationName);
return await this.migrationFilesManager.createFile(jsonDiff, version, 'json');
const migration = this.createMigration([], migrationName);
const jsonDiff = MigrationCreator.createContent(migration);
return await this.migrationFilesManager.createFile(jsonDiff, migration.version, 'json');
}
async createDiff(newSchema, migrationName) {
async prepareDiff(newSchema, migrationName) {
await this.migrationFilesManager.createDirIfNotExist();

@@ -26,13 +26,19 @@ const initialSchema = await this.schemaVersionBuilder.buildSchema();

}
const jsonDiff = MigrationCreator.createContent(modifications);
const version = MigrationVersionHelper_1.MigrationVersionHelper.createVersion(migrationName);
const migration = { formatVersion: ModificationVersions_1.VERSION_LATEST, modifications, version, name: migrationName };
const filename = await this.migrationFilesManager.createFile(jsonDiff, version, 'json');
return { filename, initialSchema, migration };
const migration = this.createMigration(modifications, migrationName);
return { initialSchema, migration };
}
static createContent(modifications) {
return JSON.stringify({ formatVersion: ModificationVersions_1.VERSION_LATEST, modifications }, undefined, '\t') + '\n';
async saveDiff(migration) {
const jsonDiff = MigrationCreator.createContent(migration);
const filename = await this.migrationFilesManager.createFile(jsonDiff, migration.version, 'json');
return filename;
}
createMigration(modifications, name) {
const version = MigrationVersionHelper_1.MigrationVersionHelper.createVersion(name);
return { formatVersion: ModificationVersions_1.VERSION_LATEST, modifications, version, name };
}
static createContent({ modifications, formatVersion }) {
return JSON.stringify({ formatVersion, modifications }, undefined, '\t') + '\n';
}
}
exports.MigrationCreator = MigrationCreator;
//# sourceMappingURL=MigrationCreator.js.map

@@ -71,3 +71,6 @@ "use strict";

...it,
[this.data.field.columnName]: value,
values: {
...it.values,
[this.data.field.columnName]: value,
},
};

@@ -74,0 +77,0 @@ }

{
"name": "@contember/schema-migrations",
"version": "0.10.0-alpha.6",
"version": "0.10.0-alpha.7",
"license": "Apache-2.0",

@@ -11,6 +11,6 @@ "main": "dist/src/index.js",

"dependencies": {
"@contember/database-migrations": "^0.10.0-alpha.6",
"@contember/engine-common": "^0.10.0-alpha.6",
"@contember/schema": "^0.10.0-alpha.6",
"@contember/schema-utils": "^0.10.0-alpha.6",
"@contember/database-migrations": "^0.10.0-alpha.7",
"@contember/engine-common": "^0.10.0-alpha.7",
"@contember/schema": "^0.10.0-alpha.7",
"@contember/schema-utils": "^0.10.0-alpha.7",
"fast-deep-equal": "^3.1.3",

@@ -20,3 +20,3 @@ "rfc6902": "^4.0.1"

"devDependencies": {
"@contember/schema-definition": "^0.10.0-alpha.6",
"@contember/schema-definition": "^0.10.0-alpha.7",
"uvu": "^0.4.1"

@@ -23,0 +23,0 @@ },

@@ -18,12 +18,12 @@ import { MigrationFilesManager } from './MigrationFilesManager'

await this.migrationFilesManager.createDirIfNotExist()
const jsonDiff = MigrationCreator.createContent([])
const migration = this.createMigration([], migrationName)
const jsonDiff = MigrationCreator.createContent(migration)
const version = MigrationVersionHelper.createVersion(migrationName)
return await this.migrationFilesManager.createFile(jsonDiff, version, 'json')
return await this.migrationFilesManager.createFile(jsonDiff, migration.version, 'json')
}
async createDiff(
async prepareDiff(
newSchema: Schema,
migrationName: string,
): Promise<{ migration: Migration; filename: string; initialSchema: Schema } | null> {
): Promise<{ migration: Migration; initialSchema: Schema } | null> {
await this.migrationFilesManager.createDirIfNotExist()

@@ -38,13 +38,21 @@

const jsonDiff = MigrationCreator.createContent(modifications)
const version = MigrationVersionHelper.createVersion(migrationName)
const migration: Migration = { formatVersion: VERSION_LATEST, modifications, version, name: migrationName }
const migration = this.createMigration(modifications, migrationName)
const filename = await this.migrationFilesManager.createFile(jsonDiff, version, 'json')
return { filename, initialSchema, migration }
return { initialSchema, migration }
}
public static createContent(modifications: Migration.Modification[]): string {
return JSON.stringify({ formatVersion: VERSION_LATEST, modifications }, undefined, '\t') + '\n'
async saveDiff(migration: Migration): Promise<string> {
const jsonDiff = MigrationCreator.createContent(migration)
const filename = await this.migrationFilesManager.createFile(jsonDiff, migration.version, 'json')
return filename
}
private createMigration(modifications: Migration.Modification[], name: string): Migration {
const version = MigrationVersionHelper.createVersion(name)
return { formatVersion: VERSION_LATEST, modifications, version, name }
}
public static createContent({ modifications, formatVersion }: Migration): string {
return JSON.stringify({ formatVersion, modifications }, undefined, '\t') + '\n'
}
}

@@ -71,3 +71,6 @@ import { escapeValue, MigrationBuilder } from '@contember/database-migrations'

...it,
[this.data.field.columnName]: value,
values: {
...it.values,
[this.data.field.columnName]: value,
},
}

@@ -74,0 +77,0 @@ } catch (e) {

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