diff --git a/lib/Lacuna/DB/Result/Alliance.pm b/lib/Lacuna/DB/Result/Alliance.pm index ed9395a9..58d96a72 100644 --- a/lib/Lacuna/DB/Result/Alliance.pm +++ b/lib/Lacuna/DB/Result/Alliance.pm @@ -23,7 +23,6 @@ __PACKAGE__->belongs_to('leader', 'Lacuna::DB::Result::Empire', 'leader_id', { o __PACKAGE__->has_many('members', 'Lacuna::DB::Result::Empire', 'alliance_id'); __PACKAGE__->has_many('invites', 'Lacuna::DB::Result::AllianceInvite', 'alliance_id'); __PACKAGE__->has_many('stations', 'Lacuna::DB::Result::Map::Body', 'alliance_id'); -__PACKAGE__->has_many('propositions', 'Lacuna::DB::Result::Propositions', 'alliance_id'); @@ -241,10 +240,6 @@ sub remove_member { before delete => sub { my $self = shift; - my $propositions = $self->propositions; - while (my $proposition = $propositions->next) { - $proposition->delete; - } my $stations = $self->stations; while (my $station = $stations->next) { $station->sanitize; diff --git a/lib/Lacuna/DB/Result/Map/Body/Planet/Station.pm b/lib/Lacuna/DB/Result/Map/Body/Planet/Station.pm index 2e9947e4..8c0c9b36 100644 --- a/lib/Lacuna/DB/Result/Map/Body/Planet/Station.pm +++ b/lib/Lacuna/DB/Result/Map/Body/Planet/Station.pm @@ -8,6 +8,11 @@ use Lacuna::Util qw(randint); use constant image => 'station'; +before sanitize => sub { + my $self = shift; + $self->propositions->delete_all; +}; + after sanitize => sub { my $self = shift; $self->update({ diff --git a/var/upgrades/3.0200.sql b/var/upgrades/3.0200.sql new file mode 100644 index 00000000..bf31012c --- /dev/null +++ b/var/upgrades/3.0200.sql @@ -0,0 +1,31 @@ +CREATE TABLE `propositions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(30) NOT NULL, + `station_id` int(11) NOT NULL, + `votes_needed` int(11) NOT NULL DEFAULT '1', + `votes_yes` int(11) NOT NULL DEFAULT '0', + `votes_no` int(11) NOT NULL DEFAULT '0', + `description` text, + `type` varchar(30) NOT NULL, + `scratch` mediumblob, + `date_ends` datetime NOT NULL, + `proposed_by_id` int(11) NOT NULL, + `status` varchar(10) NOT NULL DEFAULT 'Pending', + PRIMARY KEY (`id`), + KEY `propositions_idx_proposed_by_id` (`proposed_by_id`), + KEY `propositions_idx_station_id` (`station_id`), + KEY `idx_status_date_ends` (`status`,`date_ends`), + CONSTRAINT `propositions_fk_proposed_by_id` FOREIGN KEY (`proposed_by_id`) REFERENCES `empire` (`id`), + CONSTRAINT `propositions_fk_station_id` FOREIGN KEY (`station_id`) REFERENCES `body` (`id`) +); +CREATE TABLE `votes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `proposition_id` int(11) NOT NULL, + `empire_id` int(11) NOT NULL, + `vote` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `votes_idx_empire_id` (`empire_id`), + KEY `votes_idx_proposition_id` (`proposition_id`), + CONSTRAINT `votes_fk_empire_id` FOREIGN KEY (`empire_id`) REFERENCES `empire` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `votes_fk_proposition_id` FOREIGN KEY (`proposition_id`) REFERENCES `propositions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +); \ No newline at end of file diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 119efa99..bf9f0183 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,6 +1,7 @@ 3.0200 - Add: Added Amalgus Meadow and Denton Brambles glyph buildings. - Add: Added {VoteYes 0 0 0} and {VoteNo 0 0 0} formatters to the email DSL. + - Add: Through parliamentary vote you can now: rename a station, abandon a station, demolish a building on a station. - Rule: Surveyors now return efficiency information in the table of building data. - API: Slight change to the Space Station Lab API to accomodate displaying descriptions and images for the plans. - Fix: P16 type planets were being misidentified as P17 planets.