diff --git a/db/migrate/20111019013244_postgresql_photos_id_seq_init.rb b/db/migrate/20111019013244_postgresql_photos_id_seq_init.rb new file mode 100644 index 000000000..e0c1cb6e1 --- /dev/null +++ b/db/migrate/20111019013244_postgresql_photos_id_seq_init.rb @@ -0,0 +1,11 @@ +class PostgresqlPhotosIdSeqInit < ActiveRecord::Migration + def self.up + if postgres? + execute "SELECT setval('photos_id_seq', COALESCE( ( SELECT MAX(id)+1 FROM photos ), 1 ) )" + end + end + + def self.down + # No reason or need to migrate this down. + end +end