How to write mysql views and triggers with adonis?

my db server is mysql

i can’t see in the doc how to write with adonis:

  1. mysql views
  2. mysql triggers

advises/hints ?

I don’t think they are AdonisJs issues, they are database concerns. Can you give a concrete example of what you are trying to achieve?

Hi @student

You can write them into migrations and use raw database queries in there
Inside migration file

/** @type {import('@adonisjs/lucid/src/Database')} */
const Database = use('Database')
...
up () {
  Database.raw('do things')
}

https://adonisjs.com/docs/4.1/query-builder#_raw_queries

1 Like

Yeah @McSneaky has said, use the migration files to setup your views.

2 Likes