Skip to content

Restore the pruned database migration files - #1252

Open
outdooracorn wants to merge 1 commit into
mainfrom
ollie-restore-database-migrations
Open

outdooracorn wants to merge 1 commit into
mainfrom
ollie-restore-database-migrations

Conversation

@outdooracorn

@outdooracorn outdooracorn commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Restore the pruned database migration files to make discovery of past migrations easier. The generated schema file will still be used on installs where no migrations have been executed.

In 1cd71f4, the php artisan schema:dump --prune command was run, to squash database migrations into a schema file1. This was done as part of the Laravel 10.x -> 11.x migration, in order to avoid having to update any existing migrations that use the ->change() method2.

The --prune option removes all existing migrations that are squashed into the schema file. This option is not required by the 11.x migration docs2, and makes it harder to view historical migrations.

From the Laravel 11.x docs on Squashing Migrations1:

Now, when you attempt to migrate your database and no other migrations have been executed, Laravel will first execute the SQL statements in the schema file of the database connection you are using. After executing the schema file's SQL statements, Laravel will execute any remaining migrations that were not part of the schema dump.

Therefore, this only has an impact on local development/CI, and there is no issue with having both the migration and schema files present in the repo.

Bug: T440599

@outdooracorn outdooracorn self-assigned this Sep 20, 2026
@outdooracorn
outdooracorn added this pull request to stack #1254 September 20, 2026 11:28
@outdooracorn
outdooracorn removed this pull request from stack #1254 September 21, 2026 03:49
@outdooracorn
outdooracorn added this pull request to stack #1259 September 21, 2026 03:50
@outdooracorn
outdooracorn force-pushed the ollie-restore-database-migrations branch from b4015d1 to 29c90c1 Compare October 8, 2026 14:59
Restore the pruned database migration files to make discovery of past migrations easier. The generated schema file will still be used on installs where no migrations have been executed.

In 1cd71f4, the `php artisan schema:dump --prune` command was run, to squash database migrations into a schema file[1]. This was done as part of the Laravel 10.x -> 11.x migration, in order to avoid having to update any existing migrations that use the `->change()` method[2].
The `--prune` option removes all existing migrations that are squashed into the schema file. This option is not required by the 11.x migration docs[2], and makes it harder to view historical migrations.

From the Laravel 11.x docs on Squashing Migrations[1]:

> Now, when you attempt to migrate your database and no other migrations have been executed, Laravel will first execute the SQL statements in the schema file of the database connection you are using. After executing the schema file's SQL statements, Laravel will execute any remaining migrations that were not part of the schema dump.

Therefore, this only has an impact on local development/CI, and there is no issue with having both the migration and schema files present in the repo.

[1]: https://laravel.com/framework/docs/11.x/migrations#squashing-migrations
[2]: https://laravel.com/framework/docs/11.x/upgrade#modifying-columns

Bug: T440599
@outdooracorn
outdooracorn force-pushed the ollie-restore-database-migrations branch from 29c90c1 to 3e923b9 Compare October 8, 2026 15:01

@deer-wmde deer-wmde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it with minikube and skaffold and did spot a INFO Nothing to migrate. in the logs ✔️

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

Successfully merging this pull request may close these issues.

2 participants