@contember/engine-system-api 2.0.0-alpha.10 → 2.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +2 -2
- package/dist/development/index.js +2 -2
- package/dist/development/src/SystemContainer.cjs +4 -3
- package/dist/development/src/SystemContainer.cjs.map +1 -1
- package/dist/development/src/SystemContainer.js +4 -3
- package/dist/development/src/SystemContainer.js.map +1 -1
- package/dist/development/src/migrations/2020-05-06-150000-composed-primary.cjs +1 -2
- package/dist/development/src/migrations/2020-05-06-150000-composed-primary.cjs.map +1 -1
- package/dist/development/src/migrations/2020-05-06-150000-composed-primary.js +1 -2
- package/dist/development/src/migrations/2020-05-06-150000-composed-primary.js.map +1 -1
- package/dist/development/src/migrations/2020-06-01-103000-event-trigger-perf.cjs +1 -2
- package/dist/development/src/migrations/2020-06-01-103000-event-trigger-perf.cjs.map +1 -1
- package/dist/development/src/migrations/2020-06-01-103000-event-trigger-perf.js +1 -2
- package/dist/development/src/migrations/2020-06-01-103000-event-trigger-perf.js.map +1 -1
- package/dist/development/src/migrations/2021-05-07-155800-event-log-rework.cjs +1 -2
- package/dist/development/src/migrations/2021-05-07-155800-event-log-rework.cjs.map +1 -1
- package/dist/development/src/migrations/2021-05-07-155800-event-log-rework.js +1 -2
- package/dist/development/src/migrations/2021-05-07-155800-event-log-rework.js.map +1 -1
- package/dist/development/src/migrations/2021-05-19-1232000-event-log-fix-constraint.cjs +1 -2
- package/dist/development/src/migrations/2021-05-19-1232000-event-log-fix-constraint.cjs.map +1 -1
- package/dist/development/src/migrations/2021-05-19-1232000-event-log-fix-constraint.js +1 -2
- package/dist/development/src/migrations/2021-05-19-1232000-event-log-fix-constraint.js.map +1 -1
- package/dist/development/src/migrations/2022-10-03-110000-table-on-delete.cjs +1 -1
- package/dist/development/src/migrations/2022-10-03-110000-table-on-delete.cjs.map +1 -1
- package/dist/development/src/migrations/2022-10-03-110000-table-on-delete.js +1 -1
- package/dist/development/src/migrations/2022-10-03-110000-table-on-delete.js.map +1 -1
- package/dist/development/src/migrations/2023-09-11-174000-fix-on-delete.cjs +1 -1
- package/dist/development/src/migrations/2023-09-11-174000-fix-on-delete.cjs.map +1 -1
- package/dist/development/src/migrations/2023-09-11-174000-fix-on-delete.js +1 -1
- package/dist/development/src/migrations/2023-09-11-174000-fix-on-delete.js.map +1 -1
- package/dist/development/src/migrations/2023-10-19-173000-fix-unique.cjs +1 -1
- package/dist/development/src/migrations/2023-10-19-173000-fix-unique.cjs.map +1 -1
- package/dist/development/src/migrations/2023-10-19-173000-fix-unique.js +1 -1
- package/dist/development/src/migrations/2023-10-19-173000-fix-unique.js.map +1 -1
- package/dist/development/src/migrations/2024-06-28-153000-schema.cjs +18 -0
- package/dist/development/src/migrations/2024-06-28-153000-schema.cjs.map +1 -0
- package/dist/development/src/migrations/2024-06-28-153000-schema.js +19 -0
- package/dist/development/src/migrations/2024-06-28-153000-schema.js.map +1 -0
- package/dist/development/src/migrations/2024-06-28-153001-schema-init.cjs +12 -0
- package/dist/development/src/migrations/2024-06-28-153001-schema-init.cjs.map +1 -0
- package/dist/development/src/migrations/2024-06-28-153001-schema-init.js +13 -0
- package/dist/development/src/migrations/2024-06-28-153001-schema-init.js.map +1 -0
- package/dist/development/src/migrations/2024-07-29-150000-event-data-index.cjs +11 -0
- package/dist/development/src/migrations/2024-07-29-150000-event-data-index.cjs.map +1 -0
- package/dist/development/src/migrations/2024-07-29-150000-event-data-index.js +12 -0
- package/dist/development/src/migrations/2024-07-29-150000-event-data-index.js.map +1 -0
- package/dist/development/src/migrations/runner.cjs +11 -5
- package/dist/development/src/migrations/runner.cjs.map +1 -1
- package/dist/development/src/migrations/runner.js +11 -5
- package/dist/development/src/migrations/runner.js.map +1 -1
- package/dist/development/src/migrations/snapshot.cjs +17 -1
- package/dist/development/src/migrations/snapshot.cjs.map +1 -1
- package/dist/development/src/migrations/snapshot.js +17 -1
- package/dist/development/src/migrations/snapshot.js.map +1 -1
- package/dist/development/src/model/authorization/AuthorizationActions.cjs +1 -0
- package/dist/development/src/model/authorization/AuthorizationActions.cjs.map +1 -1
- package/dist/development/src/model/authorization/AuthorizationActions.js +1 -0
- package/dist/development/src/model/authorization/AuthorizationActions.js.map +1 -1
- package/dist/development/src/model/authorization/PermissionsFactory.cjs +1 -0
- package/dist/development/src/model/authorization/PermissionsFactory.cjs.map +1 -1
- package/dist/development/src/model/authorization/PermissionsFactory.js +1 -0
- package/dist/development/src/model/authorization/PermissionsFactory.js.map +1 -1
- package/dist/development/src/model/authorization/StagePermissionsFactory.cjs +4 -5
- package/dist/development/src/model/authorization/StagePermissionsFactory.cjs.map +1 -1
- package/dist/development/src/model/authorization/StagePermissionsFactory.js +4 -5
- package/dist/development/src/model/authorization/StagePermissionsFactory.js.map +1 -1
- package/dist/development/src/model/authorization/StageScope.cjs +2 -2
- package/dist/development/src/model/authorization/StageScope.cjs.map +1 -1
- package/dist/development/src/model/authorization/StageScope.js +2 -2
- package/dist/development/src/model/authorization/StageScope.js.map +1 -1
- package/dist/development/src/model/commands/schema/SaveSchemaCommand.cjs +28 -0
- package/dist/development/src/model/commands/schema/SaveSchemaCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/schema/SaveSchemaCommand.js +28 -0
- package/dist/development/src/model/commands/schema/SaveSchemaCommand.js.map +1 -0
- package/dist/development/src/model/migrations/MigrationAlterer.cjs +10 -0
- package/dist/development/src/model/migrations/MigrationAlterer.cjs.map +1 -1
- package/dist/development/src/model/migrations/MigrationAlterer.js +10 -0
- package/dist/development/src/model/migrations/MigrationAlterer.js.map +1 -1
- package/dist/development/src/model/migrations/ProjectMigrator.cjs +29 -10
- package/dist/development/src/model/migrations/ProjectMigrator.cjs.map +1 -1
- package/dist/development/src/model/migrations/ProjectMigrator.js +30 -11
- package/dist/development/src/model/migrations/ProjectMigrator.js.map +1 -1
- package/dist/development/src/model/migrations/SchemaProvider.cjs +58 -0
- package/dist/development/src/model/migrations/SchemaProvider.cjs.map +1 -0
- package/dist/development/src/model/migrations/SchemaProvider.js +58 -0
- package/dist/development/src/model/migrations/SchemaProvider.js.map +1 -0
- package/dist/development/src/model/queries/events/EventsQuery.cjs +10 -14
- package/dist/development/src/model/queries/events/EventsQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/events/EventsQuery.js +10 -14
- package/dist/development/src/model/queries/events/EventsQuery.js.map +1 -1
- package/dist/development/src/model/queries/schema/SchemaQuery.cjs +34 -0
- package/dist/development/src/model/queries/schema/SchemaQuery.cjs.map +1 -0
- package/dist/development/src/model/queries/schema/SchemaQuery.js +34 -0
- package/dist/development/src/model/queries/schema/SchemaQuery.js.map +1 -0
- package/dist/development/src/resolvers/ResolverFactory.cjs +6 -2
- package/dist/development/src/resolvers/ResolverFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/ResolverFactory.js +7 -3
- package/dist/development/src/resolvers/ResolverFactory.js.map +1 -1
- package/dist/development/src/resolvers/SystemResolverContext.cjs +5 -5
- package/dist/development/src/resolvers/SystemResolverContext.cjs.map +1 -1
- package/dist/development/src/resolvers/SystemResolverContext.js +5 -5
- package/dist/development/src/resolvers/SystemResolverContext.js.map +1 -1
- package/dist/development/src/resolvers/mutation/MigrateMutationResolver.cjs +0 -1
- package/dist/development/src/resolvers/mutation/MigrateMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/MigrateMutationResolver.js +0 -1
- package/dist/development/src/resolvers/mutation/MigrateMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/MigrationAlterMutationResolver.cjs +0 -1
- package/dist/development/src/resolvers/mutation/MigrationAlterMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/MigrationAlterMutationResolver.js +0 -1
- package/dist/development/src/resolvers/mutation/MigrationAlterMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/TruncateMutationResolver.cjs +1 -1
- package/dist/development/src/resolvers/mutation/TruncateMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/TruncateMutationResolver.js +1 -1
- package/dist/development/src/resolvers/mutation/TruncateMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/EventsQueryResolver.cjs +0 -1
- package/dist/development/src/resolvers/query/EventsQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/EventsQueryResolver.js +0 -1
- package/dist/development/src/resolvers/query/EventsQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ExecutedMigrationsQueryResolver.cjs +0 -1
- package/dist/development/src/resolvers/query/ExecutedMigrationsQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ExecutedMigrationsQueryResolver.js +0 -1
- package/dist/development/src/resolvers/query/ExecutedMigrationsQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/SchemaQueryResolver.cjs +23 -0
- package/dist/development/src/resolvers/query/SchemaQueryResolver.cjs.map +1 -0
- package/dist/development/src/resolvers/query/SchemaQueryResolver.js +23 -0
- package/dist/development/src/resolvers/query/SchemaQueryResolver.js.map +1 -0
- package/dist/development/src/resolvers/query/StagesQueryResolver.cjs +0 -1
- package/dist/development/src/resolvers/query/StagesQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/StagesQueryResolver.js +0 -1
- package/dist/development/src/resolvers/query/StagesQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/types/OldValuesHelpers.cjs +0 -1
- package/dist/development/src/resolvers/types/OldValuesHelpers.cjs.map +1 -1
- package/dist/development/src/resolvers/types/OldValuesHelpers.js +0 -1
- package/dist/development/src/resolvers/types/OldValuesHelpers.js.map +1 -1
- package/dist/development/src/schema/system.graphql.cjs +3 -1
- package/dist/development/src/schema/system.graphql.cjs.map +1 -1
- package/dist/development/src/schema/system.graphql.js +3 -1
- package/dist/development/src/schema/system.graphql.js.map +1 -1
- package/dist/development/src/schema/types.cjs.map +1 -1
- package/dist/development/src/schema/types.js.map +1 -1
- package/dist/production/index.cjs +2 -2
- package/dist/production/index.js +2 -2
- package/dist/production/src/SystemContainer.cjs +4 -3
- package/dist/production/src/SystemContainer.cjs.map +1 -1
- package/dist/production/src/SystemContainer.js +4 -3
- package/dist/production/src/SystemContainer.js.map +1 -1
- package/dist/production/src/migrations/2020-05-06-150000-composed-primary.cjs +1 -2
- package/dist/production/src/migrations/2020-05-06-150000-composed-primary.cjs.map +1 -1
- package/dist/production/src/migrations/2020-05-06-150000-composed-primary.js +1 -2
- package/dist/production/src/migrations/2020-05-06-150000-composed-primary.js.map +1 -1
- package/dist/production/src/migrations/2020-06-01-103000-event-trigger-perf.cjs +1 -2
- package/dist/production/src/migrations/2020-06-01-103000-event-trigger-perf.cjs.map +1 -1
- package/dist/production/src/migrations/2020-06-01-103000-event-trigger-perf.js +1 -2
- package/dist/production/src/migrations/2020-06-01-103000-event-trigger-perf.js.map +1 -1
- package/dist/production/src/migrations/2021-05-07-155800-event-log-rework.cjs +1 -2
- package/dist/production/src/migrations/2021-05-07-155800-event-log-rework.cjs.map +1 -1
- package/dist/production/src/migrations/2021-05-07-155800-event-log-rework.js +1 -2
- package/dist/production/src/migrations/2021-05-07-155800-event-log-rework.js.map +1 -1
- package/dist/production/src/migrations/2021-05-19-1232000-event-log-fix-constraint.cjs +1 -2
- package/dist/production/src/migrations/2021-05-19-1232000-event-log-fix-constraint.cjs.map +1 -1
- package/dist/production/src/migrations/2021-05-19-1232000-event-log-fix-constraint.js +1 -2
- package/dist/production/src/migrations/2021-05-19-1232000-event-log-fix-constraint.js.map +1 -1
- package/dist/production/src/migrations/2022-10-03-110000-table-on-delete.cjs +1 -1
- package/dist/production/src/migrations/2022-10-03-110000-table-on-delete.cjs.map +1 -1
- package/dist/production/src/migrations/2022-10-03-110000-table-on-delete.js +1 -1
- package/dist/production/src/migrations/2022-10-03-110000-table-on-delete.js.map +1 -1
- package/dist/production/src/migrations/2023-09-11-174000-fix-on-delete.cjs +1 -1
- package/dist/production/src/migrations/2023-09-11-174000-fix-on-delete.cjs.map +1 -1
- package/dist/production/src/migrations/2023-09-11-174000-fix-on-delete.js +1 -1
- package/dist/production/src/migrations/2023-09-11-174000-fix-on-delete.js.map +1 -1
- package/dist/production/src/migrations/2023-10-19-173000-fix-unique.cjs +1 -1
- package/dist/production/src/migrations/2023-10-19-173000-fix-unique.cjs.map +1 -1
- package/dist/production/src/migrations/2023-10-19-173000-fix-unique.js +1 -1
- package/dist/production/src/migrations/2023-10-19-173000-fix-unique.js.map +1 -1
- package/dist/production/src/migrations/2024-06-28-153000-schema.cjs +18 -0
- package/dist/production/src/migrations/2024-06-28-153000-schema.cjs.map +1 -0
- package/dist/production/src/migrations/2024-06-28-153000-schema.js +19 -0
- package/dist/production/src/migrations/2024-06-28-153000-schema.js.map +1 -0
- package/dist/production/src/migrations/2024-06-28-153001-schema-init.cjs +12 -0
- package/dist/production/src/migrations/2024-06-28-153001-schema-init.cjs.map +1 -0
- package/dist/production/src/migrations/2024-06-28-153001-schema-init.js +13 -0
- package/dist/production/src/migrations/2024-06-28-153001-schema-init.js.map +1 -0
- package/dist/production/src/migrations/2024-07-29-150000-event-data-index.cjs +11 -0
- package/dist/production/src/migrations/2024-07-29-150000-event-data-index.cjs.map +1 -0
- package/dist/production/src/migrations/2024-07-29-150000-event-data-index.js +12 -0
- package/dist/production/src/migrations/2024-07-29-150000-event-data-index.js.map +1 -0
- package/dist/production/src/migrations/runner.cjs +11 -5
- package/dist/production/src/migrations/runner.cjs.map +1 -1
- package/dist/production/src/migrations/runner.js +11 -5
- package/dist/production/src/migrations/runner.js.map +1 -1
- package/dist/production/src/migrations/snapshot.cjs +17 -1
- package/dist/production/src/migrations/snapshot.cjs.map +1 -1
- package/dist/production/src/migrations/snapshot.js +17 -1
- package/dist/production/src/migrations/snapshot.js.map +1 -1
- package/dist/production/src/model/authorization/AuthorizationActions.cjs +1 -0
- package/dist/production/src/model/authorization/AuthorizationActions.cjs.map +1 -1
- package/dist/production/src/model/authorization/AuthorizationActions.js +1 -0
- package/dist/production/src/model/authorization/AuthorizationActions.js.map +1 -1
- package/dist/production/src/model/authorization/PermissionsFactory.cjs +1 -0
- package/dist/production/src/model/authorization/PermissionsFactory.cjs.map +1 -1
- package/dist/production/src/model/authorization/PermissionsFactory.js +1 -0
- package/dist/production/src/model/authorization/PermissionsFactory.js.map +1 -1
- package/dist/production/src/model/authorization/StagePermissionsFactory.cjs +4 -5
- package/dist/production/src/model/authorization/StagePermissionsFactory.cjs.map +1 -1
- package/dist/production/src/model/authorization/StagePermissionsFactory.js +4 -5
- package/dist/production/src/model/authorization/StagePermissionsFactory.js.map +1 -1
- package/dist/production/src/model/authorization/StageScope.cjs +2 -2
- package/dist/production/src/model/authorization/StageScope.cjs.map +1 -1
- package/dist/production/src/model/authorization/StageScope.js +2 -2
- package/dist/production/src/model/authorization/StageScope.js.map +1 -1
- package/dist/production/src/model/commands/schema/SaveSchemaCommand.cjs +28 -0
- package/dist/production/src/model/commands/schema/SaveSchemaCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/schema/SaveSchemaCommand.js +28 -0
- package/dist/production/src/model/commands/schema/SaveSchemaCommand.js.map +1 -0
- package/dist/production/src/model/migrations/MigrationAlterer.cjs +10 -0
- package/dist/production/src/model/migrations/MigrationAlterer.cjs.map +1 -1
- package/dist/production/src/model/migrations/MigrationAlterer.js +10 -0
- package/dist/production/src/model/migrations/MigrationAlterer.js.map +1 -1
- package/dist/production/src/model/migrations/ProjectMigrator.cjs +29 -10
- package/dist/production/src/model/migrations/ProjectMigrator.cjs.map +1 -1
- package/dist/production/src/model/migrations/ProjectMigrator.js +30 -11
- package/dist/production/src/model/migrations/ProjectMigrator.js.map +1 -1
- package/dist/production/src/model/migrations/SchemaProvider.cjs +58 -0
- package/dist/production/src/model/migrations/SchemaProvider.cjs.map +1 -0
- package/dist/production/src/model/migrations/SchemaProvider.js +58 -0
- package/dist/production/src/model/migrations/SchemaProvider.js.map +1 -0
- package/dist/production/src/model/queries/events/EventsQuery.cjs +10 -14
- package/dist/production/src/model/queries/events/EventsQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/events/EventsQuery.js +10 -14
- package/dist/production/src/model/queries/events/EventsQuery.js.map +1 -1
- package/dist/production/src/model/queries/schema/SchemaQuery.cjs +34 -0
- package/dist/production/src/model/queries/schema/SchemaQuery.cjs.map +1 -0
- package/dist/production/src/model/queries/schema/SchemaQuery.js +34 -0
- package/dist/production/src/model/queries/schema/SchemaQuery.js.map +1 -0
- package/dist/production/src/resolvers/ResolverFactory.cjs +6 -2
- package/dist/production/src/resolvers/ResolverFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/ResolverFactory.js +7 -3
- package/dist/production/src/resolvers/ResolverFactory.js.map +1 -1
- package/dist/production/src/resolvers/SystemResolverContext.cjs +5 -5
- package/dist/production/src/resolvers/SystemResolverContext.cjs.map +1 -1
- package/dist/production/src/resolvers/SystemResolverContext.js +5 -5
- package/dist/production/src/resolvers/SystemResolverContext.js.map +1 -1
- package/dist/production/src/resolvers/mutation/MigrateMutationResolver.cjs +0 -1
- package/dist/production/src/resolvers/mutation/MigrateMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/MigrateMutationResolver.js +0 -1
- package/dist/production/src/resolvers/mutation/MigrateMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/MigrationAlterMutationResolver.cjs +0 -1
- package/dist/production/src/resolvers/mutation/MigrationAlterMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/MigrationAlterMutationResolver.js +0 -1
- package/dist/production/src/resolvers/mutation/MigrationAlterMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/TruncateMutationResolver.cjs +1 -1
- package/dist/production/src/resolvers/mutation/TruncateMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/TruncateMutationResolver.js +1 -1
- package/dist/production/src/resolvers/mutation/TruncateMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/EventsQueryResolver.cjs +0 -1
- package/dist/production/src/resolvers/query/EventsQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/EventsQueryResolver.js +0 -1
- package/dist/production/src/resolvers/query/EventsQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ExecutedMigrationsQueryResolver.cjs +0 -1
- package/dist/production/src/resolvers/query/ExecutedMigrationsQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ExecutedMigrationsQueryResolver.js +0 -1
- package/dist/production/src/resolvers/query/ExecutedMigrationsQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/SchemaQueryResolver.cjs +23 -0
- package/dist/production/src/resolvers/query/SchemaQueryResolver.cjs.map +1 -0
- package/dist/production/src/resolvers/query/SchemaQueryResolver.js +23 -0
- package/dist/production/src/resolvers/query/SchemaQueryResolver.js.map +1 -0
- package/dist/production/src/resolvers/query/StagesQueryResolver.cjs +0 -1
- package/dist/production/src/resolvers/query/StagesQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/StagesQueryResolver.js +0 -1
- package/dist/production/src/resolvers/query/StagesQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/types/OldValuesHelpers.cjs +0 -1
- package/dist/production/src/resolvers/types/OldValuesHelpers.cjs.map +1 -1
- package/dist/production/src/resolvers/types/OldValuesHelpers.js +0 -1
- package/dist/production/src/resolvers/types/OldValuesHelpers.js.map +1 -1
- package/dist/production/src/schema/system.graphql.cjs +3 -1
- package/dist/production/src/schema/system.graphql.cjs.map +1 -1
- package/dist/production/src/schema/system.graphql.js +3 -1
- package/dist/production/src/schema/system.graphql.js.map +1 -1
- package/dist/production/src/schema/types.cjs.map +1 -1
- package/dist/production/src/schema/types.js.map +1 -1
- package/dist/tests/cases/unit/eventsQuery.test.d.ts +2 -0
- package/dist/tests/cases/unit/eventsQuery.test.d.ts.map +1 -0
- package/dist/tests/src/uuid.d.ts +3 -0
- package/dist/tests/src/uuid.d.ts.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/SystemContainer.d.ts +7 -3
- package/dist/types/SystemContainer.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/migrations/2024-06-28-153000-schema.d.ts +3 -0
- package/dist/types/migrations/2024-06-28-153000-schema.d.ts.map +1 -0
- package/dist/types/migrations/2024-06-28-153001-schema-init.d.ts +4 -0
- package/dist/types/migrations/2024-06-28-153001-schema-init.d.ts.map +1 -0
- package/dist/types/migrations/2024-07-29-150000-event-data-index.d.ts +3 -0
- package/dist/types/migrations/2024-07-29-150000-event-data-index.d.ts.map +1 -0
- package/dist/types/migrations/runner.d.ts +3 -3
- package/dist/types/migrations/runner.d.ts.map +1 -1
- package/dist/types/migrations/snapshot.d.ts.map +1 -1
- package/dist/types/migrations/types.d.ts +2 -2
- package/dist/types/migrations/types.d.ts.map +1 -1
- package/dist/types/model/SchemaGetter.d.ts +6 -0
- package/dist/types/model/SchemaGetter.d.ts.map +1 -0
- package/dist/types/model/authorization/AuthorizationActions.d.ts +5 -0
- package/dist/types/model/authorization/AuthorizationActions.d.ts.map +1 -1
- package/dist/types/model/authorization/PermissionsFactory.d.ts.map +1 -1
- package/dist/types/model/authorization/StagePermissionsFactory.d.ts +4 -4
- package/dist/types/model/authorization/StagePermissionsFactory.d.ts.map +1 -1
- package/dist/types/model/authorization/StageScope.d.ts.map +1 -1
- package/dist/types/model/commands/schema/SaveSchemaCommand.d.ts +8 -0
- package/dist/types/model/commands/schema/SaveSchemaCommand.d.ts.map +1 -0
- package/dist/types/model/dependencies/content/ContentQueryExecutor.d.ts +3 -2
- package/dist/types/model/dependencies/content/ContentQueryExecutor.d.ts.map +1 -1
- package/dist/types/model/migrations/MigrationAlterer.d.ts +4 -0
- package/dist/types/model/migrations/MigrationAlterer.d.ts.map +1 -1
- package/dist/types/model/migrations/ProjectMigrator.d.ts +3 -3
- package/dist/types/model/migrations/ProjectMigrator.d.ts.map +1 -1
- package/dist/types/model/migrations/SchemaProvider.d.ts +28 -0
- package/dist/types/model/migrations/SchemaProvider.d.ts.map +1 -0
- package/dist/types/model/migrations/index.d.ts +1 -1
- package/dist/types/model/migrations/index.d.ts.map +1 -1
- package/dist/types/model/queries/events/EventsQuery.d.ts.map +1 -1
- package/dist/types/model/queries/index.d.ts +1 -0
- package/dist/types/model/queries/index.d.ts.map +1 -1
- package/dist/types/model/queries/schema/SchemaQuery.d.ts +8 -0
- package/dist/types/model/queries/schema/SchemaQuery.d.ts.map +1 -0
- package/dist/types/model/queries/schema/index.d.ts +2 -0
- package/dist/types/model/queries/schema/index.d.ts.map +1 -0
- package/dist/types/resolvers/ResolverFactory.d.ts +3 -1
- package/dist/types/resolvers/ResolverFactory.d.ts.map +1 -1
- package/dist/types/resolvers/SystemResolverContext.d.ts +4 -4
- package/dist/types/resolvers/SystemResolverContext.d.ts.map +1 -1
- package/dist/types/resolvers/query/SchemaQueryResolver.d.ts +7 -0
- package/dist/types/resolvers/query/SchemaQueryResolver.d.ts.map +1 -0
- package/dist/types/schema/system.graphql.d.ts.map +1 -1
- package/dist/types/schema/types.d.ts +15 -3
- package/dist/types/schema/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/graphql.codegen.yml +2 -0
- package/package.json +12 -12
- package/src/SystemContainer.ts +14 -11
- package/src/bin/runMigrations.ts +4 -4
- package/src/index.ts +3 -2
- package/src/migrations/2020-05-06-150000-composed-primary.ts +1 -1
- package/src/migrations/2020-06-01-103000-event-trigger-perf.ts +1 -1
- package/src/migrations/2021-05-07-155800-event-log-rework.ts +1 -1
- package/src/migrations/2021-05-19-1232000-event-log-fix-constraint.ts +1 -1
- package/src/migrations/2022-10-03-110000-table-on-delete.ts +1 -1
- package/src/migrations/2023-09-11-174000-fix-on-delete.ts +1 -1
- package/src/migrations/2023-10-19-173000-fix-unique.ts +1 -1
- package/src/migrations/2024-06-28-153000-schema.ts +20 -0
- package/src/migrations/2024-06-28-153001-schema-init.ts +12 -0
- package/src/migrations/2024-07-29-150000-event-data-index.ts +11 -0
- package/src/migrations/runner.ts +10 -4
- package/src/migrations/snapshot.ts +17 -1
- package/src/migrations/types.ts +2 -2
- package/src/model/SchemaGetter.ts +3 -0
- package/src/model/authorization/AuthorizationActions.ts +1 -0
- package/src/model/authorization/PermissionsFactory.ts +1 -0
- package/src/model/authorization/StagePermissionsFactory.ts +5 -5
- package/src/model/authorization/StageScope.ts +2 -2
- package/src/model/commands/schema/SaveSchemaCommand.ts +31 -0
- package/src/model/dependencies/content/ContentQueryExecutor.ts +3 -2
- package/src/model/migrations/MigrationAlterer.ts +14 -0
- package/src/model/migrations/ProjectMigrator.ts +34 -12
- package/src/model/migrations/SchemaProvider.ts +77 -0
- package/src/model/migrations/index.ts +1 -1
- package/src/model/queries/events/EventsQuery.ts +15 -17
- package/src/model/queries/index.ts +1 -0
- package/src/model/queries/schema/SchemaQuery.ts +48 -0
- package/src/model/queries/schema/index.ts +1 -0
- package/src/resolvers/ResolverFactory.ts +9 -1
- package/src/resolvers/SystemResolverContext.ts +8 -13
- package/src/resolvers/mutation/TruncateMutationResolver.ts +1 -1
- package/src/resolvers/query/SchemaQueryResolver.ts +19 -0
- package/src/schema/system.graphql.ts +3 -1
- package/src/schema/types.ts +12 -2
- package/tests/cases/migrations/2020-05-06-150000-composed-primary.test.ts +9 -1
- package/tests/cases/migrations/2020-06-01-103000-event-trigger-perf.test.ts +9 -1
- package/tests/cases/migrations/2022-10-03-110000-table-on-delete.test.ts +17 -6
- package/tests/cases/migrations/2023-09-11-174000-fix-on-delete.test.ts +32 -12
- package/tests/cases/migrations/2023-10-19-173000-fix-unique.test.ts +9 -1
- package/tests/cases/unit/eventsQuery.test.ts +39 -0
- package/tests/src/uuid.ts +4 -0
- package/dist/development/src/model/migrations/SchemaVersionBuilder.cjs +0 -37
- package/dist/development/src/model/migrations/SchemaVersionBuilder.cjs.map +0 -1
- package/dist/development/src/model/migrations/SchemaVersionBuilder.js +0 -37
- package/dist/development/src/model/migrations/SchemaVersionBuilder.js.map +0 -1
- package/dist/production/src/model/migrations/SchemaVersionBuilder.cjs +0 -37
- package/dist/production/src/model/migrations/SchemaVersionBuilder.cjs.map +0 -1
- package/dist/production/src/model/migrations/SchemaVersionBuilder.js +0 -37
- package/dist/production/src/model/migrations/SchemaVersionBuilder.js.map +0 -1
- package/dist/types/model/migrations/SchemaVersionBuilder.d.ts +0 -37
- package/dist/types/model/migrations/SchemaVersionBuilder.d.ts.map +0 -1
- package/src/model/migrations/SchemaVersionBuilder.ts +0 -43
package/graphql.codegen.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/engine-system-api",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/production/index.js",
|
|
6
6
|
"typings": "./dist/types/index.d.ts",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"generate": "gql-gen --config graphql.codegen.yml"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@contember/authorization": "2.0.0-alpha.
|
|
30
|
-
"@contember/database": "2.0.0-alpha.
|
|
31
|
-
"@contember/database-migrations": "2.0.0-alpha.
|
|
32
|
-
"@contember/dic": "2.0.0-alpha.
|
|
33
|
-
"@contember/graphql-utils": "2.0.0-alpha.
|
|
34
|
-
"@contember/logger": "2.0.0-alpha.
|
|
35
|
-
"@contember/queryable": "2.0.0-alpha.
|
|
36
|
-
"@contember/schema": "2.0.0-alpha.
|
|
37
|
-
"@contember/schema-migrations": "2.0.0-alpha.
|
|
38
|
-
"@contember/schema-utils": "2.0.0-alpha.
|
|
29
|
+
"@contember/authorization": "2.0.0-alpha.13",
|
|
30
|
+
"@contember/database": "2.0.0-alpha.13",
|
|
31
|
+
"@contember/database-migrations": "2.0.0-alpha.13",
|
|
32
|
+
"@contember/dic": "2.0.0-alpha.13",
|
|
33
|
+
"@contember/graphql-utils": "2.0.0-alpha.13",
|
|
34
|
+
"@contember/logger": "2.0.0-alpha.13",
|
|
35
|
+
"@contember/queryable": "2.0.0-alpha.13",
|
|
36
|
+
"@contember/schema": "2.0.0-alpha.13",
|
|
37
|
+
"@contember/schema-migrations": "2.0.0-alpha.13",
|
|
38
|
+
"@contember/schema-utils": "2.0.0-alpha.13",
|
|
39
39
|
"@graphql-tools/utils": "^10.0.8",
|
|
40
40
|
"graphql-tag": "^2.12.6"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@contember/schema-definition": "2.0.0-alpha.
|
|
43
|
+
"@contember/schema-definition": "2.0.0-alpha.13",
|
|
44
44
|
"@graphql-codegen/cli": "^5.0.0",
|
|
45
45
|
"@graphql-codegen/typescript": "^4.0.1",
|
|
46
46
|
"@graphql-codegen/typescript-operations": "^4.0.1",
|
package/src/SystemContainer.ts
CHANGED
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
PermissionsFactory,
|
|
17
17
|
ProjectMigrator,
|
|
18
18
|
ProjectTruncateExecutor,
|
|
19
|
-
SchemaVersionBuilder,
|
|
20
19
|
} from './model'
|
|
21
20
|
import { UuidProvider } from './utils'
|
|
22
21
|
import {
|
|
@@ -31,12 +30,14 @@ import {
|
|
|
31
30
|
} from './resolvers'
|
|
32
31
|
import { EventOldValuesResolver } from './resolvers/types'
|
|
33
32
|
import { DatabaseMetadataResolver } from '@contember/database'
|
|
33
|
+
import { SchemaProvider } from './model'
|
|
34
|
+
import { SchemaQueryResolver } from './resolvers/query/SchemaQueryResolver'
|
|
34
35
|
|
|
35
36
|
export interface SystemContainer {
|
|
36
37
|
systemResolversFactory: ResolverFactory
|
|
37
38
|
authorizator: Authorizator
|
|
38
39
|
resolverContextFactory: SystemResolverContextFactory
|
|
39
|
-
|
|
40
|
+
schemaProvider: SchemaProvider
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
type Args = {
|
|
@@ -58,7 +59,7 @@ export class SystemContainerFactory {
|
|
|
58
59
|
'systemResolversFactory',
|
|
59
60
|
'authorizator',
|
|
60
61
|
'resolverContextFactory',
|
|
61
|
-
'
|
|
62
|
+
'schemaProvider',
|
|
62
63
|
)
|
|
63
64
|
}
|
|
64
65
|
public createBuilder({ identityFetcher }: Args) {
|
|
@@ -73,8 +74,8 @@ export class SystemContainerFactory {
|
|
|
73
74
|
new SchemaMigrator(modificationHandlerFactory))
|
|
74
75
|
.addService('executedMigrationsResolver', ({}) =>
|
|
75
76
|
new ExecutedMigrationsResolver())
|
|
76
|
-
.addService('
|
|
77
|
-
new
|
|
77
|
+
.addService('schemaProvider', ({ executedMigrationsResolver, schemaMigrator }) =>
|
|
78
|
+
new SchemaProvider(executedMigrationsResolver, schemaMigrator))
|
|
78
79
|
.addService('accessEvaluator', ({}) =>
|
|
79
80
|
new AccessEvaluator.PermissionEvaluator(new PermissionsFactory().create()))
|
|
80
81
|
.addService('authorizator', ({ accessEvaluator }): Authorizator =>
|
|
@@ -87,12 +88,12 @@ export class SystemContainerFactory {
|
|
|
87
88
|
new DatabaseMetadataResolver())
|
|
88
89
|
.addService('migrationsDatabaseMetadataResolverStoreFactory', ({ databaseMetadataResolver }) =>
|
|
89
90
|
new MigrationsDatabaseMetadataResolverStoreFactory(databaseMetadataResolver))
|
|
90
|
-
.addService('projectMigrator', ({ migrationDescriber,
|
|
91
|
-
new ProjectMigrator(migrationDescriber,
|
|
91
|
+
.addService('projectMigrator', ({ migrationDescriber, schemaProvider, executedMigrationsResolver, migrationsDatabaseMetadataResolverStoreFactory }) =>
|
|
92
|
+
new ProjectMigrator(migrationDescriber, schemaProvider, executedMigrationsResolver, migrationsDatabaseMetadataResolverStoreFactory, this.contentQueryExecutor))
|
|
92
93
|
.addService('projectTruncateExecutor', () =>
|
|
93
94
|
new ProjectTruncateExecutor())
|
|
94
|
-
.addService('migrationAlterer', () =>
|
|
95
|
-
new MigrationAlterer())
|
|
95
|
+
.addService('migrationAlterer', ({ schemaProvider }) =>
|
|
96
|
+
new MigrationAlterer(schemaProvider))
|
|
96
97
|
.addService('eventResponseBuilder', ({ identityFetcher }) =>
|
|
97
98
|
new EventResponseBuilder(identityFetcher))
|
|
98
99
|
.addService('stagesQueryResolver', () =>
|
|
@@ -109,8 +110,10 @@ export class SystemContainerFactory {
|
|
|
109
110
|
new EventsQueryResolver(eventResponseBuilder))
|
|
110
111
|
.addService('eventOldValuesResolver', () =>
|
|
111
112
|
new EventOldValuesResolver())
|
|
112
|
-
.addService('
|
|
113
|
-
new
|
|
113
|
+
.addService('schemaQueryResolver', () =>
|
|
114
|
+
new SchemaQueryResolver())
|
|
115
|
+
.addService('systemResolversFactory', ({ stagesQueryResolver, executedMigrationsQueryResolver, migrateMutationResolver, truncateMutationResolver, migrationAlterMutationResolver, eventsQueryResolver, eventOldValuesResolver, schemaQueryResolver }) =>
|
|
116
|
+
new ResolverFactory(stagesQueryResolver, executedMigrationsQueryResolver, migrateMutationResolver, truncateMutationResolver, migrationAlterMutationResolver, eventsQueryResolver, eventOldValuesResolver, schemaQueryResolver))
|
|
114
117
|
.addService('resolverContextFactory', ({ authorizator }) =>
|
|
115
118
|
new SystemResolverContextFactory(authorizator))
|
|
116
119
|
}
|
package/src/bin/runMigrations.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SystemMigrationsRunner } from '../migrations'
|
|
2
|
-
import { DatabaseContextFactory, emptyVersionedSchema,
|
|
3
|
-
import {
|
|
2
|
+
import { DatabaseContextFactory, emptyVersionedSchema, SchemaProvider } from '../model'
|
|
3
|
+
import { DatabaseMetadataResolver, emptyDatabaseMetadata } from '@contember/database'
|
|
4
4
|
import { createLogger, PrettyPrintLoggerHandler } from '@contember/logger'
|
|
5
5
|
|
|
6
6
|
|
|
@@ -20,8 +20,8 @@ import { createLogger, PrettyPrintLoggerHandler } from '@contember/logger'
|
|
|
20
20
|
}),
|
|
21
21
|
{ db: dbConfig, slug: 'test', stages: [], systemSchema: 'system' },
|
|
22
22
|
{
|
|
23
|
-
|
|
24
|
-
} as unknown as
|
|
23
|
+
buildSchemaFromMigrations: () => Promise.resolve(emptyVersionedSchema),
|
|
24
|
+
} as unknown as SchemaProvider,
|
|
25
25
|
{},
|
|
26
26
|
{
|
|
27
27
|
resolveMetadata: () => Promise.resolve(emptyDatabaseMetadata),
|
package/src/index.ts
CHANGED
|
@@ -16,12 +16,13 @@ export {
|
|
|
16
16
|
LatestTransactionIdByStageQuery,
|
|
17
17
|
ProjectInitializer,
|
|
18
18
|
ProjectMigrator,
|
|
19
|
-
SchemaVersionBuilder,
|
|
20
19
|
type Stage,
|
|
21
20
|
StageBySlugQuery,
|
|
22
21
|
StageCreator,
|
|
23
22
|
StagesQuery,
|
|
24
|
-
|
|
23
|
+
SchemaProvider,
|
|
24
|
+
type SchemaMeta,
|
|
25
|
+
type SchemaWithMeta,
|
|
25
26
|
} from './model'
|
|
26
27
|
export * from './SystemContainer'
|
|
27
28
|
export * from './resolvers'
|
|
@@ -58,7 +58,7 @@ const migrateEvents = (builder: MigrationBuilder, tableName: string, primaryKeys
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export default async function (builder: MigrationBuilder, args: MigrationArgs<SystemMigrationArgs>) {
|
|
61
|
-
const schema = await args.schemaResolver(args.connection)
|
|
61
|
+
const schema = (await args.schemaResolver(args.connection)).schema
|
|
62
62
|
const tablesToMigrate = getJunctionTables(schema.model)
|
|
63
63
|
const schemas = args.project.stages.map(it => `stage_${it.slug}`)
|
|
64
64
|
for (const table of tablesToMigrate) {
|
|
@@ -16,7 +16,7 @@ const createEventStatementTrigger = (builder: MigrationBuilder, tableName: Name)
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export default async function (builder: MigrationBuilder, args: MigrationArgs<SystemMigrationArgs>) {
|
|
19
|
-
const schema = await args.schemaResolver(args.connection)
|
|
19
|
+
const schema = (await args.schemaResolver(args.connection)).schema
|
|
20
20
|
const junctionTables = getJunctionTables(schema.model)
|
|
21
21
|
const schemas = args.project.stages.map(it => `stage_${it.slug}`)
|
|
22
22
|
builder.sql(`CREATE OR REPLACE FUNCTION "trigger_event"() RETURNS TRIGGER AS $$
|
|
@@ -18,7 +18,7 @@ const createTrxEvent = (builder: MigrationBuilder, tableName: Name) => {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export default async function (builder: MigrationBuilder, args: MigrationArgs<SystemMigrationArgs>) {
|
|
21
|
-
const schema = await args.schemaResolver(args.connection)
|
|
21
|
+
const schema = (await args.schemaResolver(args.connection)).schema
|
|
22
22
|
const junctionTables = getJunctionTables(schema.model)
|
|
23
23
|
const schemas = args.project.stages.map(it => `stage_${it.slug}`)
|
|
24
24
|
builder.sql(`LOCK TABLE event`)
|
|
@@ -21,7 +21,7 @@ const recreateTrigger = (builder: MigrationBuilder, tableName: Name) => {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export default async function (builder: MigrationBuilder, args: MigrationArgs<SystemMigrationArgs>) {
|
|
24
|
-
const schema = await args.schemaResolver(args.connection)
|
|
24
|
+
const schema = (await args.schemaResolver(args.connection)).schema
|
|
25
25
|
const junctionTables = getJunctionTables(schema.model)
|
|
26
26
|
const schemas = args.project.stages.map(it => `stage_${it.slug}`)
|
|
27
27
|
|
|
@@ -5,7 +5,7 @@ import { acceptFieldVisitor } from '@contember/schema-utils'
|
|
|
5
5
|
import { Model } from '@contember/schema'
|
|
6
6
|
|
|
7
7
|
export default async function (builder: MigrationBuilder, args: MigrationArgs<SystemMigrationArgs>) {
|
|
8
|
-
const schema = await args.schemaResolver(args.connection)
|
|
8
|
+
const schema = (await args.schemaResolver(args.connection)).schema
|
|
9
9
|
const stages = (await args.connection.query<{schema: string}>('SELECT schema FROM stage')).rows
|
|
10
10
|
const metadataByStage: Record<string, DatabaseMetadata> = {}
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ import { acceptFieldVisitor } from '@contember/schema-utils'
|
|
|
5
5
|
import { Model } from '@contember/schema'
|
|
6
6
|
|
|
7
7
|
export default async function (builder: MigrationBuilder, args: MigrationArgs<SystemMigrationArgs>) {
|
|
8
|
-
const schema = await args.schemaResolver(args.connection)
|
|
8
|
+
const schema = (await args.schemaResolver(args.connection)).schema
|
|
9
9
|
const stages = (await args.connection.query<{schema: string}>('SELECT schema FROM stage')).rows
|
|
10
10
|
const metadataByStage: Record<string, DatabaseMetadata> = {}
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@ import { SystemMigrationArgs } from './types'
|
|
|
4
4
|
import { getUniqueConstraintColumns } from '@contember/schema-migrations'
|
|
5
5
|
|
|
6
6
|
export default async function (builder: MigrationBuilder, args: MigrationArgs<SystemMigrationArgs>) {
|
|
7
|
-
const schema = await args.schemaResolver(args.connection)
|
|
7
|
+
const schema = (await args.schemaResolver(args.connection)).schema
|
|
8
8
|
const stages = (await args.connection.query<{schema: string}>('SELECT schema FROM stage')).rows
|
|
9
9
|
const metadataByStage: Record<string, DatabaseMetadata> = {}
|
|
10
10
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MigrationBuilder } from '@contember/database-migrations'
|
|
2
|
+
|
|
3
|
+
// deliberately using "JSON" instead of "JSONB" to preserve the order of keys
|
|
4
|
+
|
|
5
|
+
const sql = `
|
|
6
|
+
CREATE TYPE SCHEMA_SINGLE AS ENUM ('single');
|
|
7
|
+
CREATE TABLE "schema"
|
|
8
|
+
(
|
|
9
|
+
id SCHEMA_SINGLE NOT NULL PRIMARY KEY DEFAULT 'single',
|
|
10
|
+
schema JSON NOT NULL,
|
|
11
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
12
|
+
checksum CHAR(32) NOT NULL,
|
|
13
|
+
version VARCHAR(20) NOT NULL,
|
|
14
|
+
migration_id INT NOT NULL REFERENCES schema_migration(id) DEFERRABLE INITIALLY DEFERRED
|
|
15
|
+
);
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
export default async function (builder: MigrationBuilder) {
|
|
19
|
+
builder.sql(sql)
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { escapeValue, MigrationArgs, MigrationBuilder } from '@contember/database-migrations'
|
|
2
|
+
import { SystemMigrationArgs } from './types'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default async function (builder: MigrationBuilder, args: MigrationArgs<SystemMigrationArgs>) {
|
|
6
|
+
const schema = await args.schemaResolver(args.connection)
|
|
7
|
+
if (!schema.meta.id) {
|
|
8
|
+
return
|
|
9
|
+
}
|
|
10
|
+
builder.sql(`INSERT INTO schema(schema, checksum, version, migration_id)
|
|
11
|
+
VALUES(${escapeValue(JSON.stringify(schema))}, ${escapeValue(schema.meta.checksum)}, ${escapeValue(schema.meta.version)}, ${schema.meta.id})`)
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MigrationBuilder } from '@contember/database-migrations'
|
|
2
|
+
|
|
3
|
+
const sql = `
|
|
4
|
+
CREATE INDEX IF NOT EXISTS system_event_data_row_id_0 ON event_data USING btree ((row_ids -> 0));
|
|
5
|
+
CREATE INDEX IF NOT EXISTS system_event_data_row_id_1 ON event_data USING btree ((row_ids -> 1));
|
|
6
|
+
DROP INDEX IF EXISTS system_event_row_id;
|
|
7
|
+
`
|
|
8
|
+
|
|
9
|
+
export default async function (builder: MigrationBuilder) {
|
|
10
|
+
builder.sql(sql)
|
|
11
|
+
}
|
package/src/migrations/runner.ts
CHANGED
|
@@ -26,10 +26,13 @@ import _20230911174000fixondelete from './2023-09-11-174000-fix-on-delete'
|
|
|
26
26
|
import _20231019173000fixunique from './2023-10-19-173000-fix-unique'
|
|
27
27
|
import _20231024140000schemanullablechecksum from './2023-10-24-140000-schema-nullable-checksum'
|
|
28
28
|
import _20240628150000migrationsdropsequence from './2024-06-28-150000-migrations-drop-sequence'
|
|
29
|
+
import _20240628153000schema from './2024-06-28-153000-schema'
|
|
30
|
+
import _20240628153001schemainit from './2024-06-28-153001-schema-init'
|
|
31
|
+
import _20240729150000eventdataindex from './2024-07-29-150000-event-data-index'
|
|
29
32
|
import snapshot from './snapshot'
|
|
30
33
|
|
|
31
34
|
import { Connection, createDatabaseIfNotExists, DatabaseConfig, DatabaseMetadataResolver } from '@contember/database'
|
|
32
|
-
import { DatabaseContextFactory,
|
|
35
|
+
import { DatabaseContextFactory, SchemaProvider } from '../model'
|
|
33
36
|
import { ProjectConfig } from '../types'
|
|
34
37
|
import { Logger } from '@contember/logger'
|
|
35
38
|
|
|
@@ -56,6 +59,9 @@ const migrations = {
|
|
|
56
59
|
'2023-10-19-173000-fix-unique': _20231019173000fixunique,
|
|
57
60
|
'2023-10-24-140000-schema-nullable-checksum': _20231024140000schemanullablechecksum,
|
|
58
61
|
'2024-06-28-150000-migrations-drop-sequence': _20240628150000migrationsdropsequence,
|
|
62
|
+
'2024-06-28-153000-schema': _20240628153000schema,
|
|
63
|
+
'2024-06-28-153001-schema-init': _20240628153001schemainit,
|
|
64
|
+
'2024-07-29-150000-event-data-index': _20240729150000eventdataindex,
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
|
|
@@ -63,7 +69,7 @@ export class SystemMigrationsRunner {
|
|
|
63
69
|
constructor(
|
|
64
70
|
private readonly databaseContextFactory: DatabaseContextFactory,
|
|
65
71
|
private readonly project: ProjectConfig & { db: DatabaseConfig },
|
|
66
|
-
private readonly
|
|
72
|
+
private readonly schemaProvider: SchemaProvider,
|
|
67
73
|
private readonly migrationGroups: Record<string, MigrationGroup<unknown>>,
|
|
68
74
|
private readonly databaseMetadataResolver: DatabaseMetadataResolver,
|
|
69
75
|
) {
|
|
@@ -72,9 +78,9 @@ export class SystemMigrationsRunner {
|
|
|
72
78
|
await createDatabaseIfNotExists(this.project.db, message => typeof message === 'string' ? logger.warn(message) : logger.error(message))
|
|
73
79
|
const singleConnection = Connection.createSingle(this.project.db, err => logger.error(err))
|
|
74
80
|
await singleConnection.scope(async connection => {
|
|
75
|
-
const schemaResolver = (connection: Connection.ConnectionLike) => {
|
|
81
|
+
const schemaResolver = async (connection: Connection.ConnectionLike) => {
|
|
76
82
|
const dbContextMigrations = this.databaseContextFactory.create(connection)
|
|
77
|
-
return this.
|
|
83
|
+
return await this.schemaProvider.buildSchemaFromMigrations(dbContextMigrations)
|
|
78
84
|
}
|
|
79
85
|
const migrationResolver = new GroupMigrationsResolver(
|
|
80
86
|
new SnapshotMigrationResolver(snapshot, migrations),
|
|
@@ -8,6 +8,9 @@ CREATE TYPE "schema_migration_type" AS ENUM (
|
|
|
8
8
|
'schema',
|
|
9
9
|
'content'
|
|
10
10
|
);
|
|
11
|
+
CREATE TYPE "schema_single" AS ENUM (
|
|
12
|
+
'single'
|
|
13
|
+
);
|
|
11
14
|
CREATE FUNCTION "trigger_event"() RETURNS "trigger"
|
|
12
15
|
LANGUAGE "plpgsql"
|
|
13
16
|
AS $$
|
|
@@ -115,6 +118,14 @@ CREATE TABLE "event_data" (
|
|
|
115
118
|
"identity_id" "uuid" NOT NULL,
|
|
116
119
|
"transaction_id" "uuid" DEFAULT COALESCE((NULLIF("current_setting"('system.transaction_id'::"text", true), ''::"text"))::"uuid", ("set_config"('system.transaction_id'::"text", ("${randomUuidFn}"())::"text", true))::"uuid") NOT NULL
|
|
117
120
|
);
|
|
121
|
+
CREATE TABLE "schema" (
|
|
122
|
+
"id" "schema_single" DEFAULT 'single'::"schema_single" NOT NULL,
|
|
123
|
+
"schema" "json" NOT NULL,
|
|
124
|
+
"updated_at" timestamp with time zone DEFAULT "now"() NOT NULL,
|
|
125
|
+
"checksum" character(32) NOT NULL,
|
|
126
|
+
"version" character varying(20) NOT NULL,
|
|
127
|
+
"migration_id" integer NOT NULL
|
|
128
|
+
);
|
|
118
129
|
CREATE TABLE "schema_migration" (
|
|
119
130
|
"id" integer NOT NULL,
|
|
120
131
|
"version" character varying(20) NOT NULL,
|
|
@@ -143,6 +154,8 @@ ALTER TABLE ONLY "schema_migration"
|
|
|
143
154
|
ADD CONSTRAINT "schema_migration_pkey" PRIMARY KEY ("id");
|
|
144
155
|
ALTER TABLE ONLY "schema_migration"
|
|
145
156
|
ADD CONSTRAINT "schema_migration_version_key" UNIQUE ("version");
|
|
157
|
+
ALTER TABLE ONLY "schema"
|
|
158
|
+
ADD CONSTRAINT "schema_pkey" PRIMARY KEY ("id");
|
|
146
159
|
ALTER TABLE ONLY "stage"
|
|
147
160
|
ADD CONSTRAINT "stage_pkey" PRIMARY KEY ("id");
|
|
148
161
|
ALTER TABLE ONLY "stage"
|
|
@@ -155,11 +168,14 @@ CREATE INDEX "event_data_created" ON "event_data" USING "btree" ("created_at");
|
|
|
155
168
|
CREATE INDEX "system_event2_table_name" ON "event_data" USING "btree" ("table_name");
|
|
156
169
|
CREATE INDEX "system_event2_transaction" ON "event_data" USING "btree" ("transaction_id");
|
|
157
170
|
CREATE INDEX "system_event2_type" ON "event_data" USING "btree" ("type");
|
|
158
|
-
CREATE INDEX "
|
|
171
|
+
CREATE INDEX "system_event_data_row_id_0" ON "event_data" USING "btree" ((("row_ids" -> 0)));
|
|
172
|
+
CREATE INDEX "system_event_data_row_id_1" ON "event_data" USING "btree" ((("row_ids" -> 1)));
|
|
159
173
|
CREATE INDEX "system_schema_migration_version" ON "schema_migration" USING "btree" ("version");
|
|
160
174
|
CREATE INDEX "transaction_applied" ON "stage_transaction" USING "btree" ("applied_at");
|
|
161
175
|
ALTER TABLE ONLY "event_data"
|
|
162
176
|
ADD CONSTRAINT "event_data_schema_id_fkey" FOREIGN KEY ("schema_id") REFERENCES "schema_migration"("id");
|
|
177
|
+
ALTER TABLE ONLY "schema"
|
|
178
|
+
ADD CONSTRAINT "schema_migration_id_fkey" FOREIGN KEY ("migration_id") REFERENCES "schema_migration"("id") DEFERRABLE INITIALLY DEFERRED;
|
|
163
179
|
ALTER TABLE ONLY "stage_transaction"
|
|
164
180
|
ADD CONSTRAINT "stage_transaction_stage_id_fkey" FOREIGN KEY ("stage_id") REFERENCES "stage"("id") ON DELETE CASCADE;
|
|
165
181
|
`)
|
package/src/migrations/types.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Schema } from '@contember/schema'
|
|
2
1
|
import { ProjectConfig } from '../types'
|
|
3
2
|
import { Connection, DatabaseMetadata } from '@contember/database'
|
|
3
|
+
import { SchemaWithMeta } from '../model'
|
|
4
4
|
|
|
5
5
|
export interface SystemMigrationArgs {
|
|
6
|
-
schemaResolver: (connection: Connection.ConnectionLike) => Promise<
|
|
6
|
+
schemaResolver: (connection: Connection.ConnectionLike) => Promise<SchemaWithMeta>
|
|
7
7
|
databaseMetadataResolver: (connection: Connection.ConnectionLike, schema: string) => Promise<DatabaseMetadata>
|
|
8
8
|
project: ProjectConfig
|
|
9
9
|
}
|
|
@@ -9,4 +9,5 @@ export namespace AuthorizationActions {
|
|
|
9
9
|
|
|
10
10
|
export const PROJECT_MIGRATE = Authorizator.createAction(Resources.project, 'migrate')
|
|
11
11
|
export const PROJECT_LIST_MIGRATIONS = Authorizator.createAction(Resources.project, 'listMigrations')
|
|
12
|
+
export const PROJECT_SHOW_SCHEMA = Authorizator.createAction(Resources.project, 'showSchema')
|
|
12
13
|
}
|
|
@@ -8,6 +8,7 @@ export class PermissionsFactory {
|
|
|
8
8
|
permissions.allow(ProjectRole.ADMIN, { resource: Permissions.ALL, privilege: Permissions.ALL })
|
|
9
9
|
permissions.allow(ProjectRole.DEPLOYER, AuthorizationActions.PROJECT_MIGRATE)
|
|
10
10
|
permissions.allow(ProjectRole.DEPLOYER, AuthorizationActions.PROJECT_LIST_MIGRATIONS)
|
|
11
|
+
permissions.allow(ProjectRole.DEPLOYER, AuthorizationActions.PROJECT_SHOW_SCHEMA)
|
|
11
12
|
|
|
12
13
|
return permissions
|
|
13
14
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Acl
|
|
1
|
+
import { Acl } from '@contember/schema'
|
|
2
2
|
import { Permissions } from '@contember/authorization'
|
|
3
|
-
import { filterSchemaByStage } from '@contember/schema-utils'
|
|
4
3
|
import { AuthorizationActions } from './AuthorizationActions'
|
|
4
|
+
import { SchemaGetter } from '../SchemaGetter'
|
|
5
5
|
|
|
6
6
|
export class StagePermissionsFactory {
|
|
7
|
-
constructor(private readonly
|
|
7
|
+
constructor(private readonly getSchema: SchemaGetter) {}
|
|
8
8
|
|
|
9
|
-
public create(stage: string): Permissions {
|
|
9
|
+
public async create(stage: string): Promise<Permissions> {
|
|
10
10
|
const permissions = new Permissions()
|
|
11
11
|
|
|
12
|
-
const filteredSchema =
|
|
12
|
+
const filteredSchema = await this.getSchema({ stage })
|
|
13
13
|
|
|
14
14
|
const rolePermissions = this.createRolePermissions(filteredSchema.acl)
|
|
15
15
|
Object.entries(rolePermissions).forEach(([role, value]) => {
|
|
@@ -6,8 +6,8 @@ import { StagePermissionsFactory } from './StagePermissionsFactory'
|
|
|
6
6
|
export class StageScope implements AuthorizationScope<Identity> {
|
|
7
7
|
constructor(private readonly stage: string, private readonly stagePermissionsFactory: StagePermissionsFactory) {}
|
|
8
8
|
|
|
9
|
-
getIdentityAccess(identity: Identity): Promise<AccessNode> {
|
|
10
|
-
const permissions = this.stagePermissionsFactory.create(this.stage)
|
|
9
|
+
async getIdentityAccess(identity: Identity): Promise<AccessNode> {
|
|
10
|
+
const permissions = await this.stagePermissionsFactory.create(this.stage)
|
|
11
11
|
const roles = new AccessNode.Roles(identity.roles)
|
|
12
12
|
const permissionEvaluator = new AccessEvaluator.PermissionEvaluator(permissions)
|
|
13
13
|
const node = new SwitchEvaluatorNode(roles, permissionEvaluator)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ConflictActionType, InsertBuilder } from '@contember/database'
|
|
2
|
+
import { Command } from '../Command'
|
|
3
|
+
import { SchemaWithMeta } from '../../migrations'
|
|
4
|
+
|
|
5
|
+
export class SaveSchemaCommand implements Command<void> {
|
|
6
|
+
constructor(private readonly input: SchemaWithMeta) {}
|
|
7
|
+
|
|
8
|
+
public async execute({ db }: Command.Args): Promise<void> {
|
|
9
|
+
if (!this.input.meta.updatedAt) {
|
|
10
|
+
throw new Error('Cannot persist empty schema')
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
await InsertBuilder.create()
|
|
14
|
+
.into('schema')
|
|
15
|
+
.values({
|
|
16
|
+
schema: this.input.schema,
|
|
17
|
+
updated_at: this.input.meta.updatedAt.toISOString(),
|
|
18
|
+
checksum: this.input.meta.checksum,
|
|
19
|
+
version: this.input.meta.version,
|
|
20
|
+
migration_id: this.input.meta.id,
|
|
21
|
+
})
|
|
22
|
+
.onConflict(ConflictActionType.update, ['id'], {
|
|
23
|
+
schema: expr => expr.select(['excluded', 'schema']),
|
|
24
|
+
updated_at: expr => expr.select(['excluded', 'updated_at']),
|
|
25
|
+
checksum: expr => expr.select(['excluded', 'checksum']),
|
|
26
|
+
version: expr => expr.select(['excluded', 'version']),
|
|
27
|
+
migration_id: expr => expr.select(['excluded', 'migration_id']),
|
|
28
|
+
})
|
|
29
|
+
.execute(db)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Stage } from '../../dtos'
|
|
2
2
|
import { DatabaseContext } from '../../database'
|
|
3
|
-
import { Schema } from '@contember/schema'
|
|
4
3
|
import { ExecutionResult } from 'graphql'
|
|
5
4
|
import { DatabaseMetadata } from '@contember/database'
|
|
5
|
+
import { Schema } from '@contember/schema'
|
|
6
6
|
|
|
7
7
|
export interface ContentQueryExecutorContext {
|
|
8
|
-
schema: Schema
|
|
8
|
+
schema: Schema
|
|
9
|
+
schemaMeta: { id: number }
|
|
9
10
|
identity: { id: string }
|
|
10
11
|
db: DatabaseContext
|
|
11
12
|
stage: Stage
|
|
@@ -3,8 +3,15 @@ import { DeleteMigrationCommand } from '../commands'
|
|
|
3
3
|
import { Response, ResponseError, ResponseOk } from '../../utils'
|
|
4
4
|
import { Migration } from '@contember/schema-migrations'
|
|
5
5
|
import { ModifyMigrationCommand } from '../commands/migrations/ModifyMigrationCommand'
|
|
6
|
+
import { SchemaProvider } from './SchemaProvider'
|
|
7
|
+
import { SaveSchemaCommand } from '../commands/schema/SaveSchemaCommand'
|
|
6
8
|
|
|
7
9
|
export class MigrationAlterer {
|
|
10
|
+
constructor(
|
|
11
|
+
private readonly schemaProvider: SchemaProvider,
|
|
12
|
+
) {
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
public async deleteMigration(
|
|
9
16
|
db: DatabaseContext,
|
|
10
17
|
version: string,
|
|
@@ -15,6 +22,7 @@ export class MigrationAlterer {
|
|
|
15
22
|
await db.client.connection.rollback()
|
|
16
23
|
return new ResponseError(DeleteMigrationErrorCode.notFound, `Migration ${version} was not found`)
|
|
17
24
|
}
|
|
25
|
+
await this.refreshSchema(db)
|
|
18
26
|
return new ResponseOk(undefined)
|
|
19
27
|
})
|
|
20
28
|
}
|
|
@@ -30,9 +38,15 @@ export class MigrationAlterer {
|
|
|
30
38
|
await db.client.connection.rollback()
|
|
31
39
|
return new ResponseError(UpdateMigrationErrorCode.notFound, `Migration ${version} was not found`)
|
|
32
40
|
}
|
|
41
|
+
await this.refreshSchema(db)
|
|
33
42
|
return new ResponseOk(undefined)
|
|
34
43
|
})
|
|
35
44
|
}
|
|
45
|
+
|
|
46
|
+
private async refreshSchema(db: DatabaseContext): Promise<void> {
|
|
47
|
+
const schemaWithMeta = await this.schemaProvider.buildSchemaFromMigrations(db)
|
|
48
|
+
await db.commandBus.execute(new SaveSchemaCommand(schemaWithMeta))
|
|
49
|
+
}
|
|
36
50
|
}
|
|
37
51
|
|
|
38
52
|
export enum DeleteMigrationErrorCode {
|
|
@@ -6,17 +6,19 @@ import { Stage } from '../dtos'
|
|
|
6
6
|
import { DatabaseContext } from '../database'
|
|
7
7
|
import { ExecutedMigrationsResolver } from './ExecutedMigrationsResolver'
|
|
8
8
|
import { MigrateErrorCode } from '../../schema'
|
|
9
|
-
import {
|
|
10
|
-
import { SchemaValidator, SchemaValidatorSkippedErrors } from '@contember/schema-utils'
|
|
9
|
+
import { calculateSchemaChecksum, SchemaValidator, SchemaValidatorSkippedErrors } from '@contember/schema-utils'
|
|
11
10
|
import { logger } from '@contember/logger'
|
|
12
11
|
import { MigrationsDatabaseMetadataResolverStoreFactory, SchemaDatabaseMetadataResolverStore } from '../metadata'
|
|
13
12
|
import { ContentMigrationQuery, MigrationInput } from './MigrationInput'
|
|
14
13
|
import { ContentQueryExecutor } from '../dependencies'
|
|
14
|
+
import { SchemaProvider } from './SchemaProvider'
|
|
15
|
+
import { SaveSchemaCommand } from '../commands/schema/SaveSchemaCommand'
|
|
16
|
+
import { ImplementationException } from '../../utils'
|
|
15
17
|
|
|
16
18
|
export class ProjectMigrator {
|
|
17
19
|
constructor(
|
|
18
20
|
private readonly migrationDescriber: MigrationDescriber,
|
|
19
|
-
private readonly
|
|
21
|
+
private readonly schemaProvider: SchemaProvider,
|
|
20
22
|
private readonly executedMigrationsResolver: ExecutedMigrationsResolver,
|
|
21
23
|
private readonly migrationsDatabaseMetadataResolverStoreFactory: MigrationsDatabaseMetadataResolverStoreFactory,
|
|
22
24
|
private readonly contentQueryExecutor: ContentQueryExecutor,
|
|
@@ -36,8 +38,14 @@ export class ProjectMigrator {
|
|
|
36
38
|
if (migrationsToExecute.length === 0) {
|
|
37
39
|
return
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
const schemaWithMeta = await this.schemaProvider.fetch({ db })
|
|
42
|
+
let schema = schemaWithMeta.schema
|
|
43
|
+
let id = schemaWithMeta.meta.id
|
|
44
|
+
|
|
45
|
+
const validated = await this.validateMigrations(db, schema, schemaWithMeta.meta.version ?? null, migrationsToExecute, { ignoreOrder, skipExecuted })
|
|
46
|
+
if (validated.length === 0) {
|
|
47
|
+
return
|
|
48
|
+
}
|
|
41
49
|
|
|
42
50
|
const sorted = [...validated].sort((a, b) => a.version.localeCompare(b.version))
|
|
43
51
|
|
|
@@ -61,16 +69,16 @@ export class ProjectMigrator {
|
|
|
61
69
|
)
|
|
62
70
|
}
|
|
63
71
|
} else if (migration.type === 'content') {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
id,
|
|
72
|
+
if (!id) {
|
|
73
|
+
throw new FailedContentMigrationError(migration.version, `Cannot execute content migration without schema`)
|
|
67
74
|
}
|
|
68
75
|
for (const query of migration.queries) {
|
|
69
76
|
await this.executeContentMigration({
|
|
70
77
|
version: migration.version,
|
|
71
78
|
query,
|
|
72
79
|
db,
|
|
73
|
-
schema
|
|
80
|
+
schema,
|
|
81
|
+
schemaMeta: { id },
|
|
74
82
|
stages,
|
|
75
83
|
databaseMetadata: await metadataStore.getMetadata(db.client.schema),
|
|
76
84
|
identity,
|
|
@@ -84,6 +92,19 @@ export class ProjectMigrator {
|
|
|
84
92
|
}
|
|
85
93
|
id = await db.commandBus.execute(new SaveMigrationCommand(migration))
|
|
86
94
|
}
|
|
95
|
+
if (!id) {
|
|
96
|
+
throw new ImplementationException()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
await db.commandBus.execute(new SaveSchemaCommand({
|
|
100
|
+
schema,
|
|
101
|
+
meta: {
|
|
102
|
+
id,
|
|
103
|
+
updatedAt: new Date(),
|
|
104
|
+
version: sorted[sorted.length - 1].version,
|
|
105
|
+
checksum: calculateSchemaChecksum(schema),
|
|
106
|
+
},
|
|
107
|
+
}))
|
|
87
108
|
}
|
|
88
109
|
|
|
89
110
|
private async executeContentMigration({ query, stages, version, ...ctx }: {
|
|
@@ -91,7 +112,8 @@ export class ProjectMigrator {
|
|
|
91
112
|
db: DatabaseContext
|
|
92
113
|
query: ContentMigrationQuery
|
|
93
114
|
stages: Stage[]
|
|
94
|
-
schema: Schema
|
|
115
|
+
schema: Schema
|
|
116
|
+
schemaMeta: { id: number }
|
|
95
117
|
project: { slug: string; systemSchema: string }
|
|
96
118
|
identity: { id: string }
|
|
97
119
|
databaseMetadata: DatabaseMetadata
|
|
@@ -120,7 +142,7 @@ export class ProjectMigrator {
|
|
|
120
142
|
private async validateMigrations(
|
|
121
143
|
db: DatabaseContext,
|
|
122
144
|
schema: Schema,
|
|
123
|
-
version: string,
|
|
145
|
+
version: string | null,
|
|
124
146
|
migrationsToExecute: readonly MigrationInput[],
|
|
125
147
|
{ ignoreOrder, skipExecuted }: {
|
|
126
148
|
ignoreOrder: boolean
|
|
@@ -140,7 +162,7 @@ export class ProjectMigrator {
|
|
|
140
162
|
}
|
|
141
163
|
}
|
|
142
164
|
|
|
143
|
-
if (migration.version < version && !ignoreOrder) {
|
|
165
|
+
if (version && migration.version < version && !ignoreOrder) {
|
|
144
166
|
throw new MustFollowLatestMigrationError(migration.version, `Must follow latest executed migration ${version}`)
|
|
145
167
|
}
|
|
146
168
|
if (migration.type === 'schema') {
|