Welcome Guest, Not a member yet? Register   Sign In
Setting start value for auto increment field with ci migrations

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


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


My fault I'm trying to figure out how to accomplish this with migrations.

Does anybody know?

Just run the ALTER TABLE query using $this->db->query().

Inside the migrations file?

Is this how?

In the 8 1/2 hours in between those two posts, you couldn't just TRY it? Yes in the migrations file; you asked about migrations after all...

It works but I was curious as to why when you set the primary key you can't tell it to start at 10000 when you set the key.

You can if you write the query yourself. CI does not have that feature. If you think it should be added, bring it up on Github.

Theme © iAndrew 2016 - Forum software by © MyBB