From d5db4b9d939ff7e1f75366428a903198847fdf9e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 18 Aug 2019 20:24:19 +0100 Subject: [PATCH] try to update PGSQL estateban --- OpenSim/Data/PGSQL/PGSQLEstateData.cs | 10 ++++++++-- OpenSim/Data/PGSQL/Resources/EstateStore.migrations | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/PGSQL/PGSQLEstateData.cs b/OpenSim/Data/PGSQL/PGSQLEstateData.cs index 9489d6cec6..16e56fadba 100644 --- a/OpenSim/Data/PGSQL/PGSQLEstateData.cs +++ b/OpenSim/Data/PGSQL/PGSQLEstateData.cs @@ -286,7 +286,7 @@ namespace OpenSim.Data.PGSQL { es.ClearBans(); - string sql = "select \"bannedUUID\" from estateban where \"EstateID\" = :EstateID"; + string sql = "select * from estateban where \"EstateID\" = :EstateID"; using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) @@ -302,6 +302,8 @@ namespace OpenSim.Data.PGSQL EstateBan eb = new EstateBan(); eb.BannedUserID = new UUID((Guid)reader["bannedUUID"]); //uuid; + eb.BanningUserID = new UUID((Guid)reader["banningUUID"]); //uuid; + eb.BanTime = Convert.ToInt32(reader["banTime"]); eb.BannedHostAddress = "0.0.0.0"; eb.BannedHostIPMask = "0.0.0.0"; es.AddBan(eb); @@ -346,11 +348,15 @@ namespace OpenSim.Data.PGSQL cmd.ExecuteNonQuery(); //Insert after - cmd.CommandText = "insert into estateban (\"EstateID\", \"bannedUUID\",\"bannedIp\", \"bannedIpHostMask\", \"bannedNameMask\") values ( :EstateID, :bannedUUID, '','','' )"; + cmd.CommandText = "insert into estateban (\"EstateID\", \"bannedUUID\",\"bannedIp\", \"bannedIpHostMask\", \"bannedNameMask\", \"banningUUID\",\"banTime\" ) values ( :EstateID, :bannedUUID, '','','', :banningUUID, :banTime )"; cmd.Parameters.AddWithValue("bannedUUID", Guid.Empty); foreach (EstateBan b in es.EstateBans) { + cmd.Parameters["EstateID"].Value = b.EstateID; cmd.Parameters["bannedUUID"].Value = b.BannedUserID.Guid; + cmd.Parameters["banningUUID"].Value = b.BanningUserID.Guid; + cmd.Parameters["banTime"].Value = b.BanTime; + cmd.ExecuteNonQuery(); } } diff --git a/OpenSim/Data/PGSQL/Resources/EstateStore.migrations b/OpenSim/Data/PGSQL/Resources/EstateStore.migrations index 5b450aa45f..d0ca5c07db 100644 --- a/OpenSim/Data/PGSQL/Resources/EstateStore.migrations +++ b/OpenSim/Data/PGSQL/Resources/EstateStore.migrations @@ -125,3 +125,11 @@ CREATE SEQUENCE IF NOT EXISTS "public"."estate_settings_id" CACHE 1; COMMIT; + +:VERSION 14 +BEGIN TRANSACTION; + +ALTER TABLE `estateban` + ADD COLUMN `banningUUID` uuid NOT NULL, + ADD COLUMN `banTime` int NOT NULL DEFAULT 0; +COMMIT;