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

Repeated number for migrations on multiple resource extensions #1885

Closed
brenes opened this issue Aug 17, 2012 · 9 comments
Closed

Repeated number for migrations on multiple resource extensions #1885

brenes opened this issue Aug 17, 2012 · 9 comments

Comments

@brenes
Copy link
Contributor

brenes commented Aug 17, 2012

Hi,

I'm creating an extension with multiple resources and I'm running into an issue with the created migrations as theu have the same migration number and therefore I can't "install" them in my app.

I've created the extension with the usual generator:

rails g refinery:engine Degree name:string slug:string

In the output, the migration is created

create vendor/extensions/degrees/db/migrate/1_create_degrees_degrees.rb

When I add the other resource with the generator

rails g refinery:engine DegreeType name:string slug:string --extension degrees

The new migration is created

create vendor/extensions/degrees/db/migrate/1_create_degrees_degree_types.rb

The problem here is that it has the same number (1) and when I try to "install" them:

rails generate refinery:degrees
        rake  refinery_degrees:install:migrations
        rake aborted!
        Multiple migrations have the version number 1

Thanks!

@brenes
Copy link
Contributor Author

brenes commented Aug 17, 2012

I'm checking out the code and I see another problem related to the previous one.

When you add a new resource config/routes.rb file is not appended properly and it results on a conflict.

brenes added a commit to simplelogica/refinerycms that referenced this issue Aug 17, 2012
brenes added a commit to simplelogica/refinerycms that referenced this issue Aug 17, 2012
…igration (it didn't include final '.erb'). Related to the issue refineryGH-1885 about bad revisions numbering
brenes added a commit to simplelogica/refinerycms that referenced this issue Aug 17, 2012
brenes added a commit to simplelogica/refinerycms that referenced this issue Aug 17, 2012
@parndt
Copy link
Member

parndt commented Aug 17, 2012

Weird it is supposed to replace that number with a timestamp. Is this
on the latest version?

@brenes
Copy link
Contributor Author

brenes commented Aug 20, 2012

Yes, it's the lastest gem version (2.0.6).

The replacement is supposed to be done when you execute

rails generate refinery:degrees

but in the extension directory the migration is created with the same number. If I correct it manually or use the version from the pull request migrations are created in the app directory replacing '1' with the timestamp.

parndt pushed a commit that referenced this issue Aug 22, 2012
parndt pushed a commit that referenced this issue Aug 22, 2012
…igration (it didn't include final '.erb'). Related to the issue GH-1885 about bad revisions numbering
parndt pushed a commit that referenced this issue Aug 22, 2012
parndt pushed a commit that referenced this issue Aug 22, 2012
@robyurkowski
Copy link
Contributor

@parndt Is this all done with?

@aarona
Copy link

aarona commented May 30, 2013

I'm getting this problem right now. My gem versions:

refinerycms (2.0.10, 2.0.9, 2.0.8)
refinerycms-authentication (2.0.10, 2.0.9, 2.0.8)
refinerycms-blog (2.0.4)
refinerycms-core (2.0.10, 2.0.9)
refinerycms-dashboard (2.0.10, 2.0.9, 2.0.8)
refinerycms-i18n (2.0.2)
refinerycms-images (2.0.10, 2.0.9, 2.0.8)
refinerycms-pages (2.0.10, 2.0.9, 2.0.8)
refinerycms-resources (2.0.10, 2.0.9, 2.0.8)
refinerycms-settings (2.0.2)
refinerycms-testing (2.0.9)

Seems like it wasn't fixed?

@ugisozols
Copy link
Member

I tried it on 2-0-stable branch but wasn't able to reproduce it. @aarona can you post a gist of your Gemfile.lock?

@aarona
Copy link

aarona commented May 31, 2013

Hopefully you can access this?

https://gist.github.com/aarona/5685071

Also, I should note that I adopted this project for a new client who had a programmer working on it for awhile but stopped sometime in September of last year. Its possible that some gems got updated since I bundled my gems some time in April. Also I'm very new to Refinery still and I had made some migrations earlier just to fix some database associations by using rails g migration XXX instead of the special migration command for Refinery. This was the first migration I did that needed to create a model so I used the refinery migration command.

As a workaround I just used the rails g migration command as usual with the same name and just pasted the code into it. Hopefully this backstory is useful in determining the issue!

@ugisozols
Copy link
Member

You're still using Refinery CMS 2.0.8. Update to 2.0.10 by running bundle update refinerycms and see if that fixes this error.

protip: always backup before upgrading in case something goes wrong ;)

@aarona
Copy link

aarona commented May 31, 2013

Got it. Updating is usually a nightmare for me but I will give this a shot and see if it fixes it. I'm done for now but I will post results later today or tomorrow. Thanks for replying. Wasn't sure if I would get a response! :)

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

No branches or pull requests

5 participants