From d80740a48e3b93f7e6009a8128ee815b0da9e140 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 9 Aug 2007 14:39:47 +0000 Subject: [PATCH] Bugfixing + perltidy git-svn-id: http://svn.brehm-online.com/svn/cookbook/trunk@15 191103c4-1d37-0410-b3e5-d8c2315c0aac --- lib/CookBook.pm | 2 +- lib/CookBook/Db/Recipes.pm | 34 ++++----- lib/CookBook/Db/Session.pm | 9 +-- lib/CookBook/Plugin/ConfigLoader.pm | 8 +++ lib/CookBookDb.pm | 2 - lib/CookBookDb/Authors.pm | 19 ++--- lib/CookBookDb/RecipeAuthors.pm | 17 ++--- lib/CookBookDb/Recipes.pm | 81 +++++++++++----------- lib/CookBookDb/Session.pm | 11 +-- lib/CookBookDb/SessionLog.pm | 104 +++++++++++++--------------- lib/CookBookDb/Users.pm | 40 ++++------- lib/CookBookDb/YieldTypes.pm | 13 ++-- sbin/initial_import.pl | 71 +++++++++---------- 13 files changed, 182 insertions(+), 229 deletions(-) diff --git a/lib/CookBook.pm b/lib/CookBook.pm index 42d9c37..0f833eb 100644 --- a/lib/CookBook.pm +++ b/lib/CookBook.pm @@ -17,7 +17,7 @@ use Catalyst::Runtime '5.70'; use Catalyst qw/ - ConfigLoader + +CookBook::Plugin::ConfigLoader Static::Simple diff --git a/lib/CookBook/Db/Recipes.pm b/lib/CookBook/Db/Recipes.pm index a19ffc5..fb65562 100644 --- a/lib/CookBook/Db/Recipes.pm +++ b/lib/CookBook/Db/Recipes.pm @@ -39,25 +39,27 @@ __PACKAGE__->add_columns( 'is_auto_increment' => 1, 'extras' => { 'unsigned' => 1 }, }, - "rid" => { 'data_type' => "CHAR", 'default_value' => "", 'is_nullable' => 0, 'size' => 32, }, - "title" => { 'data_type' => "VARCHAR", 'default_value' => "", 'is_nullable' => 0, 'size' => 250, }, - "published" => { 'data_type' => "ENUM", 'default_value' => "n", 'is_nullable' => 0, 'size' => 1, }, - "deleted" => { 'data_type' => "ENUM", 'default_value' => "n", 'is_nullable' => 0, 'size' => 1, }, - "locked" => { 'data_type' => "ENUM", 'default_value' => "n", 'is_nullable' => 0, 'size' => 1, }, - "preface" => { 'data_type' => "TEXT", 'default_value' => "", 'is_nullable' => 1, 'size' => 65535, }, - "instructions" => { 'data_type' => "TEXT", 'default_value' => "", 'is_nullable' => 0, 'size' => 65535, }, - "yield_amount" => { 'data_type' => "FLOAT", 'default_value' => 0, 'is_nullable' => 0, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, - "yield_amount_offset" => { 'data_type' => "FLOAT", 'default_value' => undef, 'is_nullable' => 1, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, - "yield_type_id" => { 'data_type' => "INT", 'default_value' => undef, 'is_nullable' => 1, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, - "prep_time" => { 'data_type' => "TIME", 'default_value' => undef, 'is_nullable' => 1, 'size' => 8, }, - "date_created" => { 'data_type' => "DATETIME", 'default_value' => "", 'is_nullable' => 0, 'size' => 19, }, - "user_created" => { 'data_type' => "INT", 'default_value' => 0, 'is_nullable' => 0, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, - "date_changed" => { 'data_type' => "DATETIME", 'default_value' => "", 'is_nullable' => 0, 'size' => 19, }, - "user_changed" => { 'data_type' => "INT", 'default_value' => 0, 'is_nullable' => 0, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, + "rid" => { 'data_type' => "CHAR", 'default_value' => "", 'is_nullable' => 0, 'size' => 32, }, + "title" => { 'data_type' => "VARCHAR", 'default_value' => "", 'is_nullable' => 0, 'size' => 250, }, + "published" => { 'data_type' => "ENUM", 'default_value' => "n", 'is_nullable' => 0, 'size' => 1, }, + "deleted" => { 'data_type' => "ENUM", 'default_value' => "n", 'is_nullable' => 0, 'size' => 1, }, + "locked" => { 'data_type' => "ENUM", 'default_value' => "n", 'is_nullable' => 0, 'size' => 1, }, + "preface" => { 'data_type' => "TEXT", 'default_value' => "", 'is_nullable' => 1, 'size' => 65535, }, + "instructions" => { 'data_type' => "TEXT", 'default_value' => "", 'is_nullable' => 0, 'size' => 65535, }, + "yield_amount" => { 'data_type' => "FLOAT", 'default_value' => 0, 'is_nullable' => 0, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, + "yield_amount_offset" => + { 'data_type' => "FLOAT", 'default_value' => undef, 'is_nullable' => 1, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, + "yield_type_id" => + { 'data_type' => "INT", 'default_value' => undef, 'is_nullable' => 1, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, + "prep_time" => { 'data_type' => "TIME", 'default_value' => undef, 'is_nullable' => 1, 'size' => 8, }, + "date_created" => { 'data_type' => "DATETIME", 'default_value' => "", 'is_nullable' => 0, 'size' => 19, }, + "user_created" => { 'data_type' => "INT", 'default_value' => 0, 'is_nullable' => 0, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, + "date_changed" => { 'data_type' => "DATETIME", 'default_value' => "", 'is_nullable' => 0, 'size' => 19, }, + "user_changed" => { 'data_type' => "INT", 'default_value' => 0, 'is_nullable' => 0, 'size' => 10, 'extras' => { 'unsigned' => 1 }, }, ); __PACKAGE__->set_primary_key("recipe_id"); -__PACKAGE__->add_unique_constraint("rid", ["rid"]); +__PACKAGE__->add_unique_constraint( "rid", ["rid"] ); __PACKAGE__->might_have( 'create_user' => 'CookBook::Db::Users', { 'foreign.user_id' => 'self.user_created' } ); __PACKAGE__->might_have( 'change_user' => 'CookBook::Db::Users', { 'foreign.user_id' => 'self.user_changed' } ); diff --git a/lib/CookBook/Db/Session.pm b/lib/CookBook/Db/Session.pm index 09e8007..7f16d02 100644 --- a/lib/CookBook/Db/Session.pm +++ b/lib/CookBook/Db/Session.pm @@ -21,15 +21,16 @@ use warnings; use CookBook::Common; use base qw/DBIx::Class/; -__PACKAGE__->load_components(qw/ - Core -/); +__PACKAGE__->load_components( + qw/ + Core + / +); __PACKAGE__->table('session'); __PACKAGE__->add_columns(qw/id session_data expires/); __PACKAGE__->set_primary_key('id'); - 1; diff --git a/lib/CookBook/Plugin/ConfigLoader.pm b/lib/CookBook/Plugin/ConfigLoader.pm index 603172d..72a032b 100644 --- a/lib/CookBook/Plugin/ConfigLoader.pm +++ b/lib/CookBook/Plugin/ConfigLoader.pm @@ -15,6 +15,8 @@ my %LogLevels = ( 'DEBUG' => 1, ); +#--------------------------------------------------------------------------- + =head2 finalize_config This method is called after the config file is loaded. It can be @@ -39,6 +41,8 @@ sub finalize_config { $c->SUPER::finalize_config(); + $c->config->{'debug_level'} = to_int( $c->config->{'debug_level'} ) ? to_int( $c->config->{'debug_level'} ) : 0; + # Vorgabe-View festlegen (kann mit $c->stash->{'current_view_instance'} oder $c->stash->{'current_view'} ueberschrieben werden.) $c->config()->{'default_view'} = 'TT' unless $c->config()->{'default_view'}; @@ -90,5 +94,9 @@ sub finalize_config { } ## end sub finalize_config +#--------------------------------------------------------------------------- + 1; +#--------------------------------------------------------------------------- + diff --git a/lib/CookBookDb.pm b/lib/CookBookDb.pm index 1953e2c..419d2d7 100644 --- a/lib/CookBookDb.pm +++ b/lib/CookBookDb.pm @@ -7,10 +7,8 @@ use base 'DBIx::Class::Schema'; __PACKAGE__->load_classes; - # Created by DBIx::Class::Schema::Loader v0.04002 @ 2007-08-09 16:13:40 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:K8bZ7fKZDMRmA4VFZOZxlw - # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/lib/CookBookDb/Authors.pm b/lib/CookBookDb/Authors.pm index 3896941..9c88a64 100644 --- a/lib/CookBookDb/Authors.pm +++ b/lib/CookBookDb/Authors.pm @@ -8,24 +8,17 @@ use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("authors"); __PACKAGE__->add_columns( - "author_id", - { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, - "user_id", - { data_type => "INT", default_value => undef, is_nullable => 1, size => 10 }, - "old_author_id", - { data_type => "INT", default_value => undef, is_nullable => 1, size => 11 }, - "author_name", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 100 }, - "date_created", - { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, + "author_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, + "user_id", { data_type => "INT", default_value => undef, is_nullable => 1, size => 10 }, + "old_author_id", { data_type => "INT", default_value => undef, is_nullable => 1, size => 11 }, + "author_name", { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 100 }, + "date_created", { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, ); __PACKAGE__->set_primary_key("author_id"); -__PACKAGE__->add_unique_constraint("author_name", ["author_name"]); - +__PACKAGE__->add_unique_constraint( "author_name", ["author_name"] ); # Created by DBIx::Class::Schema::Loader v0.04002 @ 2007-08-09 16:13:40 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/TukBw4LW+WnFPWauqg4pQ - # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/lib/CookBookDb/RecipeAuthors.pm b/lib/CookBookDb/RecipeAuthors.pm index 5c0a733..1c59b73 100644 --- a/lib/CookBookDb/RecipeAuthors.pm +++ b/lib/CookBookDb/RecipeAuthors.pm @@ -8,23 +8,16 @@ use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("recipe_authors"); __PACKAGE__->add_columns( - "recipe_author_id", - { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, - "recipe_id", - { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, - "author_id", - { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, - "order_index", - { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, - "date_created", - { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, + "recipe_author_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, + "recipe_id", { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, + "author_id", { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, + "order_index", { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, + "date_created", { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, ); __PACKAGE__->set_primary_key("recipe_author_id"); - # Created by DBIx::Class::Schema::Loader v0.04002 @ 2007-08-09 16:13:40 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KFDI7zAqfecL+bbLpF1nNw - # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/lib/CookBookDb/Recipes.pm b/lib/CookBookDb/Recipes.pm index b713b4c..cb2eaaf 100644 --- a/lib/CookBookDb/Recipes.pm +++ b/lib/CookBookDb/Recipes.pm @@ -8,53 +8,50 @@ use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("recipes"); __PACKAGE__->add_columns( - "recipe_id", - { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, - "old_recipe_id", - { data_type => "INT", default_value => undef, is_nullable => 1, size => 11 }, - "rid", - { data_type => "CHAR", default_value => "", is_nullable => 0, size => 32 }, - "title", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 250 }, - "published", - { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, - "deleted", - { data_type => "ENUM", default_value => "", is_nullable => 0, size => 1 }, - "locked", - { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, - "preface", - { - data_type => "TEXT", - default_value => undef, - is_nullable => 1, - size => 65535, - }, - "instructions", - { data_type => "TEXT", default_value => "", is_nullable => 0, size => 65535 }, - "yield_amount", - { data_type => "FLOAT", default_value => 0, is_nullable => 0, size => 32 }, - "yield_amount_offset", - { data_type => "FLOAT", default_value => undef, is_nullable => 1, size => 32 }, - "yield_type_id", - { data_type => "INT", default_value => undef, is_nullable => 1, size => 10 }, - "prep_time", - { data_type => "TIME", default_value => undef, is_nullable => 1, size => 8 }, - "date_created", - { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, - "user_created", - { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, - "date_changed", - { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, - "user_changed", - { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, + "recipe_id", + { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, + "old_recipe_id", + { data_type => "INT", default_value => undef, is_nullable => 1, size => 11 }, + "rid", + { data_type => "CHAR", default_value => "", is_nullable => 0, size => 32 }, + "title", + { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 250 }, + "published", + { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, + "deleted", + { data_type => "ENUM", default_value => "", is_nullable => 0, size => 1 }, + "locked", + { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, + "preface", + { data_type => "TEXT", + default_value => undef, + is_nullable => 1, + size => 65535, + }, + "instructions", + { data_type => "TEXT", default_value => "", is_nullable => 0, size => 65535 }, + "yield_amount", + { data_type => "FLOAT", default_value => 0, is_nullable => 0, size => 32 }, + "yield_amount_offset", + { data_type => "FLOAT", default_value => undef, is_nullable => 1, size => 32 }, + "yield_type_id", + { data_type => "INT", default_value => undef, is_nullable => 1, size => 10 }, + "prep_time", + { data_type => "TIME", default_value => undef, is_nullable => 1, size => 8 }, + "date_created", + { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, + "user_created", + { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, + "date_changed", + { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, + "user_changed", + { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, ); __PACKAGE__->set_primary_key("recipe_id"); -__PACKAGE__->add_unique_constraint("rid", ["rid"]); - +__PACKAGE__->add_unique_constraint( "rid", ["rid"] ); # Created by DBIx::Class::Schema::Loader v0.04002 @ 2007-08-09 16:13:40 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pKlDxFw7PBwJQ+h8Z8FxLQ - # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/lib/CookBookDb/Session.pm b/lib/CookBookDb/Session.pm index 60daf20..2ca92d7 100644 --- a/lib/CookBookDb/Session.pm +++ b/lib/CookBookDb/Session.pm @@ -8,19 +8,14 @@ use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("session"); __PACKAGE__->add_columns( - "id", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 72 }, - "session_data", - { data_type => "TEXT", default_value => "", is_nullable => 0, size => 65535 }, - "expires", - { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, + "id", { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 72 }, + "session_data", { data_type => "TEXT", default_value => "", is_nullable => 0, size => 65535 }, + "expires", { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, ); __PACKAGE__->set_primary_key("id"); - # Created by DBIx::Class::Schema::Loader v0.04002 @ 2007-08-09 16:13:40 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SEGt7AaZSpdxN24W2qkkFg - # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/lib/CookBookDb/SessionLog.pm b/lib/CookBookDb/SessionLog.pm index e3909e5..0693738 100644 --- a/lib/CookBookDb/SessionLog.pm +++ b/lib/CookBookDb/SessionLog.pm @@ -8,67 +8,59 @@ use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("session_log"); __PACKAGE__->add_columns( - "session_log_id", - { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, - "user_id", - { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, - "login_time", - { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, - "logout_time", - { - data_type => "DATETIME", - default_value => undef, - is_nullable => 1, - size => 19, - }, - "logout_reason", - { data_type => "ENUM", default_value => undef, is_nullable => 1, size => 9 }, - "session_id", - { - data_type => "VARCHAR", - default_value => undef, - is_nullable => 1, - size => 72, - }, - "login", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 50 }, - "user_name", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 110 }, - "client_ip", - { - data_type => "VARCHAR", - default_value => undef, - is_nullable => 1, - size => 20, - }, - "client_host", - { - data_type => "VARCHAR", - default_value => undef, - is_nullable => 1, - size => 200, - }, - "user_agent", - { - data_type => "VARCHAR", - default_value => undef, - is_nullable => 1, - size => 250, - }, - "server", - { - data_type => "VARCHAR", - default_value => undef, - is_nullable => 1, - size => 100, - }, + "session_log_id", + { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, + "user_id", + { data_type => "INT", default_value => "", is_nullable => 0, size => 10 }, + "login_time", + { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, + "logout_time", + { data_type => "DATETIME", + default_value => undef, + is_nullable => 1, + size => 19, + }, + "logout_reason", + { data_type => "ENUM", default_value => undef, is_nullable => 1, size => 9 }, + "session_id", + { data_type => "VARCHAR", + default_value => undef, + is_nullable => 1, + size => 72, + }, + "login", + { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 50 }, + "user_name", + { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 110 }, + "client_ip", + { data_type => "VARCHAR", + default_value => undef, + is_nullable => 1, + size => 20, + }, + "client_host", + { data_type => "VARCHAR", + default_value => undef, + is_nullable => 1, + size => 200, + }, + "user_agent", + { data_type => "VARCHAR", + default_value => undef, + is_nullable => 1, + size => 250, + }, + "server", + { data_type => "VARCHAR", + default_value => undef, + is_nullable => 1, + size => 100, + }, ); __PACKAGE__->set_primary_key("session_log_id"); - # Created by DBIx::Class::Schema::Loader v0.04002 @ 2007-08-09 16:13:40 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RmQzAMVSZmvYuFzIczRQ2Q - # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/lib/CookBookDb/Users.pm b/lib/CookBookDb/Users.pm index 8e729c8..2a030b6 100644 --- a/lib/CookBookDb/Users.pm +++ b/lib/CookBookDb/Users.pm @@ -8,38 +8,24 @@ use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("users"); __PACKAGE__->add_columns( - "user_id", - { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, - "login", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 50 }, - "vorname", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 100 }, - "nachname", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 100 }, - "password", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 250 }, - "date_created", - { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, - "date_changed", - { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, - "email", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 250 }, - "deleted", - { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, - "enabled", - { data_type => "ENUM", default_value => "y", is_nullable => 0, size => 1 }, - "admin_status", - { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, - "comments", - { data_type => "TEXT", default_value => "", is_nullable => 0, size => 65535 }, + "user_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, + "login", { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 50 }, + "vorname", { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 100 }, + "nachname", { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 100 }, + "password", { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 250 }, + "date_created", { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, + "date_changed", { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, + "email", { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 250 }, + "deleted", { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, + "enabled", { data_type => "ENUM", default_value => "y", is_nullable => 0, size => 1 }, + "admin_status", { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, + "comments", { data_type => "TEXT", default_value => "", is_nullable => 0, size => 65535 }, ); __PACKAGE__->set_primary_key("user_id"); -__PACKAGE__->add_unique_constraint("login", ["login"]); - +__PACKAGE__->add_unique_constraint( "login", ["login"] ); # Created by DBIx::Class::Schema::Loader v0.04002 @ 2007-08-09 16:13:40 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4RbgZUha9qaD/QHFdiXuGw - # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/lib/CookBookDb/YieldTypes.pm b/lib/CookBookDb/YieldTypes.pm index e2538ad..6332cba 100644 --- a/lib/CookBookDb/YieldTypes.pm +++ b/lib/CookBookDb/YieldTypes.pm @@ -8,20 +8,15 @@ use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("yield_types"); __PACKAGE__->add_columns( - "yield_type_id", - { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, - "yield_type_name", - { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 30 }, - "date_created", - { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, + "yield_type_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, + "yield_type_name", { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 30 }, + "date_created", { data_type => "DATETIME", default_value => "", is_nullable => 0, size => 19 }, ); __PACKAGE__->set_primary_key("yield_type_id"); -__PACKAGE__->add_unique_constraint("yield_type_name", ["yield_type_name"]); - +__PACKAGE__->add_unique_constraint( "yield_type_name", ["yield_type_name"] ); # Created by DBIx::Class::Schema::Loader v0.04002 @ 2007-08-09 16:13:40 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WuKiqaAPGCPQ5kC0gs+yqQ - # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/sbin/initial_import.pl b/sbin/initial_import.pl index dbcaaeb..1e8f81f 100755 --- a/sbin/initial_import.pl +++ b/sbin/initial_import.pl @@ -141,8 +141,8 @@ print "\n"; open_dbs(); print "\n"; -exit 7 unless drop_target_tables(); -exit 8 unless create_target_tables(); +exit 7 unless drop_target_tables(); +exit 8 unless create_target_tables(); exit 77 unless import_data(); exit 99 unless optimize_target_tables(); @@ -483,7 +483,7 @@ sub import_data { print "\n"; return 1; -} +} ## end sub import_data #------------------------------------------------------------- @@ -503,9 +503,9 @@ sub import_author_table { return undef unless $source_sth->execute(); while ( $author = $source_sth->fetchrow_hashref() ) { - $sql = 'SELECT count(*) AS `count` FROM `authors` WHERE `author_name` = ?'; + $sql = 'SELECT count(*) AS `count` FROM `authors` WHERE `author_name` = ?'; $target_sth = $target_dbh->prepare($sql); - unless ( $target_sth ) { + unless ($target_sth) { $source_sth->finish(); return undef; } @@ -513,33 +513,33 @@ sub import_author_table { $source_sth->finish(); return undef; } - $row = $target_sth->fetchrow_hashref(); + $row = $target_sth->fetchrow_hashref(); $count = $row->{'count'}; $target_sth->finish(); $qparams = [ $author->{'id'}, $author->{'name'} ]; $do_insert = 0; - if ( $count ) { + if ($count) { $sql = 'UPDATE `authors` SET `old_author_id` = ? WHERE `author_name` = ?'; } else { - $sql = 'INSERT INTO `authors` ( `old_author_id`, `author_name`, `date_created` ) VALUES ( ?, ?, now() )'; + $sql = 'INSERT INTO `authors` ( `old_author_id`, `author_name`, `date_created` ) VALUES ( ?, ?, now() )'; $do_insert = 1; } unless ( $target_dbh->do( $sql, {}, @$qparams ) ) { $source_sth->finish(); return undef; } - if ( $do_insert ) { - $map_author_id{$author->{'id'}} = $target_dbh->{'mysql_insertid'}; + if ($do_insert) { + $map_author_id{ $author->{'id'} } = $target_dbh->{'mysql_insertid'}; } else { - $map_author_id{$author->{'id'}} = 1; + $map_author_id{ $author->{'id'} } = 1; } - } + } ## end while ( $author = $source_sth->fetchrow_hashref... return 1; -} +} ## end sub import_author_table #------------------------------------------------------------- @@ -561,7 +561,7 @@ END_SQL return undef unless $target_dbh->do($sql); return 1; -} +} ## end sub create_session_table #------------------------------------------------------------- @@ -594,7 +594,7 @@ END_SQL return undef unless $target_dbh->do($sql); return 1; -} +} ## end sub create_session_log_table #------------------------------------------------------------- @@ -636,7 +636,7 @@ END_SQL return undef unless $target_dbh->do($sql); return 1; -} +} ## end sub create_recipes_table #------------------------------------------------------------- @@ -674,7 +674,7 @@ INSERT INTO `recipes` ( ) END_SQL $target_sth = $target_dbh->prepare($sql); - unless ( $target_sth ) { + unless ($target_sth) { $source_sth->finish(); return undef; } @@ -685,14 +685,14 @@ END_SQL $i++; my $digest_source = sprintf( '%07d-%s-%s', $i, time(), $recipe->{'title'} ); - my $digest = md5_hex($digest_source); + my $digest = md5_hex($digest_source); $qparams = [ $recipe->{'id'}, $digest, $recipe->{'title'}, $recipe->{'instructions'}, - $recipe->{'yield_amount'} || 0, + $recipe->{'yield_amount'} || 0, $recipe->{'yield_amount_offset'} || undef, ( $recipe->{'yield_type_id'} and $recipe->{'yield_type_id'} > 0 ? $recipe->{'yield_type_id'} : undef ), $recipe->{'prep_time'}, @@ -705,13 +705,13 @@ END_SQL return undef; } - $map_recipe_id{$recipe->{'id'}} = $target_dbh->{'mysql_insertid'}; + $map_recipe_id{ $recipe->{'id'} } = $target_dbh->{'mysql_insertid'}; - } + } ## end while ( $recipe = $source_sth->fetchrow_hashref... return 1; -} +} ## end sub import_receipes_table #------------------------------------------------------------- @@ -736,7 +736,7 @@ END_SQL return undef unless $target_dbh->do($sql); return 1; -} +} ## end sub create_recipe_authors_table #------------------------------------------------------------- @@ -765,13 +765,13 @@ INSERT INTO `recipe_authors` ( `recipe_id`, `author_id`, `order_index`, `date_cr VALUES ( ?, ?, ?, now() ) END_SQL $target_sth = $target_dbh->prepare($sql); - unless ( $target_sth ) { + unless ($target_sth) { $source_sth->finish(); return undef; } $old_rid = 0; - $i = 0; + $i = 0; while ( $row = $source_sth->fetchrow_hashref() ) { @@ -782,21 +782,17 @@ END_SQL $i++; } - $qparams = [ - $map_recipe_id{$row->{'recipe_id'}}, - $map_author_id{$row->{'author_id'}}, - $i, - ]; + $qparams = [ $map_recipe_id{ $row->{'recipe_id'} }, $map_author_id{ $row->{'author_id'} }, $i, ]; unless ( $target_dbh->do( $sql, {}, @$qparams ) ) { $source_sth->finish(); return undef; } - } + } ## end while ( $row = $source_sth->fetchrow_hashref(... return 1; -} +} ## end sub import_recipe_authors_table #------------------------------------------------------------- @@ -880,7 +876,7 @@ END_SQL return undef unless $target_dbh->do($sql); return 1; -} +} ## end sub create_yield_types_table #------------------------------------------------------------- @@ -909,17 +905,14 @@ INSERT INTO `yield_types` ( `yield_type_id`, `yield_type_name`, `date_created` ) VALUES ( ?, ?, now() ) END_SQL $target_sth = $target_dbh->prepare($sql); - unless ( $target_sth ) { + unless ($target_sth) { $source_sth->finish(); return undef; } while ( $type = $source_sth->fetchrow_hashref() ) { - $qparams = [ - $type->{'id'}, - $type->{'name'}, - ]; + $qparams = [ $type->{'id'}, $type->{'name'}, ]; unless ( $target_dbh->do( $sql, {}, @$qparams ) ) { $source_sth->finish(); @@ -929,7 +922,7 @@ END_SQL return 1; -} +} ## end sub import_yield_types_table #------------------------------------------------------------- -- 2.39.5