mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +00:00
Clear tables before insertion
This commit is contained in:
1 parent
0843ebf4fe
commit
bb42a4d106
2 files changed
+20
-4
No files matched your search
@@ -1,5 +1,11 @@
|
|||||||
# MySQL migration script.
|
# MySQL migration script.
|
||||||
|
|
||||||
|
# Clear target database.
|
||||||
|
DELETE
|
||||||
|
FROM `%target_positions_table%`;
|
||||||
|
DELETE
|
||||||
|
FROM `%target_users_table%`;
|
||||||
|
|
||||||
# Migrate positions to the new schema
|
# Migrate positions to the new schema
|
||||||
INSERT INTO `%target_positions_table%` (`id`, `x`, `y`, `z`, `yaw`, `pitch`, `world_name`, `world_uuid`, `server_name`)
|
INSERT INTO `%target_positions_table%` (`id`, `x`, `y`, `z`, `yaw`, `pitch`, `world_name`, `world_uuid`, `server_name`)
|
||||||
SELECT `location_id` AS `id`,
|
SELECT `location_id` AS `id`,
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
/* SQLite migration script. */
|
/* SQLite migration script. */
|
||||||
|
|
||||||
|
-- Clear target database.
|
||||||
|
DELETE
|
||||||
|
FROM `%target_positions_table%`;
|
||||||
|
DELETE
|
||||||
|
FROM `%target_users_table%`;
|
||||||
|
|
||||||
-- Migrate positions to the new schema
|
-- Migrate positions to the new schema
|
||||||
INSERT INTO `%target_positions_table%` (`id`, `x`, `y`, `z`, `yaw`, `pitch`, `world_name`, `world_uuid`, `server_name`)
|
INSERT INTO `%target_positions_table%` (`id`, `x`, `y`, `z`, `yaw`, `pitch`, `world_name`, `world_uuid`, `server_name`)
|
||||||
SELECT `location_id` AS `id`,
|
SELECT `location_id` AS `id`,
|
||||||
@@ -67,7 +73,11 @@ FROM `%source_warps_table%`
|
|||||||
ON `%source_warps_table%`.`location_id` = `%target_saved_positions%`.`position_id`;
|
ON `%source_warps_table%`.`location_id` = `%target_saved_positions%`.`position_id`;
|
||||||
|
|
||||||
-- Rename old tables
|
-- Rename old tables
|
||||||
ALTER TABLE `%source_positions_table%` RENAME TO `old_%source_positions_table%`;
|
ALTER TABLE `%source_positions_table%`
|
||||||
ALTER TABLE `%source_users_table%` RENAME TO `old_%source_users_table%`;
|
RENAME TO `old_%source_positions_table%`;
|
||||||
ALTER TABLE `%source_homes_table%` RENAME TO `old_%source_homes_table%`;
|
ALTER TABLE `%source_users_table%`
|
||||||
ALTER TABLE `%source_warps_table%` RENAME TO `old_%source_warps_table%`;
|
RENAME TO `old_%source_users_table%`;
|
||||||
|
ALTER TABLE `%source_homes_table%`
|
||||||
|
RENAME TO `old_%source_homes_table%`;
|
||||||
|
ALTER TABLE `%source_warps_table%`
|
||||||
|
RENAME TO `old_%source_warps_table%`;
|
||||||
Reference in new issue
Block a user