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

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

Closed
bakerkretzmar opened this issue Jul 15, 2024 · 0 comments · Fixed by #52135

Comments

@bakerkretzmar
Copy link
Contributor

bakerkretzmar commented Jul 15, 2024

Laravel Version

11.15.0

PHP Version

8.3.7

Database Driver & Version

SQLite 3.46.0

Description

SQLite schema dumps generated using Laravel's schema:dump command include CREATE TABLE statements for SQLite's internal schema objects, like sqlite_stat1, sqlite_stat4, etc.

"Application" code (anything external to SQLite itself) is not allowed to create these tables, so dumps that include these statements always error.

A fix for this should hopefully be as simple as excluding those tables from the dump, and I'll try that and submit a PR to fix this.

Steps To Reproduce

Reproduction: bakerkretzmar/sqlite-internal-schema-objects@3783563

  • Create a SQLite database containing any data.
  • Run the pragma optimize; command in the SQLite shell or with DB:statement('pragma optimize;').
  • Run php artisan schema:dump --prune.
  • Attempt to load the generated schema, for example by running tests that migrate the database.

The load command fails with an error like:

Parse error near line 15: object name reserved for internal use: sqlite_stat1
Parse error near line 16: object name reserved for internal use: sqlite_stat4
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 a pull request may close this issue.

1 participant