mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
feat(core): Add an option to enable WAL mode for SQLite (#7118)
https://www.sqlite.org/wal.html
This commit is contained in:
parent
67aaad15eb
commit
1d1a022def
|
@ -164,6 +164,12 @@ export const schema = {
|
||||||
default: 'database.sqlite',
|
default: 'database.sqlite',
|
||||||
env: 'DB_SQLITE_DATABASE',
|
env: 'DB_SQLITE_DATABASE',
|
||||||
},
|
},
|
||||||
|
enableWAL: {
|
||||||
|
doc: 'Enable SQLite WAL mode',
|
||||||
|
format: Boolean,
|
||||||
|
default: false,
|
||||||
|
env: 'DB_SQLITE_ENABLE_WAL',
|
||||||
|
},
|
||||||
executeVacuumOnStartup: {
|
executeVacuumOnStartup: {
|
||||||
doc: 'Runs VACUUM operation on startup to rebuild the database. Reduces filesize and optimizes indexes. WARNING: This is a long running blocking operation. Will increase start-up time.',
|
doc: 'Runs VACUUM operation on startup to rebuild the database. Reduces filesize and optimizes indexes. WARNING: This is a long running blocking operation. Will increase start-up time.',
|
||||||
format: Boolean,
|
format: Boolean,
|
||||||
|
|
|
@ -24,6 +24,7 @@ const getDBConnectionOptions = (dbType: DatabaseType) => {
|
||||||
UserSettings.getUserN8nFolderPath(),
|
UserSettings.getUserN8nFolderPath(),
|
||||||
config.getEnv('database.sqlite.database'),
|
config.getEnv('database.sqlite.database'),
|
||||||
),
|
),
|
||||||
|
enableWAL: config.getEnv('database.sqlite.enableWAL'),
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
database: config.getEnv(`database.${configDBType}.database`),
|
database: config.getEnv(`database.${configDBType}.database`),
|
||||||
|
|
|
@ -576,7 +576,7 @@ export async function getVariableById(id: string) {
|
||||||
* Generate options for an in-memory sqlite database connection,
|
* Generate options for an in-memory sqlite database connection,
|
||||||
* one per test suite run.
|
* one per test suite run.
|
||||||
*/
|
*/
|
||||||
export const getSqliteOptions = ({ name }: { name: string }): ConnectionOptions => {
|
const getSqliteOptions = ({ name }: { name: string }): ConnectionOptions => {
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
type: 'sqlite',
|
type: 'sqlite',
|
||||||
|
@ -586,6 +586,7 @@ export const getSqliteOptions = ({ name }: { name: string }): ConnectionOptions
|
||||||
migrations: sqliteMigrations,
|
migrations: sqliteMigrations,
|
||||||
migrationsTableName: 'migrations',
|
migrationsTableName: 'migrations',
|
||||||
migrationsRun: false,
|
migrationsRun: false,
|
||||||
|
enableWAL: config.getEnv('database.sqlite.enableWAL'),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue