@contember/schema-migrations
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -16,7 +16,8 @@ "use strict"; | ||
createSql(builder, { databaseMetadata, invalidateDatabaseMetadata }) { | ||
const entity = this.schema.model.entities[this.data.entityName]; | ||
const updatedSchema = this.getSchemaUpdater()({ schema: this.schema }); | ||
const entity = updatedSchema.model.entities[this.data.entityName]; | ||
if (entity.view) { | ||
return; | ||
} | ||
(0, schema_utils_1.acceptRelationTypeVisitor)(this.schema.model, entity, this.data.fieldName, { | ||
(0, schema_utils_1.acceptRelationTypeVisitor)(updatedSchema.model, entity, this.data.fieldName, { | ||
visitManyHasOne: ({ entity, relation, targetEntity }) => { | ||
@@ -23,0 +24,0 @@ (0, helpers_1.addForeignKeyConstraint)({ builder, entity, targetEntity, relation, recreate: true, databaseMetadata, invalidateDatabaseMetadata }); |
@@ -65,4 +65,4 @@ "use strict"; | ||
], | ||
sql: (0, tags_1.SQL) `ALTER TABLE "post_locale" DROP CONSTRAINT "fk_post_locale_post_id_post_id"; ALTER TABLE "post_locale" ADD FOREIGN KEY ("post_id") REFERENCES "post"("id") ON DELETE NO ACTION DEFERRABLE INITIALLY IMMEDIATE;`, | ||
sql: (0, tags_1.SQL) `ALTER TABLE "post_locale" DROP CONSTRAINT "fk_post_locale_post_id_post_id"; ALTER TABLE "post_locale" ADD FOREIGN KEY ("post_id") REFERENCES "post"("id") ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE;`, | ||
}); | ||
//# sourceMappingURL=createRelationInverseSide.test.js.map |
@@ -31,4 +31,4 @@ "use strict"; | ||
sql: (0, tags_1.SQL) `ALTER TABLE "post" DROP CONSTRAINT "fk_post_category_id_category_id"; | ||
ALTER TABLE "post" ADD FOREIGN KEY ("category_id") REFERENCES "category"("id") ON DELETE NO ACTION DEFERRABLE INITIALLY IMMEDIATE;`, | ||
ALTER TABLE "post" ADD FOREIGN KEY ("category_id") REFERENCES "category"("id") ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE;`, | ||
}); | ||
//# sourceMappingURL=updateRelationOnDelete.test.js.map |
{ | ||
"name": "@contember/schema-migrations", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"license": "Apache-2.0", | ||
@@ -15,6 +15,6 @@ "main": "dist/src/index.js", | ||
"dependencies": { | ||
"@contember/database-migrations": "1.3.2", | ||
"@contember/engine-common": "1.3.2", | ||
"@contember/schema": "1.3.2", | ||
"@contember/schema-utils": "1.3.2", | ||
"@contember/database-migrations": "1.3.3", | ||
"@contember/engine-common": "1.3.3", | ||
"@contember/schema": "1.3.3", | ||
"@contember/schema-utils": "1.3.3", | ||
"fast-deep-equal": "^3.1.3", | ||
@@ -24,3 +24,3 @@ "rfc6902": "^5.0.1" | ||
"devDependencies": { | ||
"@contember/schema-definition": "1.3.2" | ||
"@contember/schema-definition": "1.3.3" | ||
}, | ||
@@ -27,0 +27,0 @@ "peerDependencies": { |
@@ -22,7 +22,9 @@ import { MigrationBuilder } from '@contember/database-migrations' | ||
public createSql(builder: MigrationBuilder, { databaseMetadata, invalidateDatabaseMetadata }: ModificationHandlerCreateSqlOptions): void { | ||
const entity = this.schema.model.entities[this.data.entityName] | ||
const updatedSchema = this.getSchemaUpdater()({ schema: this.schema }) | ||
const entity = updatedSchema.model.entities[this.data.entityName] | ||
if (entity.view) { | ||
return | ||
} | ||
acceptRelationTypeVisitor(this.schema.model, entity, this.data.fieldName, { | ||
acceptRelationTypeVisitor(updatedSchema.model, entity, this.data.fieldName, { | ||
visitManyHasOne: ({ entity, relation, targetEntity }) => { | ||
@@ -29,0 +31,0 @@ addForeignKeyConstraint({ builder, entity, targetEntity, relation, recreate: true, databaseMetadata, invalidateDatabaseMetadata }) |
@@ -67,3 +67,3 @@ import { testMigrations } from '../../src/tests' | ||
], | ||
sql: SQL`ALTER TABLE "post_locale" DROP CONSTRAINT "fk_post_locale_post_id_post_id"; ALTER TABLE "post_locale" ADD FOREIGN KEY ("post_id") REFERENCES "post"("id") ON DELETE NO ACTION DEFERRABLE INITIALLY IMMEDIATE;`, | ||
sql: SQL`ALTER TABLE "post_locale" DROP CONSTRAINT "fk_post_locale_post_id_post_id"; ALTER TABLE "post_locale" ADD FOREIGN KEY ("post_id") REFERENCES "post"("id") ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE;`, | ||
}) |
@@ -34,3 +34,3 @@ import { testMigrations } from '../../src/tests' | ||
sql: SQL`ALTER TABLE "post" DROP CONSTRAINT "fk_post_category_id_category_id"; | ||
ALTER TABLE "post" ADD FOREIGN KEY ("category_id") REFERENCES "category"("id") ON DELETE NO ACTION DEFERRABLE INITIALLY IMMEDIATE;`, | ||
ALTER TABLE "post" ADD FOREIGN KEY ("category_id") REFERENCES "category"("id") ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE;`, | ||
}) |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1121923
16642
+ Added@contember/database@1.3.3(transitive)
+ Added@contember/database-migrations@1.3.3(transitive)
+ Added@contember/engine-common@1.3.3(transitive)
+ Added@contember/logger@1.3.3(transitive)
+ Added@contember/queryable@1.3.3(transitive)
+ Added@contember/schema@1.3.3(transitive)
+ Added@contember/schema-utils@1.3.3(transitive)
+ Added@contember/typesafe@1.3.3(transitive)
- Removed@contember/database@1.3.2(transitive)
- Removed@contember/database-migrations@1.3.2(transitive)
- Removed@contember/engine-common@1.3.2(transitive)
- Removed@contember/logger@1.3.2(transitive)
- Removed@contember/queryable@1.3.2(transitive)
- Removed@contember/schema@1.3.2(transitive)
- Removed@contember/schema-utils@1.3.2(transitive)
- Removed@contember/typesafe@1.3.2(transitive)
Updated@contember/schema@1.3.3