5

I want to add an attribute to a model I've created within a Refinery CMS engine. I know I could do the following:

  1. rails generate migration AddPartNumberToProducts part_number:string
  2. Manually move the migration file from db/migrate to vendor/extensions/products/db/migrate

But is there a command to generate the migration into the correct folder in the first place?

Thanks!

Mike
  • 9,692
  • 6
  • 44
  • 61
  • 2
    Nope, that's how you do it :-) – parndt Nov 28 '12 at 09:24
  • 1
    wouldn't it be better to create the migration in your extension's migration folder, then run rails g refinery: to copy it into the project migrations folder? – Cristian Oct 04 '13 at 00:15
  • 2
    I agree with @Cristian -- although perhaps we are looking at a different problem. My situation (which the `rails g refinery:` method solves) is when I have added new migrations to an engine that is already installed in the app – CJBrew Jun 02 '14 at 23:49
  • @parndt when I do this I see the migrations end up in the spec/dummy/db/migrate folder. Is that what we should expect? It's annoying! :) – CJBrew Dec 19 '14 at 14:52
  • That happens when you're using a dummy application, yeah. It's a side effect of that approach. It's not something that we addressed very well, so the workaround in the question is still often appropriate, though you copy it from spec/dummy/db/migrate/ to the extension instead. – parndt Dec 30 '14 at 06:14

1 Answers1

1

The method I have outlined above is correct, according to @parndt (the lead developer of the Refinery project).

Mike
  • 9,692
  • 6
  • 44
  • 61