1
0
mirror of https://github.com/fspc/BikeShed-1.git synced 2025-02-28 16:53:23 -05:00

Comment for bike brands sql insert issue

This commit is contained in:
Jason Denney 2013-10-18 22:57:10 -04:00
parent 93b8e3b055
commit 8d8058dea0

View File

@ -14,6 +14,8 @@ end
#Load bike brands and models from sql #Load bike brands and models from sql
if BikeBrand.all.empty? and BikeModel.all.empty? 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| 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 } statement.sub(/VALUES\(\d+,/, 'VALUES(DEFAULT,').tap {|x| puts x }
end end