-
Notifications
You must be signed in to change notification settings - Fork 42
AutoUpgrades fail on STI models. #25
Comments
by Postmodern |
I did some research into this test today, but I haven’t been able to narrow down the cause. I think it’s something inside DO or SQLite causing the problem. Here’s what I do know:
At this point I am unsure what the solution is. I think this will require more research, so I am removing it from the 1.0.0 milestone. @dirkjan: Can you think of anything that would cause this behaviour? by Dan Kubb (dkubb) |
A user who was testing Ronin edge and DataMapper 1.0.0.rc3 on Ruby 1.8.7 and OpenSolaris (libsqlite3 3.6.17) was able to reproduce the error:
Note: Ronin by default uses the sqlite3 "~/.ronin/database.sqlite3". by Postmodern |
I am able to reproduce this bug on JRuby 1.5.1:
by Postmodern |
I'm getting this issue too. 1.9.2-p290
Same deal as you, |
I was able to work around this issue with this as a replacement for |
I'm getting the same issue. It's especially annoying when adding a new index, since it tries to add it twice. It also seems to happen with require 'rubygems'
require 'dm-core'
require 'dm-migrations'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'sqlite::memory:')
class Shape
include DataMapper::Resource
property :id, Serial
property :type, Discriminator
property :name, String, :index => true
end
class Circle < Shape
end
DataMapper.finalize
DataMapper.auto_migrate! When fresh it runs correctly, but the tables are being created twice:
However, if the table already exists and I run I'm using data_mapper (1.2.0). Thanks for the workaround @charlieschwabacher |
It appears that DataMapper.auto_upgrade! is attempting to re-create the columns of a base STI model, for every descendent of that base model. This results in duplicate column errors when calling auto_upgrade!. This error does not occurr when running DataMapper.auto_migrate!.
Gemfile
test.rb
Created by Postmodern - 2010-05-24 01:54:27 UTC
Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/1289
The text was updated successfully, but these errors were encountered: