-
Notifications
You must be signed in to change notification settings - Fork 288
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Given the following contents of draft.yaml
:
models:
Company:
name: string
relationships:
belongsToMany: Person
Person:
name: string
relationships:
belongsToMany: Company
Generates:
- database/migrations/2020_05_01_144405_create_companies_table.php
- database/migrations/2020_05_01_144405_create_company_person_table.php
- database/migrations/2020_05_01_144406_create_people_table.php
- database/migrations/2020_05_01_144406_create_company_person_table.php
- app/Company.php
- app/Person.php
- database/factories/CompanyFactory.php
- database/factories/PersonFactory.php
Observe that there are 2 migrations for the same pivot table.
Inspecting the two, we find a declaration with the same Class name: CreateCompanyPersonTable
. This, of course, is a problem.
PHP Fatal error: Cannot declare class CreateCompanyPersonTable, because the name is already in use in /Users/joostjacobs/Code/blueprint/database/migrations/2020_05_01_144406_create_company_person_table.php on line 7
Inspecting the two migrations, the only observable difference is the order in which the columns appear in the schema:
Inside database/migrations/2020_05_01_144405_create_company_person_table.php
:
public function up()
{
Schema::create('company_person', function (Blueprint $table) {
$table->unsignedBigInteger('company_id');
$table->unsignedBigInteger('person_id');
});
}
Inside database/migrations/2020_05_01_144406_create_company_person_table.php
:
public function up()
{
Schema::create('company_person', function (Blueprint $table) {
$table->unsignedBigInteger('person_id');
$table->unsignedBigInteger('company_id');
});
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers