From e0b882e6083853e0e3cfbdd23b6111387c533c63 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 16 Aug 2014 16:02:47 +0100 Subject: [PATCH] Made primary keys auto_increment. --- db/twittelect.sql | 6 +++--- lib/TwittElection/Schema/Result/Candidate.pm | 7 ++++--- lib/TwittElection/Schema/Result/Constituency.pm | 11 ++++++----- lib/TwittElection/Schema/Result/Party.pm | 7 ++++--- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/db/twittelect.sql b/db/twittelect.sql index 89ad596437..264d150281 100644 --- a/db/twittelect.sql +++ b/db/twittelect.sql @@ -1,18 +1,18 @@ begin; create table party ( - id integer primary key, + id integer primary key auto_increment, name varchar(200) not null ); create table constituency ( - id integer primary key, + id integer primary key auto_increment, name varchar(200) not null, list_name varchar(200) not null ); create table candidate ( - id integer primary key, + id integer primary key auto_increment, name varchar(200) not null, twitter varchar(200), party_id integer not null, diff --git a/lib/TwittElection/Schema/Result/Candidate.pm b/lib/TwittElection/Schema/Result/Candidate.pm index 6f55a09566..a9552a7937 100644 --- a/lib/TwittElection/Schema/Result/Candidate.pm +++ b/lib/TwittElection/Schema/Result/Candidate.pm @@ -43,6 +43,7 @@ __PACKAGE__->table("candidate"); =head2 id data_type: 'integer' + is_auto_increment: 1 is_nullable: 0 =head2 name @@ -79,7 +80,7 @@ __PACKAGE__->table("candidate"); __PACKAGE__->add_columns( "id", - { data_type => "integer", is_nullable => 0 }, + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "name", { data_type => "varchar", is_nullable => 0, size => 200 }, "twitter", @@ -142,8 +143,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-15 20:12:34 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CpWHo/zzZ6BBuVPuTXoQAQ +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-16 15:57:37 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yJTz5z4i1okZ1z9DkRBABw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/lib/TwittElection/Schema/Result/Constituency.pm b/lib/TwittElection/Schema/Result/Constituency.pm index 0af6becfa1..d5cb699e0c 100644 --- a/lib/TwittElection/Schema/Result/Constituency.pm +++ b/lib/TwittElection/Schema/Result/Constituency.pm @@ -43,6 +43,7 @@ __PACKAGE__->table("constituency"); =head2 id data_type: 'integer' + is_auto_increment: 1 is_nullable: 0 =head2 name @@ -54,18 +55,18 @@ __PACKAGE__->table("constituency"); =head2 list_name data_type: 'varchar' - is_nullable: 1 + is_nullable: 0 size: 200 =cut __PACKAGE__->add_columns( "id", - { data_type => "integer", is_nullable => 0 }, + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "name", { data_type => "varchar", is_nullable => 0, size => 200 }, "list_name", - { data_type => "varchar", is_nullable => 1, size => 200 }, + { data_type => "varchar", is_nullable => 0, size => 200 }, ); =head1 PRIMARY KEY @@ -98,8 +99,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-15 21:16:34 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XVo8CoAkfeRnlUosED2ESw +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-16 15:57:37 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Hnn6Yg3WzYjCUHlas6197g # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/lib/TwittElection/Schema/Result/Party.pm b/lib/TwittElection/Schema/Result/Party.pm index f9f6fa87c4..85c68b960d 100644 --- a/lib/TwittElection/Schema/Result/Party.pm +++ b/lib/TwittElection/Schema/Result/Party.pm @@ -43,6 +43,7 @@ __PACKAGE__->table("party"); =head2 id data_type: 'integer' + is_auto_increment: 1 is_nullable: 0 =head2 name @@ -55,7 +56,7 @@ __PACKAGE__->table("party"); __PACKAGE__->add_columns( "id", - { data_type => "integer", is_nullable => 0 }, + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "name", { data_type => "varchar", is_nullable => 0, size => 200 }, ); @@ -90,8 +91,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-15 20:12:34 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JCZbMFhxCEvMkmUtkSBc6A +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-16 15:57:37 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0AnUi1W5jVeiJjxX2M4aKg # You can replace this text with custom code or comments, and it will be preserved on regeneration