I was wondering how I can solve a many to many solutions with migrations like at this diagram: DB relation diagram
u_id_user is a FK from the User table
u_g_id is unique and auto-increment
g_id_group is a FK from Group
Code example:
class UserGroupsSchema extends Schema {
up () {
this.create('user_groups', (table) => {
table.increments()
table.integer('u_id_user')
table.integer("g_id_group")
table.timestamps()
})
}
An other problem is that if I run my migrations it creates the tables with type MyISAM and I cant build relations with this type.. so how can I change the default type to InnoDB?