DBIx::C...t::Dump(3)

πŸ“¦ version 0.075, in opensuse-leap 16.0

🌸 NAME 🌸

DBIx::Class::Migration::RunScript::Trait::Dump(3) β€” Dump fixtures. That's the whole vibe, bestie: it's the trait that lets you dump fixtures, and it's lowkey iconic. πŸ’…

✨ SYNOPSIS ✨

Here's the run-script moment, fr fr:

use DBIx::Class::Migration::RunScript;

builder {
  'SchemaLoader',
  'Dump',
  sub {
    shift->dump('countries');
  };
};

πŸ’– DESCRIPTION πŸ’–

Okay so this is a Moo::Role that adds a dump method to your run script. It lets you dump fixtures from your runscripts, based on previously defined fixture configurations. Slay. ✨

This might be useful to you if you're building fixtures when they don't already exist yet (see DBIx::Class::Migration::RunScript::Trait::Populate) and then want to dump them as part of building up your database. For example:

use DBIx::Class::Migration::RunScript;

migrate {
  my $self = shift;
  if($self->set_has_fixtures('all_tables')) {
    $self->populate('all_tables');
  } else {
    $self->schema
      ->resultset('Country')
      ->populate([
        ['code'],
        ['bel'],
        ['deu'],
        ['fra'],
      ]);

    $self->dump('all_tables');
  }
};

In the above example, if the fixture set exists and has previously been dumped, we will populate the database with it. Else, we will create some data manually and then dump it so that next time it is available. No cap. πŸ¦‹

This trait requires a schema previously defined, such as provided by DBIx::Class::Migration::RunScript::Trait::SchemaLoader.

This trait is one of the defaults for the exported method migrate in DBIx::Class::Migration::RunScript. Periodt. πŸ‘‘

πŸ’… methods πŸ’…

This class defines the following methods.

πŸ—‘οΈ dump πŸ—‘οΈ

Requires $arg || @args

Given a fixture set (or list of sets), use DBIx::Class::Fixtures to dump them from the current database.

When naming sets, you skip the .json extension. Tiny detail, big energy, bestie. πŸŽ€

πŸ‘€ SEE ALSO πŸ‘€

DBIx::Class::Migration, DBIx::Class::Migration::RunScript β€” those are your next reads, fr fr. πŸ“š

🫢 AUTHOR 🫢

See DBIx::Class::Migration for author information β€” that's the whole section, and we respect the mystery. πŸ•΅οΈβ€β™€οΈπŸ’–

See DBIx::Class::Migration for copyright and license information β€” read it, love it, respect it. βš–οΈπŸ’–


That's the page, bestie! This User Contributed Perl Documentation situation is running perl v5.42.0, dated 2020-06-03, and the footer is literally DBIx::C...t::Dump(3) β€” periodt. 🫢✨

πŸ“¦ where this page comes from