Skip to content

Conversation

@my-lab-23
Copy link

Description

Summary of the change: Implements schema validation functions assertSchemaIsCorrect and validateSchema to compare database schema with Exposed table definitions without performing modifications.

Detailed description:

  • What: Added two new functions in org.jetbrains.exposed.v1.migration package:
    • assertSchemaIsCorrect(): Throws SchemaValidationException if schema is misaligned
    • validateSchema(): Returns SchemaValidationResult for functional approach
    • Supporting classes: SchemaValidationException and SchemaValidationResult
  • Why: Addresses the need for schema validation in CI pipelines, after manual migrations, and in production environments where DDL changes are restricted. Previously, only MigrationUtils.createMissingTablesAndColumns() existed which modifies the database rather than just validating it.
  • How: Uses existing MigrationUtils.statementsRequiredForDatabaseMigration() to detect schema differences and provides two API approaches - exception-based for assertions and result-based for functional programming.

Type of Change

Please mark the relevant options with an "X":

  • Bug fix
  • New feature
  • Documentation update

Affected databases:

  • All

Related Issues

#377

@obabichevjb obabichevjb self-requested a review July 11, 2025 12:40
@my-lab-23 my-lab-23 force-pushed the feat/schema-validation-api branch from b28f4cf to 4996a07 Compare July 11, 2025 14:36
@my-lab-23 my-lab-23 force-pushed the feat/schema-validation-api branch from 4996a07 to e64607b Compare July 11, 2025 15:00
@my-lab-23
Copy link
Author

Just brought the branch up to date with main, nothing else changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant