Skip to content

Fix schema.rb generation for Rails 4.x - #5

Merged
cainlevy merged 1 commit into
EmpaticoOrg:masterfrom
josepegea:fix_views_as_tables_for_rails_4x
May 21, 2018
Merged

cainlevy merged 1 commit into
EmpaticoOrg:masterfrom
josepegea:fix_views_as_tables_for_rails_4x

Conversation

@josepegea

@josepegea josepegea commented May 21, 2018 •

Copy link
Copy Markdown
Contributor

In versions 4.x, when updating the schema.rb file, Rails includes any
view in the DB in the list "create_table" statements.

When scenic adds the corresponding "create_view" statements, they fail
because of the duplicate names.

This is due to MySQL including views in the output of "show tables"
and Rails not filtering them out.

This code patches the schema dumper on old Rails versios to prevent
outputting views as if they were tables.

This should fix #2

In versions 4.x, when updating the schema.rb file, Rails includes any
view in the DB in the list "create_table" statements.

When scenic adds the corresponding "create_view" statements, they fail
because of the duplicate names.

This is due to MySQL including views in the output of "show tables"
and Rails not filtering them out.

This code patches the schema dumper on old Rails versios to prevent
outputting views as if they were tables.
@cainlevy

Copy link
Copy Markdown
Contributor

Looks good! Thanks @josepegea

@cainlevy
cainlevy merged commit c6fd99c into EmpaticoOrg:master May 21, 2018
@cainlevy

Copy link
Copy Markdown
Contributor

available in v1.0.1

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.

schema.rb contains both create_table and create_view for newly created views

2 participants