-
Notifications
You must be signed in to change notification settings - Fork 84
Migrations work fine.. db:setup/reset from the schema.rb file does not work. #123
Comments
@Altonymous The schema.rb file normally works fine. Will need more details to understand what problem you're having. |
Sure, I'll try and give more details. I am getting this error on my output when trying to do a
This is my migration...
|
If I switch to using the structure.sql it works dumps and imports fine. *The pg_dump isn't exporting the Extensions for some reason, but the rest works. |
The schema.rb file looks like this...
|
This is the DDL reported by the database after
|
It looks like it's taking the id: :uuid and properly creating it as a uuid column, but not marking it as the primary_key. |
It looks to me that the problem is in Rails 4.0.0. I created a generic Rails 4.0.0 app with postgresql as the database. I create the following migration:
If I use
If I then use
Note that the PRIMARY KEY index disappears! I'm seeing this without |
See the tail end of rails/rails#11016. It looks like it's fixed in |
It looks like it works with
Both I did a quick test with the following migration using
|
The migration works fine. It's trying to use the db:reset or db:setup tasks that the db:migrate generates that is a problem. I came to the same conclusion as you and just opened a pull request against 4-0-stable for rails. |
I know, but when I tried with 4-0-stable, I was able to successfully do a
Note that under |
I'll double check that, because I didn't think it was.. which is why I went through the trouble of chasing down that issue. I can always point back to the 4-0-stable branch on the rails repo instead of my fork and see if it does indeed work. If it does, then that would be great, I hate maintaining a fork. :P |
Note that because the core issue is in the schema dumping code, simply switching to 4-0-stable and then attempting a |
It appears as if the SQL being generated by the schema.rb file is very different from the SQL generated from the migrations. Because of this I have to constantly rollback all migrations before committing to make sure that the schema.rb file is never used for anything other than database creation.
The text was updated successfully, but these errors were encountered: