Skip to content

Commit

Permalink
Made primary keys auto_increment.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Aug 16, 2014
1 parent 547bc35 commit e0b882e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions db/twittelect.sql
@@ -1,18 +1,18 @@
begin; begin;


create table party ( create table party (
id integer primary key, id integer primary key auto_increment,
name varchar(200) not null name varchar(200) not null
); );


create table constituency ( create table constituency (
id integer primary key, id integer primary key auto_increment,
name varchar(200) not null, name varchar(200) not null,
list_name varchar(200) not null list_name varchar(200) not null
); );


create table candidate ( create table candidate (
id integer primary key, id integer primary key auto_increment,
name varchar(200) not null, name varchar(200) not null,
twitter varchar(200), twitter varchar(200),
party_id integer not null, party_id integer not null,
Expand Down
7 changes: 4 additions & 3 deletions lib/TwittElection/Schema/Result/Candidate.pm
Expand Up @@ -43,6 +43,7 @@ __PACKAGE__->table("candidate");
=head2 id =head2 id
data_type: 'integer' data_type: 'integer'
is_auto_increment: 1
is_nullable: 0 is_nullable: 0
=head2 name =head2 name
Expand Down Expand Up @@ -79,7 +80,7 @@ __PACKAGE__->table("candidate");


__PACKAGE__->add_columns( __PACKAGE__->add_columns(
"id", "id",
{ data_type => "integer", is_nullable => 0 }, { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"name", "name",
{ data_type => "varchar", is_nullable => 0, size => 200 }, { data_type => "varchar", is_nullable => 0, size => 200 },
"twitter", "twitter",
Expand Down Expand Up @@ -142,8 +143,8 @@ __PACKAGE__->belongs_to(
); );




# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-15 20:12:34 # Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-16 15:57:37
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CpWHo/zzZ6BBuVPuTXoQAQ # 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 # You can replace this text with custom code or comments, and it will be preserved on regeneration
Expand Down
11 changes: 6 additions & 5 deletions lib/TwittElection/Schema/Result/Constituency.pm
Expand Up @@ -43,6 +43,7 @@ __PACKAGE__->table("constituency");
=head2 id =head2 id
data_type: 'integer' data_type: 'integer'
is_auto_increment: 1
is_nullable: 0 is_nullable: 0
=head2 name =head2 name
Expand All @@ -54,18 +55,18 @@ __PACKAGE__->table("constituency");
=head2 list_name =head2 list_name
data_type: 'varchar' data_type: 'varchar'
is_nullable: 1 is_nullable: 0
size: 200 size: 200
=cut =cut


__PACKAGE__->add_columns( __PACKAGE__->add_columns(
"id", "id",
{ data_type => "integer", is_nullable => 0 }, { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"name", "name",
{ data_type => "varchar", is_nullable => 0, size => 200 }, { data_type => "varchar", is_nullable => 0, size => 200 },
"list_name", "list_name",
{ data_type => "varchar", is_nullable => 1, size => 200 }, { data_type => "varchar", is_nullable => 0, size => 200 },
); );


=head1 PRIMARY KEY =head1 PRIMARY KEY
Expand Down Expand Up @@ -98,8 +99,8 @@ __PACKAGE__->has_many(
); );




# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-15 21:16:34 # Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-16 15:57:37
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XVo8CoAkfeRnlUosED2ESw # 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 # You can replace this text with custom code or comments, and it will be preserved on regeneration
Expand Down
7 changes: 4 additions & 3 deletions lib/TwittElection/Schema/Result/Party.pm
Expand Up @@ -43,6 +43,7 @@ __PACKAGE__->table("party");
=head2 id =head2 id
data_type: 'integer' data_type: 'integer'
is_auto_increment: 1
is_nullable: 0 is_nullable: 0
=head2 name =head2 name
Expand All @@ -55,7 +56,7 @@ __PACKAGE__->table("party");


__PACKAGE__->add_columns( __PACKAGE__->add_columns(
"id", "id",
{ data_type => "integer", is_nullable => 0 }, { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"name", "name",
{ data_type => "varchar", is_nullable => 0, size => 200 }, { data_type => "varchar", is_nullable => 0, size => 200 },
); );
Expand Down Expand Up @@ -90,8 +91,8 @@ __PACKAGE__->has_many(
); );




# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-15 20:12:34 # Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-16 15:57:37
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JCZbMFhxCEvMkmUtkSBc6A # 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 # You can replace this text with custom code or comments, and it will be preserved on regeneration
Expand Down

0 comments on commit e0b882e

Please sign in to comment.