return new DatabaseConfig(
connections: [
'main' => new SQLiteConnection(
path: 'database.sqlite'
),
'backup' => new MysqlConnection(
// …
),
// …
]
);
We'd change the name of the interface Driver to Connection, I think that makes more sense anyway.
By default, the first registered connection is used. However, users can manually switch their connection:
(new Query($sql))->connection('backup')->execute();
We'd need to consider whether we want the DatabaseModel trait to allow for connection switching on per-model basis. That's up for debate, although I lean more towards no.
How about we change our database config like so?
We'd change the name of the interface
Driver
toConnection
, I think that makes more sense anyway.By default, the first registered connection is used. However, users can manually switch their connection:
We'd need to consider whether we want the
DatabaseModel
trait to allow for connection switching on per-model basis. That's up for debate, although I lean more towards no.