New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #33008 - switch to sql schema dumping #8660
Conversation
Issues: #33008 |
@@ -1,2 +1,2 @@ | |||
# Ignore Dynflow tables when schema-dumping. Dynflow tables are handled automatically by Dynflow. | |||
ActiveRecord::SchemaDumper.ignore_tables << /^dynflow_.*$/ | |||
ActiveRecord::SchemaDumper.ignore_tables << '^dynflow_*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure about this, the docs seem to indicate that '^dynflow_*$'
should work, but it didn't seem to and allowed everything through. '^dynflow_*'
appeared to work fine:
$ grep dynflow_ db/structure.sql
dynflow_execution_plan_id character varying,
dynflow_step_id integer,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually does NOT work and is a regression. When I do rake db:schema:dump
it creates me Ruby version (schema.rb
) and it does contain dynflow tables. This leads to the issue: https://projects.theforeman.org/issues/30052
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tbrisker thoughts on merging this so it gets in 3.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jlsherrill ! let's get this in to 3.0, hopefully it won't break anything.
I am seeing this file as modified all the time, shall we add it into |
How this is supposed to work? When I do |
Oh I understand, it creates both |
Looks like Ruby codebase explains it nicely. ##
# :singleton-method:
# A list of tables which should not be dumped to the schema.
# Acceptable values are strings as well as regexp if ActiveRecord::Base.schema_format == :ruby.
# Only strings are accepted if ActiveRecord::Base.schema_format == :sql.
cattr_accessor :ignore_tables, default: []
##
# :singleton-method:
# Specify a custom regular expression matching foreign keys which name
# should not be dumped to db/schema.rb.
cattr_accessor :fk_ignore_pattern, default: /^fk_rails_[0-9a-f]{10}$/
##
# :singleton-method:
# Specify a custom regular expression matching check constraints which name
# should not be dumped to db/schema.rb.
cattr_accessor :chk_ignore_pattern, default: /^chk_rails_[0-9a-f]{10}$/ |
I have found out that regular expression works both for SQL and Ruby however regexp in a string only works for SQL. Filing an issue and a PR. |
No description provided.