From 8d8058dea0de6fbad4068a8cefcb8b5543b57861 Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Fri, 18 Oct 2013 22:57:10 -0400 Subject: [PATCH] Comment for bike brands sql insert issue --- db/seeds.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index 4704bf4..2d77169 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -14,6 +14,8 @@ end #Load bike brands and models from sql if BikeBrand.all.empty? and BikeModel.all.empty? + # Need to use DEFAULT instead of explicit IDs that are used in the sql file, + # so that the PG table ID sequence is incremented load_statements = File.readlines(File.join(Rails.root, 'db', 'seed', 'sql', 'bike_brands_and_models.sql')).drop(1).map do |statement| statement.sub(/VALUES\(\d+,/, 'VALUES(DEFAULT,').tap {|x| puts x } end