Skip to content

Adonis 5 multi-tenant questions #1587

Answered by incraigulous
incraigulous asked this question in Help
Discussion options

You must be logged in to vote

I believe I've worked out multitenant migrations by extending the existing migration commands. Posting here in case it's helpful to anyone else. Now on to auth!

import Run from '@adonisjs/lucid/build/commands/Migration/Run'
import Tenant from 'App/Models/Tenant'
import {flags} from '@adonisjs/ace/build'
import {inject} from '@adonisjs/fold/build'

@inject([null, null, 'Adonis/Lucid/Database'])
export default class RunTenantMigrations extends Run {
  public static commandName = 'migration:tenants:run'
  public static description = 'Migrate the tenant databases.'

  /**
   * Custom connection for running migrations.
   */
  @flags.string({description: 'Define a custom database connection', a…

Replies: 5 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@sokhai-cambodia
Comment options

@carlmathisen
Comment options

Answer selected by incraigulous
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@binsarjr
Comment options

Comment options

You must be logged in to vote
4 replies
@thetutlage
Comment options

@aayush123
Comment options

@fpolli
Comment options

@fpolli
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
9 participants