From 3dda2775b73b29ca72f3996eb5788124950f9e70 Mon Sep 17 00:00:00 2001 From: Janik Kleinhoff Date: Fri, 28 Oct 2016 13:48:16 +0000 Subject: Use DBIx::Class For now this is a relatively quick-and-dirty transition, but this enables us to reuse ASM::DB from the website. Yay --- lib/ASM/DB/Result/Actionlog.pm | 37 +++++++++++++++++++++++++++++++++++++ lib/ASM/DB/Result/Alertlog.pm | 30 ++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 lib/ASM/DB/Result/Actionlog.pm create mode 100644 lib/ASM/DB/Result/Alertlog.pm (limited to 'lib/ASM/DB') diff --git a/lib/ASM/DB/Result/Actionlog.pm b/lib/ASM/DB/Result/Actionlog.pm new file mode 100644 index 0000000..5385650 --- /dev/null +++ b/lib/ASM/DB/Result/Actionlog.pm @@ -0,0 +1,37 @@ +use utf8; +package ASM::DB::Result::Actionlog; + +use strict; +use warnings; + +use parent 'DBIx::Class::Core'; + +__PACKAGE__->load_components('InflateColumn::DateTime'); +__PACKAGE__->table('actionlog'); +__PACKAGE__->add_columns( + index => { data_type => 'bigint', is_auto_increment => 1, is_nullable => 0 }, + time => { + data_type => 'timestamp', + datetime_undef_if_invalid => 1, + default_value => \'current_timestamp', + is_nullable => 0, + }, + action => { data_type => 'varchar', is_nullable => 0, size => 20 }, + reason => { data_type => 'varchar', is_nullable => 1, size => 512 }, + channel => { data_type => 'varchar', is_nullable => 1, size => 51 }, + nick => { data_type => 'varchar', is_nullable => 0, size => 17 }, + user => { data_type => 'varchar', is_nullable => 1, size => 11 }, + host => { data_type => 'varchar', is_nullable => 1, size => 64 }, + ip => { data_type => 'integer', is_nullable => 1, extra => { unsigned => 1 } }, + gecos => { data_type => 'varchar', is_nullable => 1, size => 512 }, + account => { data_type => 'varchar', is_nullable => 1, size => 17 }, + bynick => { data_type => 'varchar', is_nullable => 1, size => 17 }, + byuser => { data_type => 'varchar', is_nullable => 1, size => 11 }, + byhost => { data_type => 'varchar', is_nullable => 1, size => 64 }, + bygecos => { data_type => 'varchar', is_nullable => 1, size => 512 }, + byaccount => { data_type => 'varchar', is_nullable => 1, size => 17 }, +); + +__PACKAGE__->set_primary_key('index'); + +1; diff --git a/lib/ASM/DB/Result/Alertlog.pm b/lib/ASM/DB/Result/Alertlog.pm new file mode 100644 index 0000000..8ce22ff --- /dev/null +++ b/lib/ASM/DB/Result/Alertlog.pm @@ -0,0 +1,30 @@ +use utf8; +package ASM::DB::Result::Alertlog; + +use strict; +use warnings; + +use parent 'DBIx::Class::Core'; + +__PACKAGE__->load_components('InflateColumn::DateTime'); +__PACKAGE__->table('alertlog'); +__PACKAGE__->add_columns( + time => { + data_type => 'timestamp', + datetime_undef_if_invalid => 1, + default_value => \'current_timestamp', + is_nullable => 0, + }, + channel => { data_type => 'text', is_nullable => 0 }, + nick => { data_type => 'text', is_nullable => 0 }, + user => { data_type => 'text', is_nullable => 0 }, + host => { data_type => 'text', is_nullable => 0 }, + gecos => { data_type => 'text', is_nullable => 0 }, + level => { data_type => 'tinytext', is_nullable => 0 }, + id => { data_type => 'tinytext', is_nullable => 0 }, + reason => { data_type => 'text', is_nullable => 0 }, +); + +__PACKAGE__->set_primary_key('id'); + +1; -- cgit v1.2.3