14 use Illuminate\Database\Migrations\Migration;
15 use Illuminate\Database\Schema\Builder;
16 use Illuminate\Database\Schema\Blueprint;
17 use Illuminate\Database\Capsule\Manager as Capsule;
24 public function up() {
26 Capsule::schema()->rename(
'section_editors',
'subeditor_submission_group');
27 Capsule::schema()->table(
'subeditor_submission_group',
function (Blueprint $table) {
29 $table->bigInteger(
'assoc_type');
30 $table->renameColumn(
'section_id',
'assoc_id');
33 $table->dropIndex(
'section_editors_pkey');
34 $table->dropIndex(
'section_editors_context_id');
35 $table->dropIndex(
'section_editors_section_id');
36 $table->dropIndex(
'section_editors_user_id');
39 $table->index([
'context_id'],
'section_editors_context_id');
40 $table->index([
'assoc_id',
'assoc_type'],
'subeditor_submission_group_assoc_id');
41 $table->index([
'user_id'],
'subeditor_submission_group_user_id');
42 $table->unique([
'context_id',
'assoc_id',
'assoc_type',
'user_id'],
'section_editors_pkey');
46 Capsule::table(
'subeditor_submission_group')->update([
'assoc_type' => ASSOC_TYPE_SECTION]);