
AutoUpgrades fail on STI models.
Reported by Postmodern | May 23rd, 2010 @ 08:54 PM
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
source 'http://rubygems.org'
datamapper = 'git://github.com/datamapper'
gem 'activesupport', '~> 3.0.0.beta3'
gem 'dm-do-adapter', '~> 1.0.0.rc2', :git => "#{datamapper}/dm-do-adapter.git"
gem 'dm-sqlite-adapter', '~> 1.0.0.rc2', :git => "#{datamapper}/dm-sqlite-adapter.git"
gem 'dm-core', '~> 1.0.0.rc2', :git => "#{datamapper}/dm-core.git"
gem 'dm-migrations', '~> 1.0.0.rc2', :git => "#{datamapper}/dm-migrations.git"
test.rb
require 'dm-core'
require 'dm-migrations'
class BaseModel
include DataMapper::Resource
include DataMapper::Migrations
property :id, Serial
property :type, Discriminator
property :x, Integer
end
class ModelOne < BaseModel
property :y, Integer
end
class ModelTwo < BaseModel
property :z, Integer
end
DataMapper.setup(:default, "sqlite3://test.db")
DataMapper.auto_upgrade!
Comments and changes to this ticket
-
Postmodern May 23rd, 2010 @ 08:57 PM
- Tag changed from 1.0.0.rc2, auto_upgrade, dm-migrations to 1.0.0.rc2, auto_upgrade, dm-migrations, sti
-
Postmodern May 23rd, 2010 @ 08:58 PM
- no changes were found...
-
Dan Kubb (dkubb) May 27th, 2010 @ 05:19 PM
- Milestone set to 1.0.0
- State changed from new to accepted
-
Postmodern May 27th, 2010 @ 05:33 PM
~ (0.000052) PRAGMA table_info("ronin_addresses") ~ (0.000307) CREATE TABLE "ronin_addresses" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "type" VARCHAR NOT NULL, "address" VARCHAR(50) NOT NULL, "created_at" TIMESTAMP NOT NULL, "frozen_tag_list" TEXT, "organization_id" INTEGER, "version" INTEGER NOT NULL) ~ (0.000117) CREATE INDEX "index_ronin_addresses_organization" ON "ronin_addresses" ("organization_id") ~ (0.000113) CREATE UNIQUE INDEX "unique_ronin_addresses_address" ON "ronin_addresses" ("address") ~ (0.000078) PRAGMA table_info("ronin_addresses") ~ (0.000143) PRAGMA table_info("ronin_addresses") ~ duplicate column name: id (code: 1, sql state: , query: ALTER TABLE "ronin_addresses" ADD COLUMN "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, uri: sqlite3://:memory:) /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/adapters/dm-do-adapter.rb:70:in `execute_non_query': duplicate column name: id (DataObjects::SyntaxError) from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/adapters/dm-do-adapter.rb:70:in `block (2 levels) in upgrade_model_storage' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/adapters/dm-do-adapter.rb:64:in `map' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/adapters/dm-do-adapter.rb:64:in `block in upgrade_model_storage' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-do-adapter-1d52cea8904d4da687c2fddabd5bf999c94cd21e-master/lib/dm-do-adapter/adapter.rb:260:in `with_connection' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/adapters/dm-do-adapter.rb:63:in `upgrade_model_storage' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/auto_migration.rb:71:in `upgrade_model_storage' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/auto_migration.rb:143:in `auto_upgrade!' from /vault/1/code/ronin/ronin/lib/ronin/model/lazy_upgrade.rb:63:in `auto_upgrade!' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/auto_migration.rb:145:in `auto_upgrade!' from /vault/1/code/ronin/ronin/lib/ronin/model/lazy_upgrade.rb:63:in `auto_upgrade!' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/auto_migration.rb:45:in `block in repository_execute' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-core-37b4bd22b9e3842977cf83d32baba459607e900a-master/lib/dm-core/model/descendant_set.rb:33:in `block in each' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-core-37b4bd22b9e3842977cf83d32baba459607e900a-master/lib/dm-core/model/descendant_set.rb:33:in `each' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-core-37b4bd22b9e3842977cf83d32baba459607e900a-master/lib/dm-core/model/descendant_set.rb:33:in `each' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/auto_migration.rb:44:in `repository_execute' from /home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-migrations-10e2a03514bd272776b61444593ff4b4fe608269-master/lib/dm-migrations/auto_migration.rb:27:in `auto_upgrade!' from /vault/1/code/ronin/ronin/lib/ronin/database/database.rb:190:in `block in upgrade' from /vault/1/code/ronin/ronin/lib/ronin/database/database.rb:189:in `each_key' from /vault/1/code/ronin/ronin/lib/ronin/database/database.rb:189:in `upgrade' from /vault/1/code/ronin/ronin/lib/ronin/database/database.rb:215:in `setup' from /vault/1/code/ronin/ronin/spec/spec_helper.rb:25:in `block (2 levels) in <top (required)>' from /usr/lib/ruby/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/options.rb:146:in `call' from /usr/lib/ruby/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/options.rb:146:in `block in run_examples' from /usr/lib/ruby/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/options.rb:146:in `each' from /usr/lib/ruby/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/options.rb:146:in `run_examples' from /usr/lib/ruby/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run' from /usr/lib/ruby/gems/1.9.1/gems/rspec-1.3.0/bin/spec:5:in `<main>' rake aborted! Command /usr/bin/ruby19 -I"lib:lib:spec" "/usr/lib/ruby/gems/1.9.1/gems/rspec-1.3.0/bin/spec" "spec/author_spec.rb" "spec/os_spec.rb" "spec/installation_spec.rb" "spec/ronin_spec.rb" "spec/ui/command_line/command_spec.rb" "spec/ui/output_spec.rb" "spec/model/has_name_spec.rb" "spec/model/has_description_spec.rb" "spec/model/has_license_spec.rb" "spec/model/model_spec.rb" "spec/model/lazy_upgrade_spec.rb" "spec/license_spec.rb" "spec/platform/overlay_spec.rb" "spec/platform/extension_cache_spec.rb" "spec/platform/overlay_cache_spec.rb" "spec/platform/maintainer_spec.rb" "spec/platform/extension_spec.rb" "spec/platform/cached_file_spec.rb" "spec/platform/platform_spec.rb" "spec/platform/cacheable_spec.rb" "spec/software_spec.rb" "spec/database_spec.rb" "spec/arch_spec.rb" "spec/vendor_spec.rb" "spec/url_spec.rb" --options .specopts failed (See full trace by running task with --trace)
-
Dan Kubb (dkubb) May 28th, 2010 @ 01:27 AM
- Milestone cleared.
- State changed from accepted to confirmed
- Assigned user cleared.
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:
-
The path to the file in the example is not writable on most systems, so SQLite defaults to using an in-memory database. If you specify "sqlite::memory:" you will see the same bug.
-
If you change the path to a writable location, a file will be created, and the bug will not occur.
-
A CREATE TABLE statement is issued, creating the table, then a PRAGMA table_info query runs immediately after and returns no records. That means that the columns created are not seen by the system.
-
Performing an ALTER TABLE statement and adding in a column that already exists will cause an explosion. So even though SQLite does not report any columns in the table, it won't allow you to add them.
-
At first I thought it was a problem with pooling, like maybe one connection would create the table, and the other connection wouldn't see it, because of how in-memory DBs are not sharable across connections. However, I checked the object_id of the Connection objects both when the CREATE TABLE and PRAGMA queries were executed, and they were the same.
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?
-
Postmodern June 2nd, 2010 @ 09:59 PM
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:
~> ronin-web /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:70:in `execute_non_query': duplicate column name: id (DataObjects::SyntaxError) from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:70:in `upgrade_model_storage' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:64:in `map' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:64:in `upgrade_model_storage' from /var/ruby/1.8/gem_home/gems/dm-do-adapter-1.0.0.rc3/lib/dm-do-adapter/adapter.rb:260:in `with_connection' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/adapters/dm-do-adapter.rb:63:in `upgrade_model_storage' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/auto_migration.rb:71:in `upgrade_model_storage' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/auto_migration.rb:143:in `auto_upgrade!' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/model/lazy_upgrade.rb:63:in `auto_upgrade!' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/auto_migration.rb:145:in `auto_upgrade!' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/model/lazy_upgrade.rb:63:in `auto_upgrade!' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/auto_migration.rb:45:in `send' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/auto_migration.rb:45:in `repository_execute' from /var/ruby/1.8/gem_home/gems/dm-core-1.0.0.rc3/lib/dm-core/model/descendant_set.rb:33:in `each' from /var/ruby/1.8/gem_home/gems/dm-core-1.0.0.rc3/lib/dm-core/model/descendant_set.rb:33:in `each' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/auto_migration.rb:44:in `repository_execute' from /var/ruby/1.8/gem_home/gems/dm-migrations-1.0.0.rc3/lib/dm-migrations/auto_migration.rb:27:in `auto_upgrade!' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/database/database.rb:190:in `upgrade' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/database/database.rb:189:in `each_key' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/database/database.rb:189:in `upgrade' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/database/database.rb:215:in `setup' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/environment.rb:37 from /usr/ruby/1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/ruby/1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin.rb:21 from /usr/ruby/1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/ruby/1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/ui/console.rb:171:in `start' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/ui/console.rb:170:in `instance_eval' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/ui/console.rb:170:in `start' from /var/ruby/1.8/gem_home/gems/ronin-0.4.0/lib/ronin/ui/command_line/commands/console.rb:60:in `execute' from /var/ruby/1.8/gem_home/gems/thor-0.13.6/lib/thor/task.rb:33:in `send' from /var/ruby/1.8/gem_home/gems/thor-0.13.6/lib/thor/task.rb:33:in `run' from /var/ruby/1.8/gem_home/gems/thor-0.13.6/lib/thor/invocation.rb:109:in `invoke' from /usr/ruby/1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `map' from /var/ruby/1.8/gem_home/gems/thor-0.13.6/lib/thor/core_ext/ordered_hash.rb:73:in `each' from /var/ruby/1.8/gem_home/gems/thor-0.13.6/lib/thor/invocation.rb:118:in `map' from /var/ruby/1.8/gem_home/gems/thor-0.13.6/lib/thor/invocation.rb:118:in `invoke' from /var/ruby/1.8/gem_home/gems/thor-0.13.6/lib/thor/group.rb:36:in `start' from /var/ruby/1.8/gem_home/gems/thor-0.13.6/lib/thor/base.rb:378:in `start' from /var/ruby/1.8/gem_home/gems/thor-0.13.6/lib/thor/group.rb:29:in `start' from /var/ruby/1.8/gem_home/gems/ronin-web-0.2.2/bin/ronin-web:14 from /var/ruby/1.8/gem_home/bin/ronin-web:19:in `load' from /var/ruby/1.8/gem_home/bin/ronin-web:19
Note: Ronin by default uses the sqlite3 "~/.ronin/database.sqlite3".
-
Postmodern June 2nd, 2010 @ 10:16 PM
- Tag changed from 1.0.0.rc2, auto_upgrade, dm-migrations, sti to 1.0.0.rc2, 1.0.0.rc3, auto_upgrade, dm-migrations, sti
-
Postmodern June 11th, 2010 @ 08:36 PM
I am able to reproduce this bug on JRuby 1.5.1:
$ DEBUG=true rake spec (in /vault/1/code/ronin/ronin) You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install ~ (0.000) SELECT sqlite_version(*) ~ (0.057) CREATE TABLE "ronin_vendors" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "name" VARCHAR(50) NOT NULL) ~ (0.018) CREATE UNIQUE INDEX "unique_ronin_vendors_name" ON "ronin_vendors" ("name") ~ (0.028) CREATE TABLE "ronin_arches" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "name" VARCHAR(50) NOT NULL, "endian" VARCHAR(50) NOT NULL, "address_length" INTEGER NOT NULL) ~ (0.019) CREATE UNIQUE INDEX "unique_ronin_arches_name" ON "ronin_arches" ("name") ~ (0.037) CREATE TABLE "taggings" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "taggable_id" INTEGER NOT NULL, "taggable_type" VARCHAR NOT NULL, "tag_context" VARCHAR(50) NOT NULL, "tag_id" INTEGER NOT NULL) ~ (0.032) CREATE INDEX "index_taggings_tag" ON "taggings" ("tag_id") ~ (0.024) CREATE TABLE "tags" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "name" VARCHAR(50) NOT NULL) ~ (0.024) CREATE UNIQUE INDEX "unique_tags_name" ON "tags" ("name") ~ (0.029) CREATE TABLE "ronin_organizations" ("name" VARCHAR(50) NOT NULL, "description" VARCHAR(65535), "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "created_at" TIMESTAMP NOT NULL, "frozen_tag_list" TEXT) ~ (0.035) CREATE INDEX "index_ronin_organizations_name" ON "ronin_organizations" ("name") ~ (0.031) CREATE TABLE "ronin_addresses" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "type" VARCHAR NOT NULL, "address" VARCHAR(50) NOT NULL, "created_at" TIMESTAMP NOT NULL, "frozen_tag_list" TEXT, "organization_id" INTEGER, "version" INTEGER NOT NULL) ~ (0.037) CREATE INDEX "index_ronin_addresses_organization" ON "ronin_addresses" ("organization_id") ~ (0.032) CREATE UNIQUE INDEX "unique_ronin_addresses_address" ON "ronin_addresses" ("address") ~ (0.000) PRAGMA table_info("ronin_addresses") ~ (0.000) PRAGMA table_info("ronin_addresses") ~ (0.000) PRAGMA table_info("ronin_addresses") ~ (0.000) PRAGMA table_info("ronin_addresses") ~ (0.000) PRAGMA table_info("ronin_addresses") ~ (0.000) PRAGMA table_info("ronin_addresses") ~ (0.000) PRAGMA table_info("ronin_addresses") ~ (0.000) PRAGMA table_info("ronin_addresses") ~ (0.025) CREATE TABLE "ronin_ip_address_mac_addresses" ("created_at" TIMESTAMP NOT NULL, "ip_address_id" INTEGER NOT NULL, "mac_address_id" INTEGER NOT NULL, PRIMARY KEY("ip_address_id", "mac_address_id")) ~ (0.025) CREATE INDEX "index_ronin_ip_address_mac_addresses_ip_address" ON "ronin_ip_address_mac_addresses" ("ip_address_id") ~ (0.030) CREATE INDEX "index_ronin_ip_address_mac_addresses_mac_address" ON "ronin_ip_address_mac_ad/home/hal/.rvm/gems/jruby-1.5.1/gems/dm-migrations-1.0.0/lib/dm-migrations/adapters/dm-do-adapter.rb:64:in `map': duplicate column name: id (code: 0, sql state: , query: , uri: ) (DataObjects::SQLError) from /home/hal/.rvm/gems/jruby-1.5.1/gems/dm-migrations-1.0.0/lib/dm-migrations/adapters/dm-do-adapter.rb:64:in `upgrade_model_storage' from /home/hal/.rvm/gems/jruby-1.5.1/gems/dm-do-adapter-1.0.0/lib/dm-do-adapter/adapter.rb:260:in `with_connection' from /home/hal/.rvm/gems/jruby-1.5.1/gems/dm-migrations-1.0.0/lib/dm-migrations/adapters/dm-do-adapter.rb:63:in `upgrade_model_storage' from /home/hal/.rvm/gems/jruby-1.5.1/gems/dm-migrations-1.0.0/lib/dm-migrations/auto_migration.rb:71:in `upgrade_model_storage' from /home/hal/.rvm/gems/jruby-1.5.1/gems/dm-migrations-1.0.0/lib/dm-migrations/auto_migration.rb:143:in `auto_upgrade!' from /vault/1/code/ronin/ronin/lib/ronin/model/lazy_upgrade.rb:63:in `auto_upgrade!' from /home/hal/.rvm/gems/jruby-1.5.1/gems/dm-migrations-1.0.0/lib/dm-migrations/auto_migratidresses" ("mac_address_id") ~ (0.018) CREATE TABLE "ronin_credentials" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "user" VARCHAR(50), "password" VARCHAR(50)) ~ (0.000) PRAGMA table_info("ronin_credentials") ~ duplicate column name: id (code: 0, sql state: , query: , uri: ) on.rb:145:in `auto_upgrade!' from /vault/1/code/ronin/ronin/lib/ronin/model/lazy_upgrade.rb:63:in `auto_upgrade!' ... 13 levels... from /home/hal/.rvm/gems/jruby-1.5.1/gems/rspec-1.3.0/lib/spec/runner/options.rb:146:in `run_examples' from /home/hal/.rvm/gems/jruby-1.5.1/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run' from /home/hal/.rvm/gems/jruby-1.5.1/gems/rspec-1.3.0/bin/spec:5 rake aborted! Command /home/hal/.rvm/rubies/jruby-1.5.1/bin/jruby -I"lib:lib:spec" "/home/hal/.rvm/gems/jruby-1.5.1/gems/rspec-1.3.0/bin/spec" "spec/installation_spec.rb" "spec/vendor_spec.rb" "spec/arch_spec.rb" "spec/os_spec.rb" "spec/database_spec.rb" "spec/license_spec.rb" "spec/author_spec.rb" "spec/software_spec.rb" "spec/url_spec.rb" "spec/ronin_spec.rb" "spec/ui/output_spec.rb" "spec/ui/command_line/command_spec.rb" "spec/model/model_spec.rb" "spec/model/lazy_upgrade_spec.rb" "spec/model/has_name_spec.rb" "spec/model/has_description_spec.rb" "spec/model/has_license_spec.rb" "spec/platform/cacheable_spec.rb" "spec/platform/extension_cache_spec.rb" "spec/platform/overlay_spec.rb" "spec/platform/maintainer_spec.rb" "spec/platform/overlay_cache_spec.rb" "spec/platform/extension_spec.rb" "spec/platform/platform_spec.rb" "spec/platform/cached_file_spec.rb" --options .specopts failed (See full trace by running task with --trace)
-
agnieszka.figiel July 1st, 2011 @ 02:17 AM
- Milestone order changed from 0 to 0
I'm still seeing this in 1.1.0 + sqlite3 gem 1.3.3 + SQLite version 3.6.22
- when it is first invoked it actually does create the database file + structure, but finishes with the error (related to the 'ALTER' statement on the STI table as mentioned above): duplicate column name: id
- a subsequent call when there are no changes to the db completes without an error
- when a new property is specified on the STI table, db:autoupgrade adds it and then fails again while trying to issue another ALTER statement on this new column
$ rake db:autoupgrade RAILS_ENV=test --trace ** Invoke db:autoupgrade (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:autoupgrade rake aborted! duplicate column name: id /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:70:in `execute_non_query' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:70:in `upgrade_model_storage' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `map' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/subject_set.rb:212:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/ordered_set.rb:321:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/ordered_set.rb:321:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/subject_set.rb:212:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:64:in `map' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:64:in `upgrade_model_storage' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:276:in `with_connection' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:63:in `upgrade_model_storage' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:71:in `upgrade_model_storage' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:143:in `auto_upgrade!' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:145:in `auto_upgrade!' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:45:in `send' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:45:in `repository_execute' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/descendant_set.rb:67:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/descendant_set.rb:66:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/subject_set.rb:212:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/ordered_set.rb:321:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/ordered_set.rb:321:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/subject_set.rb:212:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/descendant_set.rb:65:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/descendant_set.rb:67:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/subject_set.rb:212:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/ordered_set.rb:321:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/ordered_set.rb:321:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/subject_set.rb:212:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-core-1.1.0/lib/dm-core/support/descendant_set.rb:65:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:44:in `repository_execute' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:27:in `auto_upgrade!' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-rails-1.1.0/lib/dm-rails/railties/database.rake:47 /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-rails-1.1.0/lib/dm-rails/railties/database.rake:46:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/dm-rails-1.1.0/lib/dm-rails/railties/database.rake:46 /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:636:in `call' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:636:in `execute' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:631:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:631:in `execute' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' /home/agnessa/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/monitor.rb:242:in `synchronize' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:2029:in `each' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:2001:in `run' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/lib/rake.rb:1998:in `run' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.8.7/bin/rake:31 /home/agnessa/.rvm/gems/ruby-1.8.7-p330/bin/rake:19:in `load' /home/agnessa/.rvm/gems/ruby-1.8.7-p330/bin/rake:19
-
Piotr Solnica (solnic) July 1st, 2011 @ 03:40 AM
we moved tickets to github: https://github.com/datamapper/dm-migrations/issues/25
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »