Search code examples
phpmysqlsqlcodeigniterauto-increment

Migrations Inside of Codeigniter


Earlier today I signed up for a nettuts plus account and have been watching this series on codeigniter cms building. I am creating a migration file to create my users table. With my user ids I prefer to work with user ids that look like this 10000 and increment to 10001 for the next inserted user. What I'm trying to figure out was how do I setup so that when it creates the users table then to have the key start at 10000

https://tutsplus.com/course/build-a-cms-in-codeigniter/

After looking around I am not able to find out how to accomplish this. If anyone knows please help me out.


Solution

  • (I didn't watch the videos). After you create your table run this SQL:

    ALTER TABLE tablename AUTO_INCREMENT = 10000;
    

    Change tablename to the table name