rake db:seed exception
SQLite3::SQLException: PRIMARY KEY must be unique: INSERT INTO "option_types" ("name", "updated_at", "id", "presentation", "created_at") VALUES ('subscription-interval', '2009-12-28 22:46:36', 432467915, 'Interval', '2009-12-28 22:46:36')
I am running "rake db:bootstrap" and I get that. Any ideas? It happens when loading the fixtures.
I'm using Spree gem version 0.9.99, and I'm note sure if this is a regression
http://railsdog.lighthouseapp.com/projects/31096/tickets/744-problems-with-dbbootstrap-in-0899
Here is the full output, after the migrations:
loading fixture /Users/Lance/Documents/Development/git/spree/db/default/zones.yml
loading fixture /Users/Lance/Documents/Development/git/spree/db/default/roles.yml
loading fixture /Users/Lance/Documents/Development/git/spree/vendor/extensions/subscriptions/db/default/option_types.yml
loading fixture /Users/Lance/Documents/Development/git/spree/vendor/extensions/subscriptions/db/default/option_values.yml
loading fixture /Users/Lance/Documents/Development/git/spree/db/default/states.yml
loading fixture /Users/Lance/Documents/Development/git/spree/db/default/countries.yml
loading fixture /Users/Lance/Documents/Development/git/spree/db/default/zone_members.yml
Default data has been loaded
Loading db/seeds.rb for each extension
=========/Users/Lance/Documents/Development/git/spree/vendor/extensions/subscriptions/db/default
loading fixtures from /Users/Lance/Documents/Development/git/spree/vendor/extensions/subscriptions/db/default
rake aborted!
SQLite3::SQLException: PRIMARY KEY must be unique: INSERT INTO "option_types" ("name", "updated_at", "id", "presentation", "created_at") VALUES ('subscription-interval', '2009-12-28 22:46:36', 432467915, 'Interval', '2009-12-28 22:46:36')
I think we might not even need that in the extension, it looks like spree is figuring it out on it's own.
I added this:
def yaml_to_database(fixture, path)
ActiveRecord::Base.establish_connection(RAILS_ENV)
tables = Dir.new(path).entries.select{|e| e =~ /(.+)?\.yml/}.collect{|c| c.split('.').first}
begin
Fixtures.create_fixtures(path, tables)
rescue Exception => e
puts 'problem loading fixtures from subscriptions extension'
end
end
And it's basically skipping everything because they were already loaded.