diff --git a/Kinza/lib/Kinza/Schema/Result/Form.pm b/Kinza/lib/Kinza/Schema/Result/Form.pm new file mode 100644 index 0000000..74b055f --- /dev/null +++ b/Kinza/lib/Kinza/Schema/Result/Form.pm @@ -0,0 +1,108 @@ +use utf8; +package Kinza::Schema::Result::Form; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Kinza::Schema::Result::Form + +=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 + +=item * L + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); + +=head1 TABLE: C
+ +=cut + +__PACKAGE__->table("form"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 name + + data_type: 'varchar' + is_nullable: 1 + size: 255 + +=head2 year_id + + 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 }, + "name", + { data_type => "varchar", is_nullable => 1, size => 255 }, + "year_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 year + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "year", + "Kinza::Schema::Result::Year", + { id => "year_id" }, + { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-09-07 16:18:05 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EMHLaKP8SKqzMLixsT0NGg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +__PACKAGE__->meta->make_immutable; +1; diff --git a/Kinza/lib/Kinza/Schema/Result/Student.pm b/Kinza/lib/Kinza/Schema/Result/Student.pm index a24a84e..062c37d 100644 --- a/Kinza/lib/Kinza/Schema/Result/Student.pm +++ b/Kinza/lib/Kinza/Schema/Result/Student.pm @@ -64,6 +64,11 @@ __PACKAGE__->table("student"); is_nullable: 0 size: 255 +=head2 form_id + + data_type: 'integer' + is_nullable: 1 + =head2 verify data_type: 'varchar' @@ -81,6 +86,8 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 0, size => 255 }, "password", { data_type => "varchar", is_nullable => 0, size => 255 }, + "form_id", + { data_type => "integer", is_nullable => 1 }, "verify", { data_type => "varchar", is_nullable => 1, size => 255 }, ); @@ -130,8 +137,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-09-03 19:32:04 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:83EZioIV2OOEpR1u6nAfyw +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-09-07 16:26:50 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fWMkkeXm2GOsOwXsmSBr9g sub sorted_attendances { my $self = shift; diff --git a/Kinza/lib/Kinza/Schema/Result/Year.pm b/Kinza/lib/Kinza/Schema/Result/Year.pm new file mode 100644 index 0000000..03073cd --- /dev/null +++ b/Kinza/lib/Kinza/Schema/Result/Year.pm @@ -0,0 +1,100 @@ +use utf8; +package Kinza::Schema::Result::Year; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Kinza::Schema::Result::Year + +=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 + +=item * L + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("year"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 name + + data_type: 'varchar' + is_nullable: 1 + size: 255 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "name", + { data_type => "varchar", is_nullable => 1, size => 255 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 forms + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "forms", + "Kinza::Schema::Result::Form", + { "foreign.year_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-09-07 16:18:05 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hAolxMnPEFonrAaw4rktsg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +__PACKAGE__->meta->make_immutable; +1; diff --git a/db_schema/Form.tsv b/db_schema/Form.tsv new file mode 100644 index 0000000..a2aa843 --- /dev/null +++ b/db_schema/Form.tsv @@ -0,0 +1,24 @@ +name year_id +Upper 3F 1 +Upper 3K 1 +Upper 3S 1 +Lower 4F 2 +Lower 4K 2 +Lower 4S 2 +Upper 4F 3 +Upper 4K 3 +Upper 4S 3 +Lower 5F 4 +Lower 5K 4 +Lower 5S 4 +Upper 5F 5 +Upper 5K 5 +Upper 5S 5 +Lower 6P 6 +Lower 6Q 6 +Lower 6R 6 +Lower 6S 6 +Upper 6A 7 +Upper 6B 7 +Upper 6C 7 +Upper 6D 7 diff --git a/db_schema/Year.tsv b/db_schema/Year.tsv new file mode 100644 index 0000000..98f5049 --- /dev/null +++ b/db_schema/Year.tsv @@ -0,0 +1,8 @@ +name +Upper 3 +Lower 4 +Upper 4 +Lower 5 +Upper 5 +Lower 6 +Upper 6 diff --git a/db_schema/kinza.sql b/db_schema/kinza.sql index 81f58d2..3c96e20 100644 --- a/db_schema/kinza.sql +++ b/db_schema/kinza.sql @@ -1,3 +1,15 @@ +CREATE TABLE year ( +id INTEGER PRIMARY KEY AUTO_INCREMENT, +name VARCHAR(255) +) ENGINE=InnoDB; + +CREATE TABLE form ( +id INTEGER PRIMARY KEY AUTO_INCREMENT, +name varchar(255), +year_id INTEGER NOT NULL, +FOREIGN KEY (year_id) REFERENCES year(id) +) ENGINE=InnoDB; + CREATE TABLE course ( id INTEGER PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255) NOT NULL, @@ -19,7 +31,9 @@ id INTEGER PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, -verify VARCHAR(255) +form_id INTEGER, +verify VARCHAR(255), +FOREIGN KEY (form_id) REFERENCES form(id) ) ENGINE=InnoDB; CREATE TABLE presentation (