Skip to content
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

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

Merged

Conversation

josepegea
Copy link
Contributor

@josepegea josepegea commented May 21, 2018

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
Contributor

Looks good! Thanks @josepegea

@cainlevy cainlevy merged commit c6fd99c into EmpaticoOrg:master May 21, 2018
@cainlevy
Copy link
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