Step 3: Pass the data structure to Class::DBI::DataMigration::Migrator
- Migrating game genres into game types is straightforward
- (like example 1; "left for the reader")
- Then, migrating the games and the genre/type relationship will Just Work with exactly the same script code as before:
use Class::DBI::DataMigration::Migrator; use Legacy::DBI::Games; use New::DBI::Game; open YAML, 'config.yaml' or die $!; my $migrator = new Class::DBI::DataMigration::Migrator(join '', <YAML>); my @source_objects = Legacy::DBI::Games->retrieve_all; my $target_objects = $migrator->migrate_objects(\@source_objs); # Now $target_objects point at the right game_types