PoorBooru/bin/migrate.pl

23 lines
514 B
Perl
Raw Normal View History

2023-03-04 22:31:42 +01:00
#!/usr/bin/env perl
use v5.36;
use strict;
use warnings;
use DBIx::Class::Schema::Loader qw(make_schema_at);
use DBIx::Migration;
use Mojo::File qw(curfile);
my $parent = curfile->dirname;
my $dsn = "dbi:SQLite:" . $parent->sibling("db", "PoorBooru.db")->to_string;
DBIx::Migration->new({
dsn => $dsn,
dir => $parent->sibling("migrations")->to_string,
})->migrate or die "couldn't run migration";
make_schema_at(
"PoorBooru::Schema",
{ dump_directory => $parent->sibling("lib")->to_string },
[ $dsn ],
);