Page MenuHomeDevCentral

2016_05_21_224200_set_users_table_auto_increment.php
No OneTemporary

2016_05_21_224200_set_users_table_auto_increment.php

<?php
use Illuminate\Database\Migrations\Migration;
class SetUsersTableAutoIncrement extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// See https://secure.phabricator.com/book/phabflavor/article/things_you_should_do_now/#start-ids-at-a-gigantic
$sql = "ALTER TABLE users AUTO_INCREMENT = 1000000000";
DB::unprepared($sql);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$maxId = (int)DB::table('users')->max('id');
$sql = "ALTER TABLE users AUTO_INCREMENT = " . ++$maxId;
DB::unprepared($sql);
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, May 3, 06:33 (22 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3659962
Default Alt Text
2016_05_21_224200_set_users_table_auto_increment.php (695 B)

Event Timeline