Added MariaDB -> SQLite conversion utility.
This commit is contained in:
parent
c537df792e
commit
eae379e933
6 changed files with 82 additions and 18 deletions
SharpChat.SQLite
|
@ -22,21 +22,22 @@ public class SQLiteStorage(ILogger logger, string connString) : Storage, IDispos
|
|||
await new SQLiteMigrations(logger, Connection).RunMigrations();
|
||||
}
|
||||
|
||||
public static string BuildConnectionString(Config config) {
|
||||
public static string BuildConnectionString(Config config, bool journalling = true) {
|
||||
return BuildConnectionString(
|
||||
config.ReadValue("path", DEFAULT)!,
|
||||
config.ReadValue("pass")
|
||||
config.ReadValue("pass"),
|
||||
config.ReadValue("journal", journalling)
|
||||
);
|
||||
}
|
||||
|
||||
public static string BuildConnectionString(string path, string? password) {
|
||||
public static string BuildConnectionString(string path, string? password, bool journalling = true) {
|
||||
return new SQLiteConnectionStringBuilder {
|
||||
DataSource = string.IsNullOrWhiteSpace(path) ? MEMORY : path,
|
||||
DateTimeFormat = SQLiteDateFormats.ISO8601,
|
||||
DateTimeKind = DateTimeKind.Utc,
|
||||
FailIfMissing = false,
|
||||
ForeignKeys = true,
|
||||
JournalMode = SQLiteJournalModeEnum.Wal,
|
||||
JournalMode = journalling ? SQLiteJournalModeEnum.Wal : SQLiteJournalModeEnum.Off,
|
||||
LegacyFormat = false,
|
||||
Password = string.IsNullOrWhiteSpace(password) ? null : password,
|
||||
ReadOnly = false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue