Add 1.1 to 1.2 migration script

This commit is contained in:
Bluzume 2021-11-27 16:15:13 -05:00
parent 37102c24a3
commit 8246d0c0fc
3 changed files with 19 additions and 5 deletions

View file

@ -40,7 +40,7 @@ namespace HISP.Server
string WorldTable = "CREATE TABLE World(Time INT, Day INT, Year INT, StartTime INT)";
string WeatherTable = "CREATE TABLE IF NOT EXISTS Weather(Area TEXT(1028), Weather TEXT(64))";
string InventoryTable = "CREATE TABLE IF NOT EXISTS Inventory(PlayerID INT, RandomID INT, ItemID INT, Data INT)";
string ShopInventory = "CREATE TABLE IF NOT EXISTS ShopInventory(ShopID INT, RandomID INT, ItemID INT)";
string ShopInventory = "CREATE TABLE IF NOT EXISTS ShopInventory(ShopID INT, RandomID INT, ItemID INT, Data INT)";
string DroppedItems = "CREATE TABLE IF NOT EXISTS DroppedItems(X INT, Y INT, RandomID INT, ItemID INT, DespawnTimer INT, Data INT)";
string TrackedQuest = "CREATE TABLE IF NOT EXISTS TrackedQuest(playerId INT, questId INT, timesCompleted INT)";
string CompetitionGear = "CREATE TABLE IF NOT EXISTS CompetitionGear(playerId INT, headItem INT, bodyItem INT, legItem INT, feetItem INT)";
@ -4072,7 +4072,7 @@ namespace HISP.Server
while (reader.Read())
{
instances.Add(new ItemInstance(reader.GetInt32(0), reader.GetInt32(1)));
instances.Add(new ItemInstance(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2)));
}
return instances.ToArray();
@ -4086,10 +4086,11 @@ namespace HISP.Server
db.Open();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "INSERT INTO ShopInventory VALUES(@shopId,@randomId,@itemId)";
sqlCommand.CommandText = "INSERT INTO ShopInventory VALUES(@shopId,@randomId,@itemId,@data)";
sqlCommand.Parameters.AddWithValue("@shopId", shopId);
sqlCommand.Parameters.AddWithValue("@randomId", instance.RandomId);
sqlCommand.Parameters.AddWithValue("@itemId", instance.ItemId);
sqlCommand.Parameters.AddWithValue("@data", instance.Data);
sqlCommand.Prepare();
sqlCommand.ExecuteNonQuery();

View file

@ -4,11 +4,11 @@
# To use this script you must find/replace
# 'master' to your master db name
# and 'beta' to your game db name
# and 'game1' to your game db name
CREATE DATABASE IF NOT EXISTS master;
CREATE TABLE IF NOT EXISTS master.Users(Id INT, Username TEXT(16),Email TEXT(128),Country TEXT(128),SecurityQuestion Text(128),SecurityAnswerHash TEXT(128),Age INT,PassHash TEXT(128), Salt TEXT(128),Gender TEXT(16), Admin TEXT(3), Moderator TEXT(3));
# Transfer user table to master db
USE beta;
USE game1;
INSERT INTO master.Users(SELECT Id,Username,Email,Country,SecurityQuestion,SecurityAnswerHash,Age,PassHash,Salt,Gender,Admin,Moderator FROM Users);
ALTER TABLE Users DROP COLUMN Email;
ALTER TABLE Users DROP COLUMN Country;

View file

@ -0,0 +1,13 @@
## Written by SilicaAndPina,
## This Script is entered into the Public Domain!
## HISP v1.1 to v1.2 migration script...
# To use this script you must find/replace
# 'game1' to your game db name
USE game1;
# Add new colums
ALTER TABLE ShopInventory ADD COLUMN Data INT;
# Initalize new colum data.
UPDATE ShopInventory SET Data=0;