1

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.

Kevin Smith
  • 731
  • 2
  • 7
  • 21
  • https://github.com/AimalAzmi/codeigniter-migrations Try this, I've written a library for this which can be used very easily through the CLI. It can be used to create migrations files and run migrations backwards or forwards. – Aimal Azmi Nov 21 '17 at 10:41

1 Answers1

2

(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

John Conde
  • 217,595
  • 99
  • 455
  • 496
  • Thank you for the edit of tags for my post. Any idea how this could be accomplished inside of the CI migrations so that I as a user don't have to go in and change it manually just in case I pass this off as a project for testing on another server? – Kevin Smith Jan 19 '13 at 01:04
  • I just looked through the documentation and didn't see a method to do this. I'm wondering if this would require running a regular query to work? – John Conde Jan 19 '13 at 01:10
  • I mean I could but now I'm interested in seeing if it does allow you to somehow. – Kevin Smith Jan 19 '13 at 01:11