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: 'mysql', connections: { /** * SQLite connection (default). */ // sqlite: { // client: 'better-sqlite3', // // connection: { // /** // * Database file location. // */ // filename: app.tmpPath('db.sqlite3'), // }, // // pool: { // afterCreate: (conn: any, done: any) => { // conn.pragma('journal_mode = WAL') // conn.pragma('synchronous = NORMAL') // conn.pragma('busy_timeout = 5000') // done(null, conn) // }, // }, // // /** // * 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: { // enabled: true, // rulesPaths: ['./database/schema_rules.js'], // }, // }, /** * PostgreSQL connection. * Install package to switch: npm install pg */ // pg: { // client: 'pg', // connection: { // host: env.get('DB_HOST'), // port: env.get('DB_PORT'), // user: env.get('DB_USER'), // password: env.get('DB_PASSWORD'), // database: env.get('DB_DATABASE'), // }, // migrations: { // naturalSort: true, // paths: ['database/migrations'], // }, // debug: app.inDev, // }, /** * MySQL / MariaDB connection. * Install package to switch: npm install mysql2 */ mysql: { client: 'mysql2', connection: { host: env.get('DB_HOST'), port: env.get('DB_PORT'), user: env.get('DB_USER'), password: env.get('DB_PASSWORD'), database: env.get('DB_DATABASE'), }, migrations: { naturalSort: true, paths: ['database/migrations'], }, debug: app.inDev, }, /** * Microsoft SQL Server connection. * Install package to switch: npm install tedious */ // mssql: { // client: 'mssql', // connection: { // server: env.get('DB_HOST'), // port: env.get('DB_PORT'), // user: env.get('DB_USER'), // password: env.get('DB_PASSWORD'), // database: env.get('DB_DATABASE'), // }, // migrations: { // naturalSort: true, // paths: ['database/migrations'], // }, // debug: app.inDev, // }, /** * libSQL (Turso) connection. * Install package to switch: npm install @libsql/client */ // libsql: { // client: 'libsql', // connection: { // url: env.get('LIBSQL_URL'), // authToken: env.get('LIBSQL_AUTH_TOKEN'), // }, // useNullAsDefault: true, // migrations: { // naturalSort: true, // paths: ['database/migrations'], // }, // debug: app.inDev, // }, }, }) export default dbConfig