From 3c623c0d4b039bd5590665cae92134dc901f0911 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 3 Nov 2010 16:09:05 -0500 Subject: [PATCH] fixing blob/utf8 stuff --- bin/saben/create_colony.pl | 2 +- bin/saben/send_attack.pl | 1 + lib/Lacuna.pm | 2 +- lib/Lacuna/DB/Result/Building.pm | 2 +- lib/Lacuna/DB/Result/Log/Cargo.pm | 2 +- lib/Lacuna/DB/Result/Message.pm | 4 ++-- lib/Lacuna/DB/Result/SabenTarget.pm | 2 +- lib/Lacuna/DB/Result/Ships.pm | 2 +- lib/Lacuna/DB/Result/Trades.pm | 2 +- var/upgrades/2.2808.sql | 12 ++++++++++++ 10 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 var/upgrades/2.2808.sql diff --git a/bin/saben/create_colony.pl b/bin/saben/create_colony.pl index 1ce6e924..000ca4c3 100644 --- a/bin/saben/create_colony.pl +++ b/bin/saben/create_colony.pl @@ -54,7 +54,7 @@ out('Setting target...'); $db->resultset('Lacuna::DB::Result::SabenTarget')->new({ saben_colony_id => $body->id, target_empire_id => $target_player->id, -}); +})->insert; out('Placing structures on '.$body->name); diff --git a/bin/saben/send_attack.pl b/bin/saben/send_attack.pl index f6495e32..1909d5dc 100644 --- a/bin/saben/send_attack.pl +++ b/bin/saben/send_attack.pl @@ -39,6 +39,7 @@ while (my $colony = $colonies->next) { next; } # check existing target, switch if needed + # determine closest colony of target # check if a probe exists, if not cancel attack # send ships } diff --git a/lib/Lacuna.pm b/lib/Lacuna.pm index 728a72b2..46c47663 100644 --- a/lib/Lacuna.pm +++ b/lib/Lacuna.pm @@ -7,7 +7,7 @@ use Config::JSON; useall __PACKAGE__; -our $VERSION = 2.2807; +our $VERSION = 2.2808; my $config = Config::JSON->new('/data/Lacuna-Server/etc/lacuna.conf'); my $db = Lacuna::DB->connect($config->get('db/dsn'),$config->get('db/username'),$config->get('db/password'), { mysql_enable_utf8 => 1}); diff --git a/lib/Lacuna/DB/Result/Building.pm b/lib/Lacuna/DB/Result/Building.pm index d333797c..a29e755a 100644 --- a/lib/Lacuna/DB/Result/Building.pm +++ b/lib/Lacuna/DB/Result/Building.pm @@ -23,7 +23,7 @@ __PACKAGE__->add_columns( work_started => { data_type => 'datetime', is_nullable => 0, set_on_create => 1 }, work_ends => { data_type => 'datetime', is_nullable => 0, set_on_create => 1 }, is_working => { data_type => 'bit', default => 0 }, - work => { data_type => 'mediumtext', is_nullable => 1, 'serializer_class' => 'JSON' }, + work => { data_type => 'mediumblob', is_nullable => 1, 'serializer_class' => 'JSON' }, efficiency => { data_type => 'int', default_value => 100, is_nullable => 0 }, ); diff --git a/lib/Lacuna/DB/Result/Log/Cargo.pm b/lib/Lacuna/DB/Result/Log/Cargo.pm index 3808f291..d9014013 100644 --- a/lib/Lacuna/DB/Result/Log/Cargo.pm +++ b/lib/Lacuna/DB/Result/Log/Cargo.pm @@ -12,7 +12,7 @@ __PACKAGE__->add_columns( object_id => { data_type => 'int', is_nullable => 0 }, body_id => { data_type => 'int', is_nullable => 0 }, message => { data_type => 'varchar', size=>255, is_nullable => 0 }, - data => { data_type => 'mediumtext', is_nullable => 1, 'serializer_class' => 'JSON' }, + data => { data_type => 'mediumblob', is_nullable => 1, 'serializer_class' => 'JSON' }, ); diff --git a/lib/Lacuna/DB/Result/Message.pm b/lib/Lacuna/DB/Result/Message.pm index 26dcaba8..c7d12271 100644 --- a/lib/Lacuna/DB/Result/Message.pm +++ b/lib/Lacuna/DB/Result/Message.pm @@ -17,12 +17,12 @@ __PACKAGE__->add_columns( from_name => { data_type => 'varchar', size => 30, is_nullable => 0 }, to_id => { data_type => 'int', size => 11, is_nullable => 1 }, to_name => { data_type => 'varchar', size => 30, is_nullable => 0 }, - recipients => { data_type => 'mediumtext', is_nullable => 1, 'serializer_class' => 'JSON' }, + recipients => { data_type => 'mediumblob', is_nullable => 1, 'serializer_class' => 'JSON' }, tag => { data_type => 'varchar', size => 15, is_nullable => 1 }, has_read => { data_type => 'tinyint', default_value => 0, is_nullable => 0 }, has_replied => { data_type => 'tinyint', default_value => 0, is_nullable => 0 }, has_archived => { data_type => 'tinyint', default_value => 0, is_nullable => 0 }, - attachments => { data_type => 'mediumtext', is_nullable => 1, 'serializer_class' => 'JSON' }, + attachments => { data_type => 'mediumblob', is_nullable => 1, 'serializer_class' => 'JSON' }, repeat_check => { data_type => 'varchar', size => 30, is_nullable => 1 }, ); diff --git a/lib/Lacuna/DB/Result/SabenTarget.pm b/lib/Lacuna/DB/Result/SabenTarget.pm index d4bf535e..f5066978 100644 --- a/lib/Lacuna/DB/Result/SabenTarget.pm +++ b/lib/Lacuna/DB/Result/SabenTarget.pm @@ -4,7 +4,7 @@ use Moose; no warnings qw(uninitialized); extends 'Lacuna::DB::Result'; -__PACKAGE__->table('mission'); +__PACKAGE__->table('saben_target'); __PACKAGE__->add_columns( target_empire_id => { data_type => 'int', is_nullable => 0 }, saben_colony_id => { data_type => 'int', is_nullable => 0 }, diff --git a/lib/Lacuna/DB/Result/Ships.pm b/lib/Lacuna/DB/Result/Ships.pm index 934940be..6fe23d69 100644 --- a/lib/Lacuna/DB/Result/Ships.pm +++ b/lib/Lacuna/DB/Result/Ships.pm @@ -21,7 +21,7 @@ __PACKAGE__->add_columns( speed => { data_type => 'int', size => 11, is_nullable => 0 }, stealth => { data_type => 'int', size => 11, is_nullable => 0 }, hold_size => { data_type => 'int', size => 11, is_nullable => 0 }, - payload => { data_type => 'mediumtext', is_nullable => 1, 'serializer_class' => 'JSON' }, + payload => { data_type => 'mediumblob', is_nullable => 1, 'serializer_class' => 'JSON' }, roundtrip => { data_type => 'bit', default_value => 0 }, direction => { data_type => 'varchar', size => 3, is_nullable => 0 }, # in || out foreign_body_id => { data_type => 'int', size => 11, is_nullable => 1 }, diff --git a/lib/Lacuna/DB/Result/Trades.pm b/lib/Lacuna/DB/Result/Trades.pm index 0dc1bb12..1beeb584 100644 --- a/lib/Lacuna/DB/Result/Trades.pm +++ b/lib/Lacuna/DB/Result/Trades.pm @@ -16,7 +16,7 @@ __PACKAGE__->add_columns( ask_description => { data_type => 'varchar', size => 30, is_nullable => 0 }, # 100 Corn, 500 Bauxite ask_type => { data_type => 'varchar', size => 11, is_nullable => 0 }, # ore, bauxite, water, energy, food, waste, essentia ask_quantity => { data_type => 'int', size => 11, default_value => 1 }, - payload => { data_type => 'mediumtext', is_nullable => 1, 'serializer_class' => 'JSON' }, + payload => { data_type => 'mediumblob', is_nullable => 1, 'serializer_class' => 'JSON' }, offer_cargo_space_needed=> { data_type => 'int', size => 11, default_value => 0 }, offer_description => { data_type => 'varchar', size => 100, is_nullable => 0 }, # 1000 Corn, Empire Name Prisoner, Colony Ship (Speed: 12, Cargo: 0), etc offer_object_id => { data_type => 'int', size => 11, is_nullable => 1 }, diff --git a/var/upgrades/2.2808.sql b/var/upgrades/2.2808.sql new file mode 100644 index 00000000..4ed755f7 --- /dev/null +++ b/var/upgrades/2.2808.sql @@ -0,0 +1,12 @@ +CREATE TABLE `saben_target` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `target_empire_id` int(11) NOT NULL, + `saben_colony_id` int(11) NOT NULL, + PRIMARY KEY (`id`) +); +alter table message change recipients recipients mediumblob; +alter table message change attachments attachments mediumblob; +alter table building change `work` `work` mediumblob; +alter table ships change payload payload mediumblob; +alter table trades change payload payload mediumblob; +alter table cargo_log change `data` `data` mediumblob; -- 2.51.2