[12.x] Configure connection on SQLite connector #54588
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR moves the connection configurations logic from the
SQLiteConnection
class to theSQLiteConnector
class, following the pattern of other database drivers. SQLite was the only DB driver that configured its connection in theConnection
class instead of theConnector
class. As part of this change, redundantBuilder
andGrammar
methods have been removed. There are manypragma
key/value pairs, so it doesn't make sense to have a method in both classes for eachpragma
key/value (added recently on #52052).Why?
Since using multiple schemas in PostgreSQL and running test suites in SQLite is a common scenario, this PR allows us to support attaching databases in SQLite in the future without introducing a BC-breaking change.
Summary
SQLiteConnection
class to theSQLiteConnector
class to be consistent with other DB drivers.Schema::connection('sqlite')->pragma($key, $value = null)
method to get/set a pragma value.Schema::pragma('schema_name.journal_mode', 'wal')
SQLiteGrammar::compileSetBusyTimeout()
,compileSetJournalMode()
,compileSetSynchronous()
,compileEnableWriteableSchema()
, andcompileDisableWriteableSchema()
methods.SQLiteBuilder::setBusyTimeout()
,setJournalMode()
, andsetSynchronous()
methods:Schema::setBusyTimeout(12345)
->Schema::pragma('busy_timeout', 12345)
Schema::setJournalMode('wal')
->Schema::pragma('journal_mode', 'wal')
Schema::setSynchronous('normal')
->Schema::pragma('synchronous', 'normal')