From 17dacd83c3354be38b678423f4745a97e73b94c1 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Fri, 21 Apr 2017 22:33:06 +0100 Subject: [PATCH] Added bootstrapping for basic database stuff --- script/deploy_db | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/script/deploy_db b/script/deploy_db index d13e9b2..8a83d2e 100755 --- a/script/deploy_db +++ b/script/deploy_db @@ -13,3 +13,25 @@ my @con = @ARGV; my $schema = Pear::LocalLoop::Schema->connect(@con); $schema->deploy; + +$schema->resultset('AgeRange')->populate([ + [ qw/ string / ], + [ '20-35' ], + [ '35-50' ], + [ '50+' ], +]); + +if ( $ENV{MOJO_MODE} eq 'development' ) { + + $schema->resultset('User')->create({ + email => 'test@example.com', + password => 'abc123', + customer => { + username => 'Test User', + age_range_id => 1, + postcode => 'LA1 1AA', + }, + administrator => {}, + }); + +}