Pastes-Bin/lib/Pastes-Bin.rakumod

33 lines
704 B
Raku
Raw Normal View History

2023-11-23 04:21:19 +00:00
use Humming-Bird::Core;
use Humming-Bird::Middleware;
use Humming-Bird::Advice;
use DB::Migration::Simple;
use DBIish;
# Local libs
2023-12-03 04:03:20 +00:00
#use Pastes-Bin::Controller::Paste;
use Pastes-Bin::Model::Paste;
2023-11-23 04:21:19 +00:00
# Logging
middleware &middleware-logger;
advice &advice-logger;
# Database stuff
2023-12-03 04:03:20 +00:00
my $*dbh = DBIish.connect:
2023-11-23 04:21:19 +00:00
'Pg',
:host<devbussy.swagg.net>,
:database<pastes_bin>,
:user<pastes_bin>,
password => prompt 'enter DB password: ';
my $m = DB::Migration::Simple.new:
2023-12-03 04:03:20 +00:00
:$*dbh,
2023-11-23 04:21:19 +00:00
:migration-file<migrations>,
:verbose;
$m.migrate: :version<1>;
2023-12-03 04:03:20 +00:00
# No routes yet just prompt to 'fake it'
my $new-paste = prompt 'enter a new paste: ';
Pastes-Bin::Model::Paste.create: $new-paste;