Permalink
Browse files

schema changes

  • Loading branch information...
1 parent e6add53 commit 7e17fd372356533b10be703583722b6e21477094 @nobuo-danjou nobuo-danjou committed Oct 19, 2009
@@ -129,7 +129,7 @@ sub invite_complete :Private {
caller_id => $c->user->id,
mail => $mail,
nonce => sha1_base64($now . $mail . $c->user . rand),
- created_at => $now,
+# created_at => $now,
});
$c->stash(
email => {
@@ -203,7 +203,7 @@ sub join_complete :Private {
);
$invitation->update({
member_id => $member->id,
- joined_at => DateTime->now,
+ joined_at => DateTime->now(time_zone => 'Asia/Tokyo'),
});
$c->stash(
email => {
@@ -5,51 +5,56 @@ use warnings;
use base 'DBIx::Class';
-__PACKAGE__->load_components("Core");
+__PACKAGE__->load_components(qw(InflateColumn::DateTime TimeStamp Core));
__PACKAGE__->table("invitation");
__PACKAGE__->add_columns(
- "id",
- { data_type => "INT", default_value => undef, is_nullable => 0, size => 11 },
- "caller_id",
- { data_type => "INT", default_value => 0, is_nullable => 0, size => 11 },
- "mail",
- { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 128 },
- "nonce",
- { data_type => "CHAR", default_value => "", is_nullable => 0, size => 27 },
- "created_at",
- {
- data_type => "DATETIME",
- default_value => undef,
- is_nullable => 1,
- size => 19,
- },
- "member_id",
- { data_type => "INT", default_value => undef, is_nullable => 1, size => 11 },
- "joined_at",
- {
- data_type => "DATETIME",
- default_value => undef,
- is_nullable => 1,
- size => 19,
- },
-);
-__PACKAGE__->set_primary_key("id");
-
-
-# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-11 10:30:58
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xbH4VI+JKPmWSrAFYt3WgA
-
-__PACKAGE__->load_components(qw(InflateColumn::DateTime));
-__PACKAGE__->add_columns(
- created_at => {
- data_type => 'datetime',
+ id => {
+ data_type => "INT",
+ default_value => undef,
+ is_nullable => 0,
+ size => 11
+ },
+ caller_id => {
+ data_type => "INT",
+ default_value => 0,
+ is_nullable => 0,
+ size => 11
+ },
+ mail => {
+ data_type => "VARCHAR",
+ default_value => "",
+ is_nullable => 0,
+ size => 128
+ },
+ nonce => {
+ data_type => "CHAR",
+ default_value => "",
+ is_nullable => 0,
+ size => 27
+ },
+ created_at => {
+ data_type => "DATETIME",
+ default_value => undef,
+ is_nullable => 1,
+ size => 19,
timezone => 'Asia/Tokyo',
+ set_on_create => 1,
+ },
+ member_id => {
+ data_type => "INT",
+ default_value => undef,
+ is_nullable => 1,
+ size => 11
},
joined_at => {
- data_type => 'datetime',
+ data_type => "DATETIME",
+ default_value => undef,
+ is_nullable => 1,
+ size => 19,
timezone => 'Asia/Tokyo',
},
);
-# You can replace this text with custom content, and it will be preserved on regeneration
+__PACKAGE__->set_primary_key("id");
+
1;
@@ -8,26 +8,42 @@ use base 'DBIx::Class';
__PACKAGE__->load_components("Core");
__PACKAGE__->table("member");
__PACKAGE__->add_columns(
- "id",
- { data_type => "INT", default_value => undef, is_nullable => 0, size => 11 },
- "nickname",
- { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 32 },
- "mail",
- { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 128 },
- "password",
- { data_type => "CHAR", default_value => "", is_nullable => 0, size => 27 },
- "caller_id",
- { data_type => "INT", default_value => 0, is_nullable => 0, size => 11 },
+ id => {
+ data_type => "INT",
+ default_value => undef,
+ is_nullable => 0,
+ is_auto_increment => 1,
+ size => 11
+ },
+ nickname => {
+ data_type => "VARCHAR",
+ default_value => "",
+ is_nullable => 0,
+ size => 32
+ },
+ mail => {
+ data_type => "VARCHAR",
+ default_value => "",
+ is_nullable => 0,
+ size => 128
+ },
+ password => {
+ data_type => "CHAR",
+ default_value => "",
+ is_nullable => 0,
+ size => 27
+ },
+ caller_id => {
+ data_type => "INT",
+ default_value => 0,
+ is_nullable => 0,
+ size => 11
+ },
);
__PACKAGE__->set_primary_key("id");
-
-# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-11 10:30:58
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:f7trw8KfVQcow3GDnVy1Dw
-
__PACKAGE__->has_many(map_member_role => 'GourmetSpot::Schema::MemberRole' => 'member_id');
__PACKAGE__->many_to_many(roles => 'map_member_role' => 'role');
__PACKAGE__->has_many(reviews => 'GourmetSpot::Schema::Review' => 'created_by');
-# You can replace this text with custom content, and it will be preserved on regeneration
1;
@@ -8,19 +8,21 @@ use base 'DBIx::Class';
__PACKAGE__->load_components("Core");
__PACKAGE__->table("member_role");
__PACKAGE__->add_columns(
- "member_id",
- { data_type => "INT", default_value => 0, is_nullable => 0, size => 11 },
- "role_id",
- { data_type => "INT", default_value => 0, is_nullable => 0, size => 11 },
+ member_id => {
+ data_type => "INT",
+ default_value => 0,
+ is_nullable => 0,
+ size => 11
+ },
+ role_id => {
+ data_type => "INT",
+ default_value => 0,
+ is_nullable => 0,
+ size => 11
+ },
);
__PACKAGE__->set_primary_key("member_id", "role_id");
-
-
-# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-11 10:30:58
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4XZ1gQ0XREFfxhTKtpPzWQ
-
__PACKAGE__->belongs_to( member => 'GourmetSpot::Schema::Member', 'member_id' );
__PACKAGE__->belongs_to( role => 'GourmetSpot::Schema::Role', 'role_id' );
-# You can replace this text with custom content, and it will be preserved on regeneration
1;
@@ -5,34 +5,87 @@ use warnings;
use base 'DBIx::Class';
-__PACKAGE__->load_components("Core");
+__PACKAGE__->load_components(qw(InflateColumn::DateTime Core));
__PACKAGE__->table("open_hours");
__PACKAGE__->add_columns(
- "id",
- { data_type => "INT", default_value => undef, is_nullable => 0, size => 11 },
- "restrant_id",
- { data_type => "INT", default_value => 0, is_nullable => 0, size => 11 },
- "day_of_week",
- { data_type => "SET", default_value => undef, is_nullable => 1, size => 27 },
- "holiday",
- { data_type => "ENUM", default_value => "false", is_nullable => 0, size => 6 },
- "pre_holiday",
- { data_type => "ENUM", default_value => "false", is_nullable => 0, size => 6 },
- "opens_at",
- { data_type => "TIME", default_value => undef, is_nullable => 1, size => 8 },
- "closes_at",
- { data_type => "TIME", default_value => undef, is_nullable => 1, size => 8 },
+ id => {
+ data_type => "INT",
+ default_value => undef,
+ is_nullable => 0,
+ is_auto_increment => 1,
+ size => 11
+ },
+ restrant_id => {
+ data_type => "INT",
+ default_value => 0,
+ is_nullable => 0,
+ size => 11
+ },
+ day_of_week => {
+ data_type => "SET",
+ default_value => undef,
+ is_nullable => 1,
+ size => 27,
+ extra => {
+ list => [qw(
+ Sun
+ Mon
+ Tue
+ Wed
+ Thu
+ Fri
+ Sat
+ )],
+ }
+ },
+ holiday => {
+ data_type => "ENUM",
+ default_value => "false",
+ is_nullable => 0,
+ size => 6,
+ extra => {
+ list => [qw(
+ true
+ false
+ masked
+ )]
+ }
+ },
+ pre_holiday => {
+ data_type => "ENUM",
+ default_value => "false",
+ is_nullable => 0,
+ size => 6,
+ extra => {
+ list => [qw(
+ true
+ false
+ masked
+ )]
+ }
+ },
+ opens_at => {
+ data_type => "TIME",
+ default_value => undef,
+ is_nullable => 1,
+ time_zone => 'Asia/Tokyo',
+ size => 8
+ },
+ closes_at => {
+ data_type => "TIME",
+ default_value => undef,
+ is_nullable => 1,
+ time_zone => 'Asia/Tokyo',
+ size => 8,
+ },
);
__PACKAGE__->set_primary_key("id");
-
-# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-11 10:30:58
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RuNVaKPUp5V9eDzME56PdQ
-
-__PACKAGE__->inflate_column('day_of_week', {
+__PACKAGE__->inflate_column(
+ day_of_week => {
inflate => sub { +{ map {($_ => 1)} split( ',', $_[0] ) } },
deflate => sub { join( ',', @{ $_[0] } ) },
- });
+ }
+);
-# You can replace this text with custom content, and it will be preserved on regeneration
1;
@@ -5,39 +5,42 @@ use warnings;
use base 'DBIx::Class';
-__PACKAGE__->load_components("Core");
+__PACKAGE__->load_components(qw(InflateColumn::DateTime Core));
__PACKAGE__->table("reset_password");
__PACKAGE__->add_columns(
- "id",
- { data_type => "INT", default_value => undef, is_nullable => 0, size => 11 },
- "member_id",
- { data_type => "INT", default_value => 0, is_nullable => 0, size => 11 },
- "nonce",
- { data_type => "CHAR", default_value => "", is_nullable => 0, size => 27 },
- "expires_at",
- {
- data_type => "DATETIME",
- default_value => undef,
- is_nullable => 1,
- size => 19,
- },
-);
-__PACKAGE__->set_primary_key("id");
-
-
-# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-11 10:30:58
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CJ1EI7tDjgPEj6zHtbHtBQ
-
-__PACKAGE__->load_components(qw(InflateColumn::DateTime));
-
-__PACKAGE__->add_columns(
+ id => {
+ data_type => "INT",
+ default_value => undef,
+ is_nullable => 0,
+ is_auto_increment => 1,
+ size => 11,
+ },
+ member_id => {
+ data_type => "INT",
+ default_value => 0,
+ is_nullable => 0,
+ size => 11
+ },
+ nonce => {
+ data_type => "CHAR",
+ default_value => "",
+ is_nullable => 0,
+ size => 27
+ },
expires_at => {
- data_type => 'datetime',
+ data_type => "DATETIME",
timezone => 'Asia/Tokyo',
+ default_value => undef,
+ is_nullable => 1,
+ size => 19,
},
);
+__PACKAGE__->set_primary_key("id");
-__PACKAGE__->belongs_to( member => 'GourmetSpot::Schema::Member' => 'member_id' );
+__PACKAGE__->belongs_to(
+ 'member',
+ 'GourmetSpot::Schema::Member',
+ 'member_id'
+);
-# You can replace this text with custom content, and it will be preserved on regeneration
1;
Oops, something went wrong.

0 comments on commit 7e17fd3

Please sign in to comment.