Page MenuHomeDevCentral

D379.id904.diff
No OneTemporary

D379.id904.diff

diff --git a/database/migrations/2016_05_21_224200_set_users_table_auto_increment.php b/database/migrations/2016_05_21_224200_set_users_table_auto_increment.php
new file mode 100644
--- /dev/null
+++ b/database/migrations/2016_05_21_224200_set_users_table_auto_increment.php
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+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/plain
Expires
Sun, Nov 17, 16:19 (21 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249511
Default Alt Text
D379.id904.diff (1 KB)

Event Timeline