Symfony + Propel AUTO_INCREMENT offset

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.

Related posts:

  1. Symfony – No package found for database “” in generated-schema.xml
  2. PropelException: No connection params set for propel
  3. Upgrading from 2.4.27 to 2.6.11 on Debian

4 comments

  1. Kiril Angov says:

    thank you!

  2. Paul Burdon says:

    Great post, simple and solved a real PITA thanks,

  3. Paul Burdon says:

    just upgraded to propel 1.5 and this stopped working. Argghhhhh!

    Anyone ideas how this might be fixed?

  4. Paul Burdon says:

    sorry, it wasn’t broken but it doesn’t work if I do
    ./symfony propel:data-load
    only if I do ./symfony propel:build-all-load

    As I don’t understand what goes on in these things can’t offer any insight as to how we might do this with data-load only.

Leave a Reply

Your email address will not be published. Required fields are marked *

*