Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Last active December 30, 2015 08:59
Show Gist options
  • Save hexfusion/7806367 to your computer and use it in GitHub Desktop.
Save hexfusion/7806367 to your computer and use it in GitHub Desktop.
proposed review schema
use utf8;
package Interchange6::Schema::Result::Review;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Interchange6::Schema::Result::Review
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->load_components(qw(TimeStamp));
=head1 TABLE: C<reviews>
=cut
__PACKAGE__->table("reviews");
=head1 DESCRIPTION
User product reviews
B<reviews_id:>
B<sku:>
B<title:>
B<content:>
B<users_id:> Id of user making review NULL if anonymous.
B<name:> Displayed vs actual name of user.
B<rating:> Numeric range 1.0 to 5.0 for item rating.
B<public:> Default is false
B<approved:> Default is false
B<created:>
=cut
=head1 ACCESSORS
=head2 reviews_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
=head2 sku
data_type: 'varchar'
is_nullable: 0
size: 32
=head2 title
data_type: 'varchar'
default_value: (empty string)
is_nullable: 0
size: 255
=head2 content
data_type: 'text'
is_nullable: 0
=head2 users_id
data_type: 'integer'
is_nullable: 1
=head2 name
data_type: 'varchar'
default_value: (empty string)
is_nullable: 0
size: 255
=head2 rating
data_type: 'numeric'
default_value: 0.0
is_nullable: 0
=head2 public
data_type: 'boolean'
default_value: false
is_nullable: 0
=head2 approved
data_type: 'boolean'
default_value: false
is_nullable: 0
=head2 created
data_type: 'datetime'
set_on_create: 1
is_nullable: 0
=cut
__PACKAGE__->add_columns(
"reviews_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"sku",
{ data_type => "varchar", is_nullable => 0, size => 32 },
"title",
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 255 },
"content",
{ data_type => "text", is_nullable => 0 },
"users_id",
{ data_type => "integer", is_nullable => 1 },
"name",
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 255 },
"rating",
{ data_type => "numeric", default_value => 0.0, is_nullable => 0 },
"public",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"approved",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"created",
{ data_type => "datetime", set_on_create => 1, is_nullable => 0 },
);
=head1 PRIMARY KEY
=over 4
=item * L</reviews_id>
=back
=cut
__PACKAGE__->set_primary_key("reviews_id");
=head1 RELATIONS
=head2 user
Type: belongs_to
Related object: L<Interchange6::Schema::Result::User>
=cut
__PACKAGE__->belongs_to(
"user",
"Interchange6::Schema::Result::User",
{ users_id => "users_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-12-05 08:49:16
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JtaRif8NDVRTymg4pwVYMg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment