CraigStanfield's avatar

Laravel unittest setup database when using a database from another project

So here is my issue. I am working on an app which is a laravel version of an existing app. This app has a database with tables already existing. So I wrote my migrations to use these existing tables and adding columns etc as needed. I also migrate all existing users over using a seeder. This is all great and I am able to import the old database and make use of it.

Now I've started work on a part of the app which needs unit testing so I added a test and ran php artisan test. This deleted my database. At this point I realised I hadn't setup phpunit.xml so i did that and ran the test again but now it won't build the new database as my migrations are expecting the tables to already exist.

So how can I create an empty database with all the tables already created and also migrate from an existing database?

Beyond that I get having no data in the tables makes sense but some of these tables are reference tables and need to be in the app for certain functionality.

I believe I can use php artisan schema:dump --prune after creating a database but is it possible to have both cases ie import an existing database create the schema and then run unit tests which use this without touching my imported database?

Also should i at a later point need to get a fresh copy imported from the old app will this work or would the schema get in the way?

thanks

0 likes
5 replies
martinbean's avatar

So how can I create an empty database with all the tables already created and also migrate from an existing database?

@craigstanfield Use either the DatabaseMigrations or LazilyRefreshDatabase trait. You should also set up a testing database so you’re not affecting any data in your development database. But if you’re working with a database then that would be a feature test and not a unit test, because you’re no longer testing a unit of code in isolation if it needs things like a database with data.

Beyond that I get having no data in the tables makes sense but some of these tables are reference tables and need to be in the app for certain functionality.

Create seeders for your reference tables, and run this in the setUp method of tests that need these rows.

CraigStanfield's avatar

@martinbean So I have now got a sqlite table in memory configured in my phpunit.xml file when i now try to run my tests I get this error The command "sqlite3 "${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed. I guess this is due to there being no LARAVEL_LOAD_DATABASE in my .env file or anywhere else.

The whole thing is very confusing and not well documented. So i would believe that when I run my test suite It uses the details in my phpunit.xml file and will work with a database created like this. This is what I have here

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
>
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory suffix="Test.php">./tests/Feature</directory>
        </testsuite>
        <testsuite name="Eclipse">
            <directory suffix="Test.php">./tests/Eclipse</directory>
        </testsuite>
    </testsuites>
    <coverage processUncoveredFiles="true">
        <include>
            <directory suffix=".php">./app</directory>
        </include>
    </coverage>
    <php>
        <server name="APP_ENV" value="testing"/>
        <server name="BCRYPT_ROUNDS" value="4"/>
        <server name="CACHE_DRIVER" value="array"/>
        <server name="DB_CONNECTION" value="sqlite"/>
        <server name="DB_DATABASE" value=":memory:"/>
        <server name="MAIL_MAILER" value="array"/>
        <server name="QUEUE_CONNECTION" value="sync"/>
        <server name="SESSION_DRIVER" value="array"/>
        <server name="TELESCOPE_ENABLED" value="false"/>
        <server name="DB_DEFAULT" value="sqlite_testing" />
    </php>
</phpunit>

my database.php file in config has:

<?php

use Illuminate\Support\Str;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once using the Database library.
    |
    */

    'default' => env('DB_CONNECTION', 'mysql'),

    /*
    |--------------------------------------------------------------------------
    | Database Connections
    |--------------------------------------------------------------------------
    |
    | Here are each of the database connections setup for your application.
    | Of course, examples of configuring each database platform that is
    | supported by Laravel is shown below to make development simple.
    |
    |
    | All database work in Laravel is done through the PHP PDO facilities
    | so make sure you have the driver for your particular database of
    | choice installed on your machine before you begin development.
    |
    */

    'connections' => [

        'sqlite' => [
            'driver' => 'sqlite',
            'url' => env('DATABASE_URL'),
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
            'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
        ],

        'sqlite_testing' => [
            'driver'   => 'sqlite',
            'database' => ':memory:',
            'prefix'   => '',
        ],

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

        'pgsql' => [
            'driver' => 'pgsql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '5432'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
            'schema' => 'public',
            'sslmode' => 'prefer',
        ],

        'sqlsrv' => [
            'driver' => 'sqlsrv',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '1433'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Migration Repository Table
    |--------------------------------------------------------------------------
    |
    | This table keeps track of all the migrations that have already run for
    | your application. Using this information, we can determine which of
    | the migrations on disk haven't actually been run in the database.
    |
    */

    'migrations' => 'migrations',

    /*
    |--------------------------------------------------------------------------
    | Redis Databases
    |--------------------------------------------------------------------------
    |
    | Redis is an open source, fast, and advanced key-value store that also
    | provides a richer body of commands than a typical key-value system
    | such as APC or Memcached. Laravel makes it easy to dig right in.
    |
    */

    'redis' => [

        'client' => env('REDIS_CLIENT', 'phpredis'),

        'options' => [
            'cluster' => env('REDIS_CLUSTER', 'redis'),
            'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'jobadmin'), '_').'_database_'),
        ],

        'default' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_DB', '0'),
        ],

        'cache' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_CACHE_DB', '1'),
        ],

    ],

];

I have created a schema file with empty tables and my simple test JobStatesTest.php is as follows

<?php

namespace Tests\Eclipse;

use App\Models\Job;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\CreatesApplication;
use Tests\TestCase;

class JobStatesTest extends TestCase
{
    use DatabaseMigrations;

    protected function migrateFreshUsing()
    {
        return ['--schema-path' => 'database/schema/mysql-schema.dump'];
    }

    public function test_registration_screen_can_be_rendered()

    {

        $response = $this->get('/register');



        $response->assertStatus(200);

    }
    
}

Is this not right? I run the test for this php artisan test --testsuite=Eclipse so it only runs what I want but i get this set of errors

   FAIL  Tests\Eclipse\JobStatesTest
  ⨯ registration screen can be rendered
  ⨯ new users can register

  ---

  • Tests\Eclipse\JobStatesTest > registration screen can be rendered
   Symfony\Component\Process\Exception\ProcessFailedException 

  The command "sqlite3 "${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed.

Exit Code: 1(General error)

Working directory: /hdd/projects/laravel.jobadmin.ecl/htdocs

Output:
================


Error Output:
================
Error: near line 10: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 21: in prepare, no such collation sequence: utf8mb4_unicode_ci (1)
Error: near line 33: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 46: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 56: in prepare, near "CHARACTER": syntax error (1)
Error: near line 66: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 78: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 96: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 111: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 122: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 136: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 154: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 166: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 176: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 188: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 208: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 220: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 239: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 252: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 274: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 321: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 332: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 345: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 355: in prepare, near "CHARACTER": syntax error (1)
Error: near line 367: in prepare, near "CHARACTER": syntax error (1)
Error: near line 379: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 392: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 419: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 430: in prepare, near "CHARACTER": syntax error (1)
Error: near line 440: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 453: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 471: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 483: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 501: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 517: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 535: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 548: in prepare, near "KEY": syntax error (1)
Error: near line 560: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 573: in prepare, near "CHARACTER": syntax error (1)
Error: near line 588: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 600: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 615: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 632: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 645: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 660: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 674: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 688: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 708: in prepare, near "CHARACTER": syntax error (1)
Error: near line 719: in prepare, near "CHARACTER": syntax error (1)
Error: near line 726: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 738: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 751: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 761: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 774: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 786: in prepare, near "'1'": syntax error (1)
Error: near line 801: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 827: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 851: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 868: in prepare, no such table: migrations (1)
Error: near line 869: in prepare, no such table: migrations (1)
Error: near line 870: in prepare, no such table: migrations (1)
Error: near line 871: in prepare, no such table: migrations (1)
Error: near line 872: in prepare, no such table: migrations (1)
Error: near line 873: in prepare, no such table: migrations (1)
Error: near line 874: in prepare, no such table: migrations (1)
Error: near line 875: in prepare, no such table: migrations (1)
Error: near line 876: in prepare, no such table: migrations (1)
Error: near line 877: in prepare, no such table: migrations (1)
Error: near line 878: in prepare, no such table: migrations (1)
Error: near line 879: in prepare, no such table: migrations (1)
Error: near line 880: in prepare, no such table: migrations (1)
Error: near line 881: in prepare, no such table: migrations (1)
Error: near line 882: in prepare, no such table: migrations (1)
Error: near line 883: in prepare, no such table: migrations (1)
Error: near line 884: in prepare, no such table: migrations (1)
Error: near line 885: in prepare, no such table: migrations (1)
Error: near line 886: in prepare, no such table: migrations (1)
Error: near line 887: in prepare, no such table: migrations (1)
Error: near line 888: in prepare, no such table: migrations (1)
Error: near line 889: in prepare, no such table: migrations (1)
Error: near line 890: in prepare, no such table: migrations (1)
Error: near line 891: in prepare, no such table: migrations (1)
Error: near line 892: in prepare, no such table: migrations (1)
Error: near line 893: in prepare, no such table: migrations (1)
Error: near line 894: in prepare, no such table: migrations (1)
Error: near line 895: in prepare, no such table: migrations (1)
Error: near line 896: in prepare, no such table: migrations (1)
Error: near line 897: in prepare, no such table: migrations (1)
Error: near line 898: in prepare, no such table: migrations (1)
Error: near line 899: in prepare, no such table: migrations (1)
Error: near line 900: in prepare, no such table: migrations (1)
Error: near line 901: in prepare, no such table: migrations (1)
Error: near line 902: in prepare, no such table: migrations (1)

  at vendor/symfony/process/Process.php:267
    263▕      */
    264▕     public function mustRun(callable $callback = null, array $env = []): static
    265▕     {
    266▕         if (0 !== $this->run($callback, $env)) {
  ➜ 267▕             throw new ProcessFailedException($this);
    268▕         }
    269▕ 
    270▕         return $this;
    271▕     }

  • Tests\Eclipse\JobStatesTest > new users can register
   Symfony\Component\Process\Exception\ProcessFailedException 

  The command "sqlite3 "${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed.

Exit Code: 1(General error)

Working directory: /hdd/projects/laravel.jobadmin.ecl/htdocs

Output:
================


Error Output:
================
Error: near line 10: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 21: in prepare, no such collation sequence: utf8mb4_unicode_ci (1)
Error: near line 33: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 46: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 56: in prepare, near "CHARACTER": syntax error (1)
Error: near line 66: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 78: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 96: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 111: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 122: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 136: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 154: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 166: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 176: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 188: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 208: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 220: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 239: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 252: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 274: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 321: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 332: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 345: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 355: in prepare, near "CHARACTER": syntax error (1)
Error: near line 367: in prepare, near "CHARACTER": syntax error (1)
Error: near line 379: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 392: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 419: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 430: in prepare, near "CHARACTER": syntax error (1)
Error: near line 440: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 453: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 471: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 483: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 501: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 517: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 535: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 548: in prepare, near "KEY": syntax error (1)
Error: near line 560: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 573: in prepare, near "CHARACTER": syntax error (1)
Error: near line 588: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 600: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 615: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 632: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 645: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 660: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 674: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 688: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 708: in prepare, near "CHARACTER": syntax error (1)
Error: near line 719: in prepare, near "CHARACTER": syntax error (1)
Error: near line 726: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 738: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 751: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 761: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 774: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 786: in prepare, near "'1'": syntax error (1)
Error: near line 801: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 827: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 851: in prepare, near "AUTO_INCREMENT": syntax error (1)
Error: near line 868: in prepare, no such table: migrations (1)
Error: near line 869: in prepare, no such table: migrations (1)
Error: near line 870: in prepare, no such table: migrations (1)
Error: near line 871: in prepare, no such table: migrations (1)
Error: near line 872: in prepare, no such table: migrations (1)
Error: near line 873: in prepare, no such table: migrations (1)
Error: near line 874: in prepare, no such table: migrations (1)
Error: near line 875: in prepare, no such table: migrations (1)
Error: near line 876: in prepare, no such table: migrations (1)
Error: near line 877: in prepare, no such table: migrations (1)
Error: near line 878: in prepare, no such table: migrations (1)
Error: near line 879: in prepare, no such table: migrations (1)
Error: near line 880: in prepare, no such table: migrations (1)
Error: near line 881: in prepare, no such table: migrations (1)
Error: near line 882: in prepare, no such table: migrations (1)
Error: near line 883: in prepare, no such table: migrations (1)
Error: near line 884: in prepare, no such table: migrations (1)
Error: near line 885: in prepare, no such table: migrations (1)
Error: near line 886: in prepare, no such table: migrations (1)
Error: near line 887: in prepare, no such table: migrations (1)
Error: near line 888: in prepare, no such table: migrations (1)
Error: near line 889: in prepare, no such table: migrations (1)
Error: near line 890: in prepare, no such table: migrations (1)
Error: near line 891: in prepare, no such table: migrations (1)
Error: near line 892: in prepare, no such table: migrations (1)
Error: near line 893: in prepare, no such table: migrations (1)
Error: near line 894: in prepare, no such table: migrations (1)
Error: near line 895: in prepare, no such table: migrations (1)
Error: near line 896: in prepare, no such table: migrations (1)
Error: near line 897: in prepare, no such table: migrations (1)
Error: near line 898: in prepare, no such table: migrations (1)
Error: near line 899: in prepare, no such table: migrations (1)
Error: near line 900: in prepare, no such table: migrations (1)
Error: near line 901: in prepare, no such table: migrations (1)
Error: near line 902: in prepare, no such table: migrations (1)

  at vendor/symfony/process/Process.php:267
    263▕      */
    264▕     public function mustRun(callable $callback = null, array $env = []): static
    265▕     {
    266▕         if (0 !== $this->run($callback, $env)) {
  ➜ 267▕             throw new ProcessFailedException($this);
    268▕         }
    269▕ 
    270▕         return $this;
    271▕     }


  Tests:  2 failed
  Time:   0.17s

What is the issue?

martinbean's avatar

What is the issue?

@CraigStanfield Well I think the issue is, you’re trying to load a MySQL dump into a SQLite database.

SQLite != MySQL

CraigStanfield's avatar

@martinbean That is a good point. So if I create a sqlite schema it would work? Really I guess the best way to do this is to create all my tables as migrations and then run seeders as you originally said! Bit of a pain as it is a lot of tables (58 of them).

Perhaps I can import the rows into the mysql database via another connection and just putting in the rows that way. That makes me ask another question, Is there a way I can migrate some of the migrations, do the seeding and then run the rest of the migrations?

martinbean's avatar

@CraigStanfield Why are you over-complicating things? The entire point of migrations is to build your database schema. I run tests in applications with many tables and migrations and it’s fine.

Your life will be much easier if you use framework components in the manner they’re intended 🙂

Please or to participate in this conversation.