From 6d2f6be82b82c96a7457c5b25ed0ca73e6039893 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 19 May 2008 21:47:31 +0000 Subject: autocreate appearance table if it isn't there --- OpenSim/Data/MySQL/MySQLUserData.cs | 18 ++++++++++ OpenSim/Data/MySQL/Resources/AvatarAppearance.sql | 39 ---------------------- .../MySQL/Resources/CreateAvatarAppearance.sql | 39 ++++++++++++++++++++++ 3 files changed, 57 insertions(+), 39 deletions(-) delete mode 100644 OpenSim/Data/MySQL/Resources/AvatarAppearance.sql create mode 100644 OpenSim/Data/MySQL/Resources/CreateAvatarAppearance.sql (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index f7d5659..56bdcbf 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -54,6 +54,7 @@ namespace OpenSim.Data.MySQL private string m_agentsTableName; private string m_usersTableName; private string m_userFriendsTableName; + private string m_appearanceTableName = "avatarappearance"; private string m_connectString; private BaseDatabaseConnector m_databaseMapper; private AppearanceTableMapper m_appearanceMapper; @@ -130,11 +131,13 @@ namespace OpenSim.Data.MySQL tableList[m_agentsTableName] = null; tableList[m_usersTableName] = null; tableList[m_userFriendsTableName] = null; + tableList[m_appearanceTableName] = null; database.GetTableVersion(tableList); UpgradeAgentsTable(tableList[m_agentsTableName]); UpgradeUsersTable(tableList[m_usersTableName]); UpgradeFriendsTable(tableList[m_userFriendsTableName]); + UpgradeAppearanceTable(tableList[m_appearanceTableName]); } /// @@ -188,6 +191,21 @@ namespace OpenSim.Data.MySQL } } + /// + /// Create or upgrade the table if necessary + /// + /// A null indicates that the table does not + /// currently exist + private void UpgradeAppearanceTable(string oldVersion) + { + // null as the version, indicates that the table didn't exist + if (oldVersion == null) + { + database.ExecuteResourceSql("CreateAvatarAppearance.sql"); + return; + } + } + #endregion // see IUserData diff --git a/OpenSim/Data/MySQL/Resources/AvatarAppearance.sql b/OpenSim/Data/MySQL/Resources/AvatarAppearance.sql deleted file mode 100644 index 0deb099..0000000 --- a/OpenSim/Data/MySQL/Resources/AvatarAppearance.sql +++ /dev/null @@ -1,39 +0,0 @@ --- --- Create schema avatar_appearance --- - -DROP TABLE IF EXISTS `avatarappearance`; -CREATE TABLE `avatarappearance` ( - `UUID` char(36) NOT NULL, - `Serial` int(10) unsigned NOT NULL, - `WearableItem0` char(36) NOT NULL, - `WearableAsset0` char(36) NOT NULL, - `WearableItem1` char(36) NOT NULL, - `WearableAsset1` char(36) NOT NULL, - `WearableItem2` char(36) NOT NULL, - `WearableAsset2` char(36) NOT NULL, - `WearableItem3` char(36) NOT NULL, - `WearableAsset3` char(36) NOT NULL, - `WearableItem4` char(36) NOT NULL, - `WearableAsset4` char(36) NOT NULL, - `WearableItem5` char(36) NOT NULL, - `WearableAsset5` char(36) NOT NULL, - `WearableItem6` char(36) NOT NULL, - `WearableAsset6` char(36) NOT NULL, - `WearableItem7` char(36) NOT NULL, - `WearableAsset7` char(36) NOT NULL, - `WearableItem8` char(36) NOT NULL, - `WearableAsset8` char(36) NOT NULL, - `WearableItem9` char(36) NOT NULL, - `WearableAsset9` char(36) NOT NULL, - `WearableItem10` char(36) NOT NULL, - `WearableAsset10` char(36) NOT NULL, - `WearableItem11` char(36) NOT NULL, - `WearableAsset11` char(36) NOT NULL, - `WearableItem12` char(36) NOT NULL, - `WearableAsset12` char(36) NOT NULL, - - - PRIMARY KEY (`UUID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev.1'; - diff --git a/OpenSim/Data/MySQL/Resources/CreateAvatarAppearance.sql b/OpenSim/Data/MySQL/Resources/CreateAvatarAppearance.sql new file mode 100644 index 0000000..0deb099 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/CreateAvatarAppearance.sql @@ -0,0 +1,39 @@ +-- +-- Create schema avatar_appearance +-- + +DROP TABLE IF EXISTS `avatarappearance`; +CREATE TABLE `avatarappearance` ( + `UUID` char(36) NOT NULL, + `Serial` int(10) unsigned NOT NULL, + `WearableItem0` char(36) NOT NULL, + `WearableAsset0` char(36) NOT NULL, + `WearableItem1` char(36) NOT NULL, + `WearableAsset1` char(36) NOT NULL, + `WearableItem2` char(36) NOT NULL, + `WearableAsset2` char(36) NOT NULL, + `WearableItem3` char(36) NOT NULL, + `WearableAsset3` char(36) NOT NULL, + `WearableItem4` char(36) NOT NULL, + `WearableAsset4` char(36) NOT NULL, + `WearableItem5` char(36) NOT NULL, + `WearableAsset5` char(36) NOT NULL, + `WearableItem6` char(36) NOT NULL, + `WearableAsset6` char(36) NOT NULL, + `WearableItem7` char(36) NOT NULL, + `WearableAsset7` char(36) NOT NULL, + `WearableItem8` char(36) NOT NULL, + `WearableAsset8` char(36) NOT NULL, + `WearableItem9` char(36) NOT NULL, + `WearableAsset9` char(36) NOT NULL, + `WearableItem10` char(36) NOT NULL, + `WearableAsset10` char(36) NOT NULL, + `WearableItem11` char(36) NOT NULL, + `WearableAsset11` char(36) NOT NULL, + `WearableItem12` char(36) NOT NULL, + `WearableAsset12` char(36) NOT NULL, + + + PRIMARY KEY (`UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev.1'; + -- cgit v1.1