Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add featured mods for missions #196

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions migrations/V71__allow_featured_mod_per_misson.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE coop_map_type(
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` VARCHAR(256) not null ,
`description` text,
`main_featured_id` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `featured_mod_for_coop_map_type` FOREIGN KEY (`main_featured_id`) REFERENCES `game_featuredMods` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE TABLE coop_map_type_to_needed_featured_mods(
`coop_map_type_id` mediumint(8) unsigned NOT NULL,
`needed_featured_id` tinyint(3) unsigned NOT NULL,
CONSTRAINT `coop_map_type_id_for_needed_featured_mods` FOREIGN KEY (`coop_map_type_id`) REFERENCES `coop_map_type` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `featured_mod_id_for_needed_featured_mods` FOREIGN KEY (`needed_featured_id`) REFERENCES `game_featuredMods` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);

ALTER TABLE `coop_map` CHANGE `type` `coop_map_type_id` mediumint(8) NOT NULL;

-- TODO: Add a constraint to coop-map table after data was added in production
20 changes: 13 additions & 7 deletions test-data.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
-- DUMMY DATA ONLY, FOR USE IN UNIT TESTS

DELETE FROM coop_map_type_to_needed_featured_mods;
DELETE FROM coop_map_type;
DELETE FROM player_events;
DELETE FROM reported_user;
DELETE FROM moderation_report;
Expand Down Expand Up @@ -142,13 +144,17 @@ insert into ladder_map (id, idmap) values
(1,1),
(2,2);

INSERT INTO `coop_map` (`type`, `name`, `description`, `version`, `filename`)
VALUES (0, 'FA Campaign map', 'A map from the FA campaign', 2, 'maps/scmp_coop_123.v0002.zip'),
(1, 'Aeon Campaign map', 'A map from the Aeon campaign', 0, 'maps/scmp_coop_124.v0000.zip'),
(2, 'Cybran Campaign map', 'A map from the Cybran campaign', 1, 'maps/scmp_coop_125.v0001.zip'),
(3, 'UEF Campaign map', 'A map from the UEF campaign', 99, 'maps/scmp_coop_126.v0099.zip'),
(4, 'Prothyon - 16', 'Prothyon - 16 is a secret UEF facility...', 5, 'maps/prothyon16.v0005.zip'),
(100, 'Corrupted Map', 'This is corrupted and you should never see it', 0, '$invalid &string*');
-- TODO: comment back in after migration V71 because a column was renamed there
-- INSERT INTO `coop_map` (`coop_map_type_id`, `name`, `description`, `version`, `filename`)
-- VALUES (0, 'FA Campaign map', 'A map from the FA campaign', 2, 'maps/scmp_coop_123.v0002.zip'),
-- (1, 'Aeon Campaign map', 'A map from the Aeon campaign', 0, 'maps/scmp_coop_124.v0000.zip'),
-- (2, 'Cybran Campaign map', 'A map from the Cybran campaign', 1, 'maps/scmp_coop_125.v0001.zip'),
-- (3, 'UEF Campaign map', 'A map from the UEF campaign', 99, 'maps/scmp_coop_126.v0099.zip'),
-- (4, 'Prothyon - 16', 'Prothyon - 16 is a secret UEF facility...', 5, 'maps/prothyon16.v0005.zip'),
-- (100, 'Corrupted Map', 'This is corrupted and you should never see it', 0, '$invalid &string*');

-- INSERT INTO coop_map_type (id,name,main_featured_id) VALUE (0,'first type',25);
-- INSERT INTO coop_map_type_to_needed_featured_mods(coop_map_type_id, needed_featured_id) VALUE (0,1);

insert into game_featuredMods (id, gamemod, name, description, publish, git_url, git_branch, file_extension, allow_override)
values (1, 'faf', 'FAF', 'Forged Alliance Forever', 1, 'https://github.com/FAForever/fa.git', 'deploy/faf', 'nx2', FALSE),
Expand Down