Scroll to navigation

DBIx::Class::Migration::Population(3) User Contributed Perl Documentation DBIx::Class::Migration::Population(3)

NAME

DBIx::Class::Migration::Population - Utility to populate fixture data

SYNOPSIS

  use DBIx::Class::Migration::Population;
  use MyApp::Schema;
  $schema = MyApp::Schema->connect(...);
  (my $population = DBIx::Class::Migration::Population->new(
    schema=>$schema))->populate('all_tables');

DESCRIPTION

Sometimes you just need to populate data for your scripts, such as during testing and you don't want to expose a full migrations interface and let someone accidently wipe your database with one command. This utility is designed to assist. It is basically a thin wrapper on DBIx::Class::Fixtures that is just aware of DBIx::Class::Migration conventions.

You create an instance of this similarly to DBIx::Class::Migration, except you can't pass any arguments related to DBIx::Class::DeploymentHandler since you don't have one :). You can create it from an existing schema, or build it from a schema_class and schema_args, and optional set a target directory (or just let it use the default distribution share directory). Afterwards we expose a "populate" method that takes a list of fixture set names.

You don't have any control over which version we are trying to populate, we always use the declared schema Version. We assume you have an existing deployed database that matches the current schema.

SEE ALSO

DBIx::Class::Migration, DBIx::Class::Manual::Example

AUTHOR

See DBIx::Class::Migration for author information

COPYRIGHT & LICENSE

See DBIx::Class::Migration for copyright and license information

2020-06-03 perl v5.40.0