Skip to content

Instantly share code, notes, and snippets.

@racke
Created April 14, 2016 09:51
Show Gist options
  • Save racke/17102e2fab740f309e31d520a66534cb to your computer and use it in GitHub Desktop.
Save racke/17102e2fab740f309e31d520a66534cb to your computer and use it in GitHub Desktop.
Solution for custom DH scripts
package PerlDance::Schema::Upgrades::2016;
use Moo;
use DateTime;
has schema => (
is => 'ro',
required => 1,
);
sub upgrade {
my $self = shift;
my $schema = $self->schema;
my $conf = $schema->resultset('Conference')->create(
{name => 'Perl Dancer Conference 2016',
start_date => DateTime->new(
year => 2016,
month => 9,
day => 21,
),
end_date => DateTime->new(
year => 2016,
month => 9,
day => 22,
),
},
);
}
sub clear {
my $self = shift;
my $schema = $self->schema;
my $conf = $schema->resultset('Conference')->find(
{name => 'Perl Dancer Conference 2016'},
);
if ($conf) {
$conf->delete;
}
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment