0

I am creating migrations for a Laravel 6 project. It has multiple database connections for data security.

I am attempting to use laravel migrations to control the DB and seed things. In order to be clear within models, I have set up two databases defined in config/database.php

'connections' => [

    'core' => [ ... ],

    'regional' => [ ... ]

]

These are then populated using the .env file. This seems to be working as expected.

Upon starting to work on migrations, the basic laravel ...create_users_table.php file has the following:

    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
    }

How do I specify the database connection that this uses?

Thanks in advance.

elb98rm
  • 670
  • 6
  • 21

1 Answers1

1

Try Schema::connection('core')->create...

See more info here: https://laravel.com/docs/6.x/migrations