#!/usr/bin/perl
use strict;
use warnings;
use GroLUG::M::DB;
use DateTime;

#use Devel::TraceCalls;trace_calls { Package => [qw(DBIx::Class::Schema DBIx::Class::Storage::DBI)]};

my $schema=GroLUG::M::DB->connect('dbi:Pg:dbname=iscritti',
    'grolug',
    '',
    { RaiseError => 1, PrintError => 0, ShowErrorStatement => 1, TraceLevel => 0 });

my $iscritto=$schema->resultset('GroLUG::M::DB::Iscritto')->create({
    nome => '__tizio',
    email => 'tizio@qui',
});

$iscritto->add_to_pagamenti({
    data_pagamento=>DateTime->now(),
    data_iscrizione=>DateTime->now()->subtract(days=>10),
    data_scadenza=>DateTime->now()->subtract(days=>10)->add(years=>1),
    prezzo=>50});

$schema->commit();
