diff --git a/database/migrations/2021_05_01_151109_alter_primary_key_on_words_table.php b/database/migrations/2021_05_01_151109_alter_primary_key_on_words_table.php new file mode 100644 index 0000000..5855554 --- /dev/null +++ b/database/migrations/2021_05_01_151109_alter_primary_key_on_words_table.php @@ -0,0 +1,47 @@ +dropColumn('id'); + }); + + Schema::table('words', function (Blueprint $table) { + $table->bigIncrements('id')->first(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('words', function (Blueprint $table) { + $table->dropColumn('id'); + }); + + /** + * @NOTE: The below does not work if data is in the table. + * The IDs will need to be recreated and then + * the primary key index can be re-added. Given that our DB gets repopulated + * on import commands, we can handle that later, OR truncate the table, add the + * primary key index, and then re-run the imports. Baker's choice. + */ + Schema::table('words', function (Blueprint $table) { + $table->string('id')->primary()->first(); + }); + } +}