Skip to content

Conversation

kravcneger
Copy link

Guys, at least one type of constraint can be placed after the table definition, just like indexes. It also improves the readability of the schema.

@@ -128,17 +128,29 @@ def clean_options
dump.gsub!(/^(INSERT INTO schema_migrations .*)\n\n/, "\\1\n")
end

if options[:indexes_after_tables] == true
# Extract indexes, remove comments and place them just after the respective tables
if options[:meta_tables_after_main] == true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For backwards comparability it would be better to check both the new and old setting:

if options[:indexes_after_tables] || options[:meta_tables_after_main]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kravcneger kravcneger force-pushed the feature-deferrable-constraints-after-main branch from 70a9507 to 041591a Compare June 11, 2025 14:17
@kravcneger kravcneger force-pushed the feature-deferrable-constraints-after-main branch from 041591a to e5d7621 Compare June 11, 2025 14:19
@kravcneger kravcneger requested a review from seanlinsley June 20, 2025 17:43
@@ -128,17 +128,29 @@ def clean_options
dump.gsub!(/^(INSERT INTO schema_migrations .*)\n\n/, "\\1\n")
end

if options[:indexes_after_tables] == true
# Extract indexes, remove comments and place them just after the respective tables
if options[:indexes_after_tables] || options[:meta_tables_after_main]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to leave a comment to indicate options[:indexes_after_tables] is the old option and is deprecated, and maybe specify a version where it will be removed? We could also add the deprecation announcement into the release notes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andyatkinson like so?

@kravcneger kravcneger requested a review from andyatkinson July 9, 2025 11:34
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.

3 participants