Repeated number for migrations on multiple resource extensions #1885

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

Comments

Projects
None yet
5 participants
@brenes

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

This comment has been minimized.

Show comment Hide comment
@brenes

brenes 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 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

Fixing the regex used for detecting that a generator template was a m…
…igration (it didn't include final '.erb'). Related to the issue GH-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

This comment has been minimized.

Show comment Hide comment
@parndt

parndt Aug 17, 2012

Owner

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

Owner

parndt commented Aug 17, 2012

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

@brenes

This comment has been minimized.

Show comment Hide comment
@brenes

brenes 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.

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 added a commit that referenced this issue Aug 22, 2012

parndt added a commit that referenced this issue Aug 22, 2012

Fixing the regex used for detecting that a generator template was a m…
…igration (it didn't include final '.erb'). Related to the issue GH-1885 about bad revisions numbering

parndt added a commit that referenced this issue Aug 22, 2012

parndt added a commit that referenced this issue Aug 22, 2012

@robyurkowski

This comment has been minimized.

Show comment Hide comment
@robyurkowski

robyurkowski Aug 24, 2012

Contributor

@parndt Is this all done with?

Contributor

robyurkowski commented Aug 24, 2012

@parndt Is this all done with?

@ugisozols ugisozols closed this Sep 11, 2012

@aarona

This comment has been minimized.

Show comment Hide comment
@aarona

aarona 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?

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

This comment has been minimized.

Show comment Hide comment
@ugisozols

ugisozols May 30, 2013

Owner

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?

Owner

ugisozols commented May 30, 2013

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

This comment has been minimized.

Show comment Hide comment
@aarona

aarona 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!

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

This comment has been minimized.

Show comment Hide comment
@ugisozols

ugisozols May 31, 2013

Owner

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 ;)

Owner

ugisozols commented May 31, 2013

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

This comment has been minimized.

Show comment Hide comment
@aarona

aarona 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! :)

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