Date: Wed, 16 Apr 2014 21:01:45 +0000 (UTC) From: Dag-Erling Smørgrav <des@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r264554 - in user/des/fbp: lib/FBP lib/FBP/Model lib/FBP/Schema lib/FBP/Schema/Result t Message-ID: <201404162101.s3GL1jmf037814@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: des Date: Wed Apr 16 21:01:44 2014 New Revision: 264554 URL: http://svnweb.freebsd.org/changeset/base/264554 Log: DBIx::Class schema Added: user/des/fbp/lib/FBP/Model/FBP.pm (contents, props changed) user/des/fbp/lib/FBP/Schema/ user/des/fbp/lib/FBP/Schema.pm (contents, props changed) user/des/fbp/lib/FBP/Schema/Result/ user/des/fbp/lib/FBP/Schema/Result/Option.pm (contents, props changed) user/des/fbp/lib/FBP/Schema/Result/Person.pm (contents, props changed) user/des/fbp/lib/FBP/Schema/Result/Poll.pm (contents, props changed) user/des/fbp/lib/FBP/Schema/Result/Question.pm (contents, props changed) user/des/fbp/lib/FBP/Schema/Result/Vote.pm (contents, props changed) user/des/fbp/t/model_FBP.t Added: user/des/fbp/lib/FBP/Model/FBP.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/lib/FBP/Model/FBP.pm Wed Apr 16 21:01:44 2014 (r264554) @@ -0,0 +1,39 @@ +package FBP::Model::FBP; + +use strict; +use base 'Catalyst::Model::DBIC::Schema'; + +__PACKAGE__->config( + schema_class => 'FBP::Schema', +); + +=head1 NAME + +FBP::Model::FBP - Catalyst DBIC Schema Model + +=head1 SYNOPSIS + +See L<FBP> + +=head1 DESCRIPTION + +L<Catalyst::Model::DBIC::Schema> Model using schema L<FBP::Schema> + +=head1 GENERATED BY + +Catalyst::Helper::Model::DBIC::Schema - 0.62 + +=head1 AUTHOR + +Dag-Erling Smørgrav <des@freebsd.org> + +=head1 LICENSE + +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +1; + +# $FreeBSD$ Added: user/des/fbp/lib/FBP/Schema.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/lib/FBP/Schema.pm Wed Apr 16 21:01:44 2014 (r264554) @@ -0,0 +1,32 @@ +use utf8; +package FBP::Schema; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use Moose; +use MooseX::MarkAsMethods autoclean => 1; +extends 'DBIx::Class::Schema'; + +__PACKAGE__->load_namespaces; + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-04-16 20:57:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OqDxT/byqci3h2Eb5Pg2AA + +=head1 AUTHOR + +Dag-Erling Smørgrav <des@freebsd.org> + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +__PACKAGE__->meta->make_immutable; + +1; + +# $FreeBSD$ Added: user/des/fbp/lib/FBP/Schema/Result/Option.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/lib/FBP/Schema/Result/Option.pm Wed Apr 16 21:01:44 2014 (r264554) @@ -0,0 +1,139 @@ +use utf8; +package FBP::Schema::Result::Option; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +FBP::Schema::Result::Option + +=cut + +use strict; +use warnings; + +use Moose; +use MooseX::NonMoose; +use MooseX::MarkAsMethods autoclean => 1; +extends 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L<DBIx::Class::InflateColumn::DateTime> + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime"); + +=head1 TABLE: C<options> + +=cut + +__PACKAGE__->table("options"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'options_id_seq' + +=head2 question + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 label + + data_type: 'varchar' + is_nullable: 0 + size: 256 + +=cut + +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "options_id_seq", + }, + "question", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "label", + { data_type => "varchar", is_nullable => 0, size => 256 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L</id> + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 question + +Type: belongs_to + +Related object: L<FBP::Schema::Result::Question> + +=cut + +__PACKAGE__->belongs_to( + "question", + "FBP::Schema::Result::Question", + { id => "question" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 votes + +Type: has_many + +Related object: L<FBP::Schema::Result::Vote> + +=cut + +__PACKAGE__->has_many( + "votes", + "FBP::Schema::Result::Vote", + { "foreign.option" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-04-16 20:57:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MHuHdh1TNt7StsGgKR+D3Q + +=head1 AUTHOR + +Dag-Erling Smørgrav <des@freebsd.org> + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +__PACKAGE__->meta->make_immutable; + +1; + +# $FreeBSD$ Added: user/des/fbp/lib/FBP/Schema/Result/Person.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/lib/FBP/Schema/Result/Person.pm Wed Apr 16 21:01:44 2014 (r264554) @@ -0,0 +1,191 @@ +use utf8; +package FBP::Schema::Result::Person; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +FBP::Schema::Result::Person + +=cut + +use strict; +use warnings; + +use Moose; +use MooseX::NonMoose; +use MooseX::MarkAsMethods autoclean => 1; +extends 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L<DBIx::Class::InflateColumn::DateTime> + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime"); + +=head1 TABLE: C<persons> + +=cut + +__PACKAGE__->table("persons"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'persons_id_seq' + +=head2 login + + data_type: 'text' + is_nullable: 0 + original: {data_type => "varchar"} + +=head2 realname + + data_type: 'text' + is_nullable: 1 + original: {data_type => "varchar"} + +=head2 password + + data_type: 'text' + default_value: '*' + is_nullable: 0 + original: {data_type => "varchar"} + +=head2 admin + + data_type: 'boolean' + default_value: false + is_nullable: 0 + +=head2 active + + data_type: 'boolean' + default_value: false + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "persons_id_seq", + }, + "login", + { + data_type => "text", + is_nullable => 0, + original => { data_type => "varchar" }, + }, + "realname", + { + data_type => "text", + is_nullable => 1, + original => { data_type => "varchar" }, + }, + "password", + { + data_type => "text", + default_value => "*", + is_nullable => 0, + original => { data_type => "varchar" }, + }, + "admin", + { data_type => "boolean", default_value => \"false", is_nullable => 0 }, + "active", + { data_type => "boolean", default_value => \"false", is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L</id> + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C<persons_login_key> + +=over 4 + +=item * L</login> + +=back + +=cut + +__PACKAGE__->add_unique_constraint("persons_login_key", ["login"]); + +=head1 RELATIONS + +=head2 polls + +Type: has_many + +Related object: L<FBP::Schema::Result::Poll> + +=cut + +__PACKAGE__->has_many( + "polls", + "FBP::Schema::Result::Poll", + { "foreign.owner" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 votes + +Type: has_many + +Related object: L<FBP::Schema::Result::Vote> + +=cut + +__PACKAGE__->has_many( + "votes", + "FBP::Schema::Result::Vote", + { "foreign.voter" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-04-16 20:57:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:19kISwX2Afx2WCQPAB8akw + +=head1 AUTHOR + +Dag-Erling Smørgrav <des@freebsd.org> + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +__PACKAGE__->meta->make_immutable; + +1; + +# $FreeBSD$ Added: user/des/fbp/lib/FBP/Schema/Result/Poll.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/lib/FBP/Schema/Result/Poll.pm Wed Apr 16 21:01:44 2014 (r264554) @@ -0,0 +1,182 @@ +use utf8; +package FBP::Schema::Result::Poll; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +FBP::Schema::Result::Poll + +=cut + +use strict; +use warnings; + +use Moose; +use MooseX::NonMoose; +use MooseX::MarkAsMethods autoclean => 1; +extends 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L<DBIx::Class::InflateColumn::DateTime> + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime"); + +=head1 TABLE: C<polls> + +=cut + +__PACKAGE__->table("polls"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'polls_id_seq' + +=head2 owner + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 title + + data_type: 'varchar' + is_nullable: 0 + size: 64 + +=head2 starts + + data_type: 'timestamp' + is_nullable: 0 + +=head2 ends + + data_type: 'timestamp' + is_nullable: 0 + +=head2 synopsis + + data_type: 'varchar' + is_nullable: 0 + size: 256 + +=head2 long + + data_type: 'text' + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "polls_id_seq", + }, + "owner", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "title", + { data_type => "varchar", is_nullable => 0, size => 64 }, + "starts", + { data_type => "timestamp", is_nullable => 0 }, + "ends", + { data_type => "timestamp", is_nullable => 0 }, + "synopsis", + { data_type => "varchar", is_nullable => 0, size => 256 }, + "long", + { data_type => "text", is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L</id> + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C<polls_title_key> + +=over 4 + +=item * L</title> + +=back + +=cut + +__PACKAGE__->add_unique_constraint("polls_title_key", ["title"]); + +=head1 RELATIONS + +=head2 owner + +Type: belongs_to + +Related object: L<FBP::Schema::Result::Person> + +=cut + +__PACKAGE__->belongs_to( + "owner", + "FBP::Schema::Result::Person", + { id => "owner" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 questions + +Type: has_many + +Related object: L<FBP::Schema::Result::Question> + +=cut + +__PACKAGE__->has_many( + "questions", + "FBP::Schema::Result::Question", + { "foreign.poll" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-04-16 20:57:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wB2dAarq+nsbZ5Ljfsil7Q + +=head1 AUTHOR + +Dag-Erling Smørgrav <des@freebsd.org> + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +__PACKAGE__->meta->make_immutable; + +1; + +# $FreeBSD$ Added: user/des/fbp/lib/FBP/Schema/Result/Question.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/lib/FBP/Schema/Result/Question.pm Wed Apr 16 21:01:44 2014 (r264554) @@ -0,0 +1,200 @@ +use utf8; +package FBP::Schema::Result::Question; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +FBP::Schema::Result::Question + +=cut + +use strict; +use warnings; + +use Moose; +use MooseX::NonMoose; +use MooseX::MarkAsMethods autoclean => 1; +extends 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L<DBIx::Class::InflateColumn::DateTime> + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime"); + +=head1 TABLE: C<questions> + +=cut + +__PACKAGE__->table("questions"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'questions_id_seq' + +=head2 poll + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 rank + + data_type: 'integer' + is_nullable: 0 + +=head2 short + + data_type: 'varchar' + is_nullable: 0 + size: 256 + +=head2 long + + data_type: 'text' + is_nullable: 0 + +=head2 min_options + + data_type: 'integer' + default_value: 1 + is_nullable: 0 + +=head2 max_options + + data_type: 'integer' + default_value: 1 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "questions_id_seq", + }, + "poll", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "rank", + { data_type => "integer", is_nullable => 0 }, + "short", + { data_type => "varchar", is_nullable => 0, size => 256 }, + "long", + { data_type => "text", is_nullable => 0 }, + "min_options", + { data_type => "integer", default_value => 1, is_nullable => 0 }, + "max_options", + { data_type => "integer", default_value => 1, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L</id> + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C<questions_poll_rank_key> + +=over 4 + +=item * L</poll> + +=item * L</rank> + +=back + +=cut + +__PACKAGE__->add_unique_constraint("questions_poll_rank_key", ["poll", "rank"]); + +=head1 RELATIONS + +=head2 options + +Type: has_many + +Related object: L<FBP::Schema::Result::Option> + +=cut + +__PACKAGE__->has_many( + "options", + "FBP::Schema::Result::Option", + { "foreign.question" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 poll + +Type: belongs_to + +Related object: L<FBP::Schema::Result::Poll> + +=cut + +__PACKAGE__->belongs_to( + "poll", + "FBP::Schema::Result::Poll", + { id => "poll" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 votes + +Type: has_many + +Related object: L<FBP::Schema::Result::Vote> + +=cut + +__PACKAGE__->has_many( + "votes", + "FBP::Schema::Result::Vote", + { "foreign.question" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-04-16 20:57:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:I/1G7NpDuffuLD3XnoJLpw + +=head1 AUTHOR + +Dag-Erling Smørgrav <des@freebsd.org> + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +__PACKAGE__->meta->make_immutable; + +1; + +# $FreeBSD$ Added: user/des/fbp/lib/FBP/Schema/Result/Vote.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/lib/FBP/Schema/Result/Vote.pm Wed Apr 16 21:01:44 2014 (r264554) @@ -0,0 +1,178 @@ +use utf8; +package FBP::Schema::Result::Vote; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +FBP::Schema::Result::Vote + +=cut + +use strict; +use warnings; + +use Moose; +use MooseX::NonMoose; +use MooseX::MarkAsMethods autoclean => 1; +extends 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L<DBIx::Class::InflateColumn::DateTime> + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime"); + +=head1 TABLE: C<votes> + +=cut + +__PACKAGE__->table("votes"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'votes_id_seq' + +=head2 voter + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 question + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 option + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "votes_id_seq", + }, + "voter", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "question", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "option", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L</id> + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C<votes_voter_option_key> + +=over 4 + +=item * L</voter> + +=item * L</option> + +=back + +=cut + +__PACKAGE__->add_unique_constraint("votes_voter_option_key", ["voter", "option"]); + +=head1 RELATIONS + +=head2 option + +Type: belongs_to + +Related object: L<FBP::Schema::Result::Option> + +=cut + +__PACKAGE__->belongs_to( + "option", + "FBP::Schema::Result::Option", + { id => "option" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 question + +Type: belongs_to + +Related object: L<FBP::Schema::Result::Question> + +=cut + +__PACKAGE__->belongs_to( + "question", + "FBP::Schema::Result::Question", + { id => "question" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 voter + +Type: belongs_to + +Related object: L<FBP::Schema::Result::Person> + +=cut + +__PACKAGE__->belongs_to( + "voter", + "FBP::Schema::Result::Person", + { id => "voter" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-04-16 20:57:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TIV5w+lodXu0vgk/zqosbA + +=head1 AUTHOR + +Dag-Erling Smørgrav <des@freebsd.org> + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +__PACKAGE__->meta->make_immutable; + +1; + +# $FreeBSD$ Added: user/des/fbp/t/model_FBP.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/t/model_FBP.t Wed Apr 16 21:01:44 2014 (r264554) @@ -0,0 +1,8 @@ +use strict; +use warnings; +use Test::More; + + +BEGIN { use_ok 'FBP::Model::FBP' } + +done_testing();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404162101.s3GL1jmf037814>