Skip to content

Can you create a dump with LOGS table, but without its content? #137

Closed Answered by rawilk
kasteckis asked this question in Q&A
Discussion options

You must be logged in to vote

I had a similar use case and I solved it adding extra dump options to the config for my database connection. In my use case, I actually have several tables that I want to include the schema for, but without the data. Here is a simplified version of my custom command I wrote to do this particular snapshot:

public function handle()
{
    $productionConnectionName = config('database.default');
    config()->set('database.connections.{$productionConnectionName}.dump", [
        'addExtraOption' => $this->buildDumpOptions(),
    ]);

    $this->call(Create::class, [
        '--connection' => $productionConnectionName,
    ]);
}

protected function buildDumpOptions(): string
{
    $options = [
…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kasteckis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants