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

feat(core): Add an option to enable WAL mode for SQLite #7118

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/cli/src/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ export const schema = {
default: 'database.sqlite',
env: 'DB_SQLITE_DATABASE',
},
enableWAL: {
doc: 'Enable SQLite WAL mode',
format: Boolean,
default: false,
env: 'DB_SQLITE_ENABLE_WAL',
},
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.',
format: Boolean,
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/databases/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const getDBConnectionOptions = (dbType: DatabaseType) => {
UserSettings.getUserN8nFolderPath(),
config.getEnv('database.sqlite.database'),
),
enableWAL: config.getEnv('database.sqlite.enableWAL'),
}
: {
database: config.getEnv(`database.${configDBType}.database`),
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/integration/shared/testDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ export async function getVariableById(id: string) {
* Generate options for an in-memory sqlite database connection,
* one per test suite run.
*/
export const getSqliteOptions = ({ name }: { name: string }): ConnectionOptions => {
const getSqliteOptions = ({ name }: { name: string }): ConnectionOptions => {
return {
name,
type: 'sqlite',
Expand All @@ -586,6 +586,7 @@ export const getSqliteOptions = ({ name }: { name: string }): ConnectionOptions
migrations: sqliteMigrations,
migrationsTableName: 'migrations',
migrationsRun: false,
enableWAL: config.getEnv('database.sqlite.enableWAL'),
};
};

Expand Down
Loading