Postgresql autoincrement in migration

Hi
I have a migration to be created with id start from say 100 for
example.That is not from 1
So I tried like

create_table :problems, :options => “auto_increment = 100” do |t|
t.column :title, :text
------
end

 I am using postgres .But the above auto_increment is mysql syntax i

think(Am I right?).And is not working also.How can I change that to get
the result?Please help

Sijo

On Wed, 2008-08-06 at 14:37 +0200, Sijo Kg wrote:

 I am using postgres .But the above auto_increment is mysql syntax i

think(Am I right?).And is not working also.How can I change that to get
the result?Please help


you can’t do it like that, but you can do something like this…

create_table :problems, do |t|
t.column :title, :text
------
end

execute ‘ALTER SEQUENCE db.problems_id_seq RESTART WITH 100;’

Craig

Hi
Thanks for the reply
Sijo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs