my life

day to day

Archive for September 28th, 2007

Symfony + Propel AUTO_INCREMENT offset

Friday, September 28th, 2007

There’s no way to natively setup the starting offset for AUTO_INCREMENT columns in propel. Ideally, you would just set autoIncrement=”100000″ for an offset of 100000, but unfortunately they expect a boolean argument. To get around this, edit data/sql/sqldb.map and add an entry contrib.sql=propel and edit a file in data/sql/contrib.sql.

Add the following to the file:

ALTER TABLE example_table_1 AUTO_INCREMENT = 100000; ALTER TABLE example_table_2 AUTO_INCREMENT = 100000;

Then rerunĀ 
symfony propel-insert-sql
. WARNING: this will ofcourse dump ALL of your data.

add to del.icio.us    add to technorati favs   email this