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

Refactoring Table Removal Order in Migrations #2

Open
herculanosilva opened this issue Jan 11, 2024 · 0 comments
Open

Refactoring Table Removal Order in Migrations #2

herculanosilva opened this issue Jan 11, 2024 · 0 comments

Comments

@herculanosilva
Copy link

Upon reviewing the migration logic, it became apparent that we were initially attempting to drop the 'team_user' table, which has a foreign key referencing the 'teams' table. This order was leading to conflicts during the refresh execution.

In the proposed solution, we reversed the removal order, deleting the 'team_user' table first before 'teams'. This ensures there are no foreign key violations during the database update process.

This change aims to enhance the robustness of the migration process by providing a more logical and secure order for table removal, minimizing potential issues during database refresh.

public function down(): void
{
    Schema::dropIfExists('team_user');
    Schema::dropIfExists('team');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant