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.

1 Answer 1

3

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

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.