Skip to content

[9.x] Allow choosing tables to truncate#46025

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
emargareten:tables-to-truncate
Feb 8, 2023
Merged

[9.x] Allow choosing tables to truncate#46025
taylorotwell merged 1 commit into
laravel:9.xfrom
emargareten:tables-to-truncate

Conversation

@emargareten

Copy link
Copy Markdown
Contributor

Currently when using DatabaseTruncation trait, there is no option to choose which tables should be truncated, I can either exclude all other tables in the $exceptTables array or it will go through all tables and attempt to truncate (which can be slow for databases with a lot of tables).

With this PR we can choose the tables for truncation by defining a $tablesToTruncate property.

class AuthenticationTest extends DuskTestCase
{
    use DatabaseTruncation;

    /**
     * Indicates which tables should be truncated.
     *
     * @var array
     */
    protected $tablesToTruncate = ['users'];

    //...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants