first commit
This commit is contained in:
commit
3c0479faf0
169 files changed
+27617
No files matched your search
@@ -0,0 +1,66 @@
|
||||
import env from '#start/env'
|
||||
import app from '@adonisjs/core/services/app'
|
||||
import { defineConfig } from '@adonisjs/lucid'
|
||||
|
||||
const dbConfig = defineConfig({
|
||||
/**
|
||||
* Default connection used for all queries.
|
||||
*/
|
||||
connection: 'sqlite',
|
||||
|
||||
connections: {
|
||||
/**
|
||||
* SQLite keeps the dashboard independent from MariaDB: the history and
|
||||
* the action log stay available even when MariaDB is down.
|
||||
*/
|
||||
sqlite: {
|
||||
client: 'better-sqlite3',
|
||||
|
||||
connection: {
|
||||
filename: env.get('DB_PATH') ?? app.tmpPath('db.sqlite3'),
|
||||
},
|
||||
|
||||
/**
|
||||
* WAL lets the HTTP requests read while the monitors write.
|
||||
*/
|
||||
pool: {
|
||||
afterCreate: (connection: any, done: (error: Error | null, connection: any) => void) => {
|
||||
connection.pragma('journal_mode = WAL')
|
||||
connection.pragma('foreign_keys = ON')
|
||||
done(null, connection)
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Required by Knex for SQLite defaults.
|
||||
*/
|
||||
useNullAsDefault: true,
|
||||
|
||||
migrations: {
|
||||
/**
|
||||
* Sort migration files naturally by filename.
|
||||
*/
|
||||
naturalSort: true,
|
||||
|
||||
/**
|
||||
* Paths containing migration files.
|
||||
*/
|
||||
paths: ['database/migrations'],
|
||||
},
|
||||
|
||||
schemaGeneration: {
|
||||
/**
|
||||
* Enable schema generation from Lucid models.
|
||||
*/
|
||||
enabled: true,
|
||||
|
||||
/**
|
||||
* Custom schema rules file paths.
|
||||
*/
|
||||
rulesPaths: ['./database/schema_rules.js'],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export default dbConfig
|
||||
Reference in new issue
Block a user