database.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Config source: https://git.io/JesV9
  3. *
  4. * Feel free to let us know via PR, if you find something broken in this config
  5. * file.
  6. */
  7. import Env from '@ioc:Adonis/Core/Env'
  8. import type { DatabaseConfig } from '@ioc:Adonis/Lucid/Database'
  9. const databaseConfig: DatabaseConfig = {
  10. /*
  11. |--------------------------------------------------------------------------
  12. | Connection
  13. |--------------------------------------------------------------------------
  14. |
  15. | The primary connection for making database queries across the application
  16. | You can use any key from the `connections` object defined in this same
  17. | file.
  18. |
  19. */
  20. connection: Env.get('DB_CONNECTION'),
  21. connections: {
  22. /*
  23. |--------------------------------------------------------------------------
  24. | MySQL config
  25. |--------------------------------------------------------------------------
  26. |
  27. | Configuration for MySQL database. Make sure to install the driver
  28. | from npm when using this connection
  29. |
  30. | npm i mysql2
  31. |
  32. */
  33. mysql: {
  34. client: 'mysql2',
  35. connection: {
  36. host: Env.get('MYSQL_HOST'),
  37. port: Env.get('MYSQL_PORT'),
  38. user: Env.get('MYSQL_USER'),
  39. password: Env.get('MYSQL_PASSWORD', ''),
  40. database: Env.get('MYSQL_DB_NAME')
  41. },
  42. migrations: {
  43. naturalSort: true
  44. },
  45. healthCheck: false,
  46. debug: true
  47. }
  48. }
  49. }
  50. export default databaseConfig