I am migrating my application from Codeigniter into laravel, also we are in the process of making itegration and unit tests as well.
The database is consisted of 2 databases:
-
old
That is the one used from the original codeigniter. -
new
That is used for other features not related in the codeingiter project.
Therefore I want to make a migration script used for the old
database, but in order to avoid breakdowns I want to specify a specific folder for the migration scripts for each database.
Therefore I found this tool: https://github.com/Xethron/migrations-generator and via this help output:
Description:
Generate a migration from an existing table structure.
Usage:
migrate:generate [options] [--] [<tables>]
Arguments:
tables A list of Tables you wish to Generate Migrations for separated by a comma: users,posts,comments
Options:
-c, --connection[=CONNECTION] The database connection to use. [default: "etable_api"]
-t, --tables[=TABLES] A list of Tables you wish to Generate Migrations for separated by a comma: users,posts,comments
-i, --ignore[=IGNORE] A list of Tables you wish to ignore, separated by a comma: users,posts,comments
-p, --path[=PATH] Where should the file be created?
--defaultIndexNames Don't use db index names for migrations
--defaultFKNames Don't use db foreign key names for migrations
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-tp, --templatePath[=TEMPLATEPATH] The location of the template for this generator
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
I can use the following command sequence in order to make a dedicated folder for the migration script:
mkdir -p ./database/migration/old
php artisan migrate:generate -c old -p ./database/migration/old
And via artisan I can run the migrations via:
php artisan migrate -c old -p ./database/migration/old
Therefore I can use the laravel provided solution:
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{
use RefreshDatabase;
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()
{
// Do some fancy stuff here
}
}
But how I can specify the specified folder for the migration script of the database that I want to participate in test when using the Illuminate\Foundation\Testing\RefreshDatabase
?