This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/script/deploy_db

50 lines
1,021 B
Text
Raw Normal View History

#! /usr/bin/env perl
use strict;
use warnings;
2017-04-21 16:23:11 +00:00
use FindBin qw/ $Bin /;
use lib "$Bin/../lib";
use Pear::LocalLoop::Schema;
my @con = @ARGV;
my $schema = Pear::LocalLoop::Schema->connect(@con);
$schema->deploy;
$schema->resultset('AgeRange')->populate([
[ qw/ string / ],
[ '20-35' ],
[ '35-50' ],
[ '50+' ],
]);
2017-05-23 22:06:07 +00:00
$schema->resultset('Leaderboard')->populate([
[ qw/ name type / ],
[ 'Daily Total', 'daily_total' ],
[ 'Daily Count', 'daily_count' ],
[ 'Weekly Total', 'weekly_total' ],
[ 'Weekly Count', 'weekly_count' ],
[ 'Monthly Total', 'monthly_total' ],
[ 'Monthly Count', 'monthly_count' ],
[ 'All Time Total', 'all_time_total' ],
[ 'All Time Count', 'all_time_count' ],
]);
if (defined $ENV{MOJO_MODE} && $ENV{MOJO_MODE} eq 'development' ) {
$schema->resultset('User')->create({
email => 'test@example.com',
password => 'abc123',
customer => {
name => 'Test User',
age_range_id => 1,
postcode => 'LA1 1AA',
},
administrator => {},
});
}