mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Enforce charset, collation & engine on MySQL tables
This commit is contained in:
1 parent
41ce426480
commit
997e61a369
2 files changed
+19
-7
No files matched your search
@@ -64,7 +64,7 @@ FROM `%source_database%`.`%source_warps_table%` AS `%source_warps_table%`
|
||||
INNER JOIN `%target_saved_positions%`
|
||||
ON `%source_warps_table%`.`location_id` = `%target_saved_positions%`.`position_id`;
|
||||
|
||||
-- Rename old tables
|
||||
# Rename old tables
|
||||
ALTER TABLE `%source_database%`.`%source_positions_table%` RENAME TO `old_%source_positions_table%`;
|
||||
ALTER TABLE `%source_database%`.`%source_users_table%` RENAME TO `old_%source_users_table%`;
|
||||
ALTER TABLE `%source_database%`.`%source_homes_table%` RENAME TO `old_%source_homes_table%`;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
# Set the storage engine
|
||||
SET DEFAULT_STORAGE_ENGINE = INNODB;
|
||||
|
||||
# Enable foreign key constraints
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
# Create the positions table if it does not exist
|
||||
CREATE TABLE IF NOT EXISTS `%positions_table%`
|
||||
(
|
||||
@@ -12,7 +18,8 @@ CREATE TABLE IF NOT EXISTS `%positions_table%`
|
||||
`server_name` varchar(255) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
) CHARACTER SET utf8
|
||||
COLLATE utf8_unicode_ci;
|
||||
|
||||
# Create the players table if it does not exist
|
||||
CREATE TABLE IF NOT EXISTS `%players_table%`
|
||||
@@ -30,7 +37,8 @@ CREATE TABLE IF NOT EXISTS `%players_table%`
|
||||
FOREIGN KEY (`last_position`) REFERENCES `%positions_table%` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION,
|
||||
FOREIGN KEY (`offline_position`) REFERENCES `%positions_table%` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION,
|
||||
FOREIGN KEY (`respawn_position`) REFERENCES `%positions_table%` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION
|
||||
);
|
||||
) CHARACTER SET utf8
|
||||
COLLATE utf8_unicode_ci;
|
||||
|
||||
# Create the current cross-server teleports table if it does not exist
|
||||
CREATE TABLE IF NOT EXISTS `%teleports_table%`
|
||||
@@ -42,7 +50,8 @@ CREATE TABLE IF NOT EXISTS `%teleports_table%`
|
||||
PRIMARY KEY (`player_uuid`),
|
||||
FOREIGN KEY (`player_uuid`) REFERENCES `%players_table%` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`destination_id`) REFERENCES `%positions_table%` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
) CHARACTER SET utf8
|
||||
COLLATE utf8_unicode_ci;
|
||||
|
||||
# Create the saved positions table if it does not exist
|
||||
CREATE TABLE IF NOT EXISTS `%saved_positions_table%`
|
||||
@@ -56,7 +65,8 @@ CREATE TABLE IF NOT EXISTS `%saved_positions_table%`
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`position_id`) REFERENCES `%positions_table%` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
) CHARACTER SET utf8
|
||||
COLLATE utf8_unicode_ci;
|
||||
|
||||
# Create the homes table if it does not exist
|
||||
CREATE TABLE IF NOT EXISTS `%homes_table%`
|
||||
@@ -69,7 +79,8 @@ CREATE TABLE IF NOT EXISTS `%homes_table%`
|
||||
PRIMARY KEY (`uuid`),
|
||||
FOREIGN KEY (`owner_uuid`) REFERENCES `%players_table%` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`saved_position_id`) REFERENCES `%saved_positions_table%` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
) CHARACTER SET utf8
|
||||
COLLATE utf8_unicode_ci;
|
||||
|
||||
# Create the warps table if it does not exist
|
||||
CREATE TABLE IF NOT EXISTS `%warps_table%`
|
||||
@@ -79,4 +90,5 @@ CREATE TABLE IF NOT EXISTS `%warps_table%`
|
||||
|
||||
PRIMARY KEY (`uuid`),
|
||||
FOREIGN KEY (`saved_position_id`) REFERENCES `%saved_positions_table%` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
) CHARACTER SET utf8
|
||||
COLLATE utf8_unicode_ci;
|
||||
Reference in new issue
Block a user