diff --git a/OpenSim/Data/SQLite/Resources/EstateStore.migrations b/OpenSim/Data/SQLite/Resources/EstateStore.migrations index 37fa1d9123..30e04fdf56 100644 --- a/OpenSim/Data/SQLite/Resources/EstateStore.migrations +++ b/OpenSim/Data/SQLite/Resources/EstateStore.migrations @@ -63,7 +63,16 @@ CREATE TABLE IF NOT EXISTS estateban ( bannedIpHostMask varchar(16) NOT NULL, bannedNameMask varchar(64) default NULL ); + CREATE INDEX estate_ban_estate_id on estateban(EstateID); COMMIT; +:VERSION 11 +BEGIN; +ALTER TABLE `estateban` + ADD COLUMN `banningUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', + ADD COLUMN `banTime` integer NOT NULL DEFAULT 0; +COMMIT; + + diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 0fcab21824..5e55323175 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs @@ -278,7 +278,7 @@ namespace OpenSim.Data.SQLite using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) { - cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; + cmd.CommandText = "select * from estateban where EstateID = :EstateID"; cmd.Parameters.AddWithValue(":EstateID", es.EstateID); r = cmd.ExecuteReader(); @@ -288,12 +288,11 @@ namespace OpenSim.Data.SQLite { EstateBan eb = new EstateBan(); - UUID uuid = new UUID(); - UUID.TryParse(r["bannedUUID"].ToString(), out uuid); - - eb.BannedUserID = uuid; + eb.BannedUserID = DBGuid.FromDB(r["bannedUUID"]); ; eb.BannedHostAddress = "0.0.0.0"; eb.BannedHostIPMask = "0.0.0.0"; + eb.BanningUserID = DBGuid.FromDB(r["banningUUID"]); + eb.BanTime = Convert.ToInt32(r["banTime"]); es.AddBan(eb); } r.Close(); @@ -310,12 +309,14 @@ namespace OpenSim.Data.SQLite cmd.Parameters.Clear(); - 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 )"; foreach (EstateBan b in es.EstateBans) { cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString()); + cmd.Parameters.AddWithValue(":banningUUID", b.BanningUserID.ToString()); + cmd.Parameters.AddWithValue(":banTime", b.BanTime); cmd.ExecuteNonQuery(); cmd.Parameters.Clear();