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

[11.x] Fix SQLite schema dumps containing internal sqlite_* objects #52135

Merged

Conversation

bakerkretzmar
Copy link
Contributor

This PR updates the SQLite schema dump to remove all CREATE TABLE sqlite_* statements. Laravel already removes CREATE TABLE sqlite_sequence(...); if it exists, this PR ensures that we also remove CREATE TABLE sqlite_stat1(...);, CREATE TABLE sqlite_stat4(...);, etc.

These SQLite internal schema object names are reserved and cannot be created except by SQLite itself, so trying to loading dumps that contain any of these statements will fail. The sqlite_stat1 and sqlite_stat4 tables will exist in any SQLite database with data in it that has ever had the PRAGMA optimize; command run, which is likely a significant portion of them since it's recommended in the SQLite docs. There may be other tables with reserved names too, like sqlite_stat2 or sqlite_autoindex_1; this PR ensures they are all removed.

Fixes #52131.

@bakerkretzmar
Copy link
Contributor Author

Looks like the Windows actions runners don't have SQLite installed, not sure what it would look like to add it but I can try, or we can skip that test on Windows?

@taylorotwell taylorotwell merged commit 094d4eb into laravel:11.x Jul 15, 2024
22 of 30 checks passed
@bakerkretzmar bakerkretzmar deleted the sqlite-internal-schema-objects branch July 18, 2024 16:05
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.

artisan schema:dump includes internal sqlite_* tables in SQLite dumps, making them unusable
2 participants