Permalink
Browse files

Created DBIC schema/model "DB"

  • Loading branch information...
vanstyn committed Sep 12, 2013
1 parent 734d852 commit beb8d0ad1200f77338aa976097f74033743bdd6f
@@ -131,3 +131,17 @@ ls -lh sql/Chinook_Sqlite_AutoIncrementPKs.sql
time sqlite3 chinook.db < sql/Chinook_Sqlite_AutoIncrementPKs.sql
#
Commit 'setup chinook SQLite database'
#
# Create DBIC schema/model (using the Catalyst Helper)
# -See: metacpan.org/module/Catalyst::Helper::Model::DBIC::Schema
script/ra_chinookdemo_create.pl \
model DB \
DBIC::Schema \
RA::ChinookDemo::DB \
create=static generate_pod=0 \
dbi:SQLite:chinook.db \
sqlite_unicode=1 \
on_connect_call='use_foreign_keys' \
quote_names=1 #<-- required for RapidApp
#
Commit 'Created DBIC schema/model "DB"'
@@ -0,0 +1,20 @@
use utf8;
package RA::ChinookDemo::DB;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

use Moose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Schema';

__PACKAGE__->load_namespaces;


# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-09-12 15:36:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SdloKbUgCjcIoDCVNimcOQ


# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable(inline_constructor => 0);
1;
@@ -0,0 +1,45 @@
use utf8;
package RA::ChinookDemo::DB::Result::Album;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

use strict;
use warnings;

use Moose;
use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime");
__PACKAGE__->table("Album");
__PACKAGE__->add_columns(
"albumid",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"title",
{ data_type => "nvarchar", is_nullable => 0, size => 160 },
"artistid",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
);
__PACKAGE__->set_primary_key("albumid");
__PACKAGE__->belongs_to(
"artistid",
"RA::ChinookDemo::DB::Result::Artist",
{ artistid => "artistid" },
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
);
__PACKAGE__->has_many(
"tracks",
"RA::ChinookDemo::DB::Result::Track",
{ "foreign.albumid" => "self.albumid" },
{ cascade_copy => 0, cascade_delete => 0 },
);


# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-09-12 15:36:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OJ1U992pTI/1TC7qsm8syA


# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;
@@ -0,0 +1,37 @@
use utf8;
package RA::ChinookDemo::DB::Result::Artist;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

use strict;
use warnings;

use Moose;
use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime");
__PACKAGE__->table("Artist");
__PACKAGE__->add_columns(
"artistid",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"name",
{ data_type => "nvarchar", is_nullable => 1, size => 120 },
);
__PACKAGE__->set_primary_key("artistid");
__PACKAGE__->has_many(
"albums",
"RA::ChinookDemo::DB::Result::Album",
{ "foreign.artistid" => "self.artistid" },
{ cascade_copy => 0, cascade_delete => 0 },
);


# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-09-12 15:36:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EusSaT3RBFkQFnk46nXHBg


# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;
@@ -0,0 +1,70 @@
use utf8;
package RA::ChinookDemo::DB::Result::Customer;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

use strict;
use warnings;

use Moose;
use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime");
__PACKAGE__->table("Customer");
__PACKAGE__->add_columns(
"customerid",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"firstname",
{ data_type => "nvarchar", is_nullable => 0, size => 40 },
"lastname",
{ data_type => "nvarchar", is_nullable => 0, size => 20 },
"company",
{ data_type => "nvarchar", is_nullable => 1, size => 80 },
"address",
{ data_type => "nvarchar", is_nullable => 1, size => 70 },
"city",
{ data_type => "nvarchar", is_nullable => 1, size => 40 },
"state",
{ data_type => "nvarchar", is_nullable => 1, size => 40 },
"country",
{ data_type => "nvarchar", is_nullable => 1, size => 40 },
"postalcode",
{ data_type => "nvarchar", is_nullable => 1, size => 10 },
"phone",
{ data_type => "nvarchar", is_nullable => 1, size => 24 },
"fax",
{ data_type => "nvarchar", is_nullable => 1, size => 24 },
"email",
{ data_type => "nvarchar", is_nullable => 0, size => 60 },
"supportrepid",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
);
__PACKAGE__->set_primary_key("customerid");
__PACKAGE__->has_many(
"invoices",
"RA::ChinookDemo::DB::Result::Invoice",
{ "foreign.customerid" => "self.customerid" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->belongs_to(
"supportrepid",
"RA::ChinookDemo::DB::Result::Employee",
{ employeeid => "supportrepid" },
{
is_deferrable => 0,
join_type => "LEFT",
on_delete => "NO ACTION",
on_update => "NO ACTION",
},
);


# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-09-12 15:36:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3WdAq+vRAFXbRXBhHpK3TQ


# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;
@@ -0,0 +1,80 @@
use utf8;
package RA::ChinookDemo::DB::Result::Employee;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

use strict;
use warnings;

use Moose;
use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime");
__PACKAGE__->table("Employee");
__PACKAGE__->add_columns(
"employeeid",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"lastname",
{ data_type => "nvarchar", is_nullable => 0, size => 20 },
"firstname",
{ data_type => "nvarchar", is_nullable => 0, size => 20 },
"title",
{ data_type => "nvarchar", is_nullable => 1, size => 30 },
"reportsto",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"birthdate",
{ data_type => "datetime", is_nullable => 1 },
"hiredate",
{ data_type => "datetime", is_nullable => 1 },
"address",
{ data_type => "nvarchar", is_nullable => 1, size => 70 },
"city",
{ data_type => "nvarchar", is_nullable => 1, size => 40 },
"state",
{ data_type => "nvarchar", is_nullable => 1, size => 40 },
"country",
{ data_type => "nvarchar", is_nullable => 1, size => 40 },
"postalcode",
{ data_type => "nvarchar", is_nullable => 1, size => 10 },
"phone",
{ data_type => "nvarchar", is_nullable => 1, size => 24 },
"fax",
{ data_type => "nvarchar", is_nullable => 1, size => 24 },
"email",
{ data_type => "nvarchar", is_nullable => 1, size => 60 },
);
__PACKAGE__->set_primary_key("employeeid");
__PACKAGE__->has_many(
"customers",
"RA::ChinookDemo::DB::Result::Customer",
{ "foreign.supportrepid" => "self.employeeid" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"employees",
"RA::ChinookDemo::DB::Result::Employee",
{ "foreign.reportsto" => "self.employeeid" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->belongs_to(
"reportsto",
"RA::ChinookDemo::DB::Result::Employee",
{ employeeid => "reportsto" },
{
is_deferrable => 0,
join_type => "LEFT",
on_delete => "NO ACTION",
on_update => "NO ACTION",
},
);


# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-09-12 15:36:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wHFFXU19HU2txd7Slmw1vg


# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;
@@ -0,0 +1,37 @@
use utf8;
package RA::ChinookDemo::DB::Result::Genre;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

use strict;
use warnings;

use Moose;
use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime");
__PACKAGE__->table("Genre");
__PACKAGE__->add_columns(
"genreid",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"name",
{ data_type => "nvarchar", is_nullable => 1, size => 120 },
);
__PACKAGE__->set_primary_key("genreid");
__PACKAGE__->has_many(
"tracks",
"RA::ChinookDemo::DB::Result::Track",
{ "foreign.genreid" => "self.genreid" },
{ cascade_copy => 0, cascade_delete => 0 },
);


# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-09-12 15:36:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:k+LIjeuX0t6DkWKxJ3qVUA


# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;
@@ -0,0 +1,57 @@
use utf8;
package RA::ChinookDemo::DB::Result::Invoice;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

use strict;
use warnings;

use Moose;
use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime");
__PACKAGE__->table("Invoice");
__PACKAGE__->add_columns(
"invoiceid",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"customerid",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"invoicedate",
{ data_type => "datetime", is_nullable => 0 },
"billingaddress",
{ data_type => "nvarchar", is_nullable => 1, size => 70 },
"billingcity",
{ data_type => "nvarchar", is_nullable => 1, size => 40 },
"billingstate",
{ data_type => "nvarchar", is_nullable => 1, size => 40 },
"billingcountry",
{ data_type => "nvarchar", is_nullable => 1, size => 40 },
"billingpostalcode",
{ data_type => "nvarchar", is_nullable => 1, size => 10 },
"total",
{ data_type => "numeric", is_nullable => 0, size => [10, 2] },
);
__PACKAGE__->set_primary_key("invoiceid");
__PACKAGE__->belongs_to(
"customerid",
"RA::ChinookDemo::DB::Result::Customer",
{ customerid => "customerid" },
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
);
__PACKAGE__->has_many(
"invoice_lines",
"RA::ChinookDemo::DB::Result::InvoiceLine",
{ "foreign.invoiceid" => "self.invoiceid" },
{ cascade_copy => 0, cascade_delete => 0 },
);


# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-09-12 15:36:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:J8wpjsKmVyoFQnEzPmQDtw


# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;
Oops, something went wrong.

0 comments on commit beb8d0a

Please sign in to comment.