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

Move creation of metric.owner_(id|type) before migration of existing backend APIs #1199

Merged
merged 1 commit into from Sep 18, 2019

Conversation

guicassolato
Copy link
Contributor

@guicassolato guicassolato commented Sep 17, 2019

What this PR does / why we need it

After #1171, bbd7051 became a requirement for https://github.com/3scale/porta/blob/8cecd33c61eed6e724ffcc2108effb89fd913ac0/db/migrate/20190716110520_create_the_backend_apis_of_services.rb.

Which issue(s) this PR fixes

Closes THREESCALE-3485

Verification steps

git co c2204dcdf8cf3e5a9484e635df3bba7544e8b529~1 # right before the migration that breaks without this PR
bundle exec rake db:reset
git co fix/create-backend-apis-migration
bundle exec db:migrate

You should see no error

Migrating to CreateTheBackendApisOfServices (20190716110520)
== 20190716110520 CreateTheBackendApisOfServices: migrating ===================
-- Migrating proxies api_backend to slugs...
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
undefined method `owner_type?' for #<Metric:0x0000000006b93858>
/opt/system/vendor/bundle/ruby/2.4.0/gems/activemodel-4.2.11.1/lib/active_model/attribute_methods.rb:433:in `method_missing'
/opt/system/app/models/metric.rb:251:in `fill_owner'

Special notes to the reviewer

Alternative: Completely remove https://github.com/3scale/porta/blob/8cecd33c61eed6e724ffcc2108effb89fd913ac0/db/migrate/20190716110520_create_the_backend_apis_of_services.rb and make it a rake task to be executed only after finishing with all DLL migrations.

@guicassolato guicassolato merged commit 686b735 into master Sep 18, 2019
@guicassolato guicassolato deleted the fix/create-backend-apis-migration branch September 18, 2019 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants