try to update PGSQL estateban

0.9.1.0-post-fixes
UbitUmarov 2019-08-18 20:24:19 +01:00
parent a687c5fce9
commit d5db4b9d93
2 changed files with 16 additions and 2 deletions

View File

@ -286,7 +286,7 @@ namespace OpenSim.Data.PGSQL
{ {
es.ClearBans(); 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 (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
@ -302,6 +302,8 @@ namespace OpenSim.Data.PGSQL
EstateBan eb = new EstateBan(); EstateBan eb = new EstateBan();
eb.BannedUserID = new UUID((Guid)reader["bannedUUID"]); //uuid; 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.BannedHostAddress = "0.0.0.0";
eb.BannedHostIPMask = "0.0.0.0"; eb.BannedHostIPMask = "0.0.0.0";
es.AddBan(eb); es.AddBan(eb);
@ -346,11 +348,15 @@ namespace OpenSim.Data.PGSQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
//Insert after //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); cmd.Parameters.AddWithValue("bannedUUID", Guid.Empty);
foreach (EstateBan b in es.EstateBans) foreach (EstateBan b in es.EstateBans)
{ {
cmd.Parameters["EstateID"].Value = b.EstateID;
cmd.Parameters["bannedUUID"].Value = b.BannedUserID.Guid; cmd.Parameters["bannedUUID"].Value = b.BannedUserID.Guid;
cmd.Parameters["banningUUID"].Value = b.BanningUserID.Guid;
cmd.Parameters["banTime"].Value = b.BanTime;
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }

View File

@ -125,3 +125,11 @@ CREATE SEQUENCE IF NOT EXISTS "public"."estate_settings_id"
CACHE 1; CACHE 1;
COMMIT; COMMIT;
:VERSION 14
BEGIN TRANSACTION;
ALTER TABLE `estateban`
ADD COLUMN `banningUUID` uuid NOT NULL,
ADD COLUMN `banTime` int NOT NULL DEFAULT 0;
COMMIT;