Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update migration.stub #571

Merged
merged 3 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/Generators/MigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ protected function createMigrations(array $tables, $overwrite = false): array

protected function populateStub(string $stub, Model $model)
{
$stub = str_replace('{{ class }}', $this->getClassName($model), $stub);
$stub = str_replace('{{ table }}', $model->tableName(), $stub);
$stub = str_replace('{{ definition }}', $this->buildDefinition($model), $stub);

Expand All @@ -123,7 +122,6 @@ protected function populateStub(string $stub, Model $model)

protected function populatePivotStub(string $stub, array $segments)
{
$stub = str_replace('{{ class }}', $this->getPivotClassName($segments), $stub);
$stub = str_replace('{{ table }}', $this->getPivotTableName($segments), $stub);
$stub = str_replace('{{ definition }}', $this->buildPivotTableDefinition($segments), $stub);

Expand All @@ -136,7 +134,6 @@ protected function populatePivotStub(string $stub, array $segments)

protected function populatePolyStub(string $stub, string $parentTable)
{
$stub = str_replace('{{ class }}', $this->getPolyClassName($parentTable), $stub);
$stub = str_replace('{{ table }}', $this->getPolyTableName($parentTable), $stub);
$stub = str_replace('{{ definition }}', $this->buildPolyTableDefinition($parentTable), $stub);

Expand Down
4 changes: 2 additions & 2 deletions stubs/migration.stub
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class {{ class }} extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -27,4 +27,4 @@ class {{ class }} extends Migration
{
Schema::dropIfExists('{{ table }}');
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCompaniesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
{
Schema::dropIfExists('companies');
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePeopleTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
{
Schema::dropIfExists('people');
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCompanyPersonTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -28,4 +28,4 @@ public function down()
{
Schema::dropIfExists('company_person');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/belongs-to-many-key-constraints.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateJourneysTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -34,4 +34,4 @@ public function down()
{
Schema::dropIfExists('journeys');
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDiaryJourneyTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -32,4 +32,4 @@ public function down()
{
Schema::dropIfExists('diary_journey');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/belongs-to-many-pivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDiaryJourneyTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -28,4 +28,4 @@ public function down()
{
Schema::dropIfExists('diary_journey');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/belongs-to-many.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateJourneysTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,4 +30,4 @@ public function down()
{
Schema::dropIfExists('journeys');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/boolean-column-default.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePostsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -34,4 +34,4 @@ public function down()
{
Schema::dropIfExists('posts');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/columns-with-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProfessionsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,4 +30,4 @@ public function down()
{
Schema::dropIfExists('professions');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCommentsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
{
Schema::dropIfExists('comments');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/custom-indexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCooltablesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -33,4 +33,4 @@ public function down()
{
Schema::dropIfExists('cooltables');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/custom-pivot-table-name-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTestTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -28,4 +28,4 @@ public function down()
{
Schema::dropIfExists('test');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/custom-pivot-table-name-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,4 +30,4 @@ public function down()
{
Schema::dropIfExists('users');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/disable-auto-columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStatesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
{
Schema::dropIfExists('states');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/enum-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMessagesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,4 +30,4 @@ public function down()
{
Schema::dropIfExists('messages');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/foreign-key-on-delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCommentsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -37,4 +37,4 @@ public function down()
{
Schema::dropIfExists('comments');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/foreign-key-shorthand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCommentsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -35,4 +35,4 @@ public function down()
{
Schema::dropIfExists('comments');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/foreign-with-class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateEventsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -34,4 +34,4 @@ public function down()
{
Schema::dropIfExists('events');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/full-text.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePostsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,4 +30,4 @@ public function down()
{
Schema::dropIfExists('posts');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/identity-columns-big-increments.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRelationshipsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
{
Schema::dropIfExists('relationships');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/identity-columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRelationshipsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -29,4 +29,4 @@ public function down()
{
Schema::dropIfExists('relationships');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/indexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePostsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -40,4 +40,4 @@ public function down()
{
Schema::dropIfExists('posts');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/model-key-constraints.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrdersTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -37,4 +37,4 @@ public function down()
{
Schema::dropIfExists('orders');
}
}
};
4 changes: 2 additions & 2 deletions tests/fixtures/migrations/model-modifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateModifiersTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -36,4 +36,4 @@ public function down()
{
Schema::dropIfExists('modifiers');
}
}
};
Loading