Set photos_id_seq properly for PostgreSQL (re: recent "MovePhotosToTheirOwnTable" migration, which neglected to do this).

This commit is contained in:
Pistos 2011-10-18 21:57:15 -04:00
parent 924e18887a
commit 474ccc9fc4

View file

@ -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