Something went wrong. Try again.
Something went wrong. Try again.
3.4 kB · 137 lines
TypeScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138import 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