-
Notifications
You must be signed in to change notification settings - Fork 153
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
when using activerecord 5 schema_format = :sql still outputs to schema.rb #129
Comments
It looks like it is because of this change rails/rails@99e57a8 in which structure dumps now use the path in |
Can you test with our newest version 5.2.0? If if doesn't work for you we'd love a PR with a fix! |
Unfortunately I no longer use standalone-migrations day to day, but I would guess a fix might involve changing this line, and it says it hasn't been touched in 3 years. Did you make a change that you expect to have fixed this issue? I'd be happy to take a look. Thanks! |
No worries, I just wanted to make sure the issue didn't get left behind. I'll leave this issue open and if someone else comes along that needs that feature they can send a PR with a fix. Standalone migrations is maintained by its active users now and we just review PR's and publish updates when new PR's are merged. |
Can confirm bug still exists on Works like this:
|
You can workaround this by specifying the schema file name in the db:
schema: db/schema.sql You still need to specify the ActiveRecord schema format in the Rakefile: ActiveRecord::Base.schema_format = :sql |
The line of code … ENV['SCHEMA'] = schema was originally introduced in #42. I'm not familiar enough with today's Rails/ActiveRecord code to come up with a better solution, but I figure there might be a way to hook into Rails/AR in such a way that allows us to override the path (but not the base name) of the schema/structure dump file. Then we wouldn't have to explicitly set the |
…icitly specified in config file. This allows ActiveRecord to choose between `schema.rb` and `structure.sql` as the file name, and setting `ActiveRecord::Base.schema_format = :sql` will actually dump to the right file (`structure.sql`). This should address <thuss#129>.
…ver ActiveRecord defaults to. This allows ActiveRecord to choose between `schema.rb` and `structure.sql` as the file name, and setting `ActiveRecord::Base.schema_format = :sql` will actually dump to the right file (`structure.sql`). This should address <thuss#129>.
I believe PR #141 addresses this in a better way. |
I just started a new project with standalone-migrations and activerecord 5. I set the schema_format = :sql, but the file created during migrations is still at schema.rb The contents of the file IS SQL however.
Using standalone-migrations with active record 4.2 properly puts the sql in structure.sql, as does running migrations on a fresh Rails 5 install.
It appears that something about the way standalone-migrations interacts with rails 5 causes active record to output the sql to the wrong file
The text was updated successfully, but these errors were encountered: