/Aurora/DataManager/Migration/Migrators/Directory/DirectoryMigrator_11.cs
C# | 175 lines | 138 code | 10 blank | 27 comment | 0 complexity | 2b365f4e19fe7980394a25fb1a72478a MD5 | raw file
1/* 2 * Copyright (c) Contributors, http://aurora-sim.org/ 3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * * Neither the name of the Aurora-Sim Project nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28using System; 29using System.Collections.Generic; 30using Aurora.Framework; 31using Aurora.Framework.Utilities; 32 33namespace Aurora.DataManager.Migration.Migrators 34{ 35 public class DirectoryMigrator_11 : Migrator 36 { 37 public DirectoryMigrator_11() 38 { 39 Version = new Version(0, 0, 11); 40 MigrationName = "Directory"; 41 42 schema = new List<SchemaDefinition>(); 43 44 AddSchema("searchparcel", ColDefs( 45 ColDef("RegionID", ColumnTypes.Char36), 46 ColDef("ParcelID", ColumnTypes.String50), 47 ColDef("LocalID", ColumnTypes.String50), 48 ColDef("LandingX", ColumnTypes.String50), 49 ColDef("LandingY", ColumnTypes.String50), 50 ColDef("LandingZ", ColumnTypes.String50), 51 ColDef("Name", ColumnTypes.String50), 52 ColDef("Description", ColumnTypes.String255), 53 ColDef("Flags", ColumnTypes.String50), 54 ColDef("Dwell", ColumnTypes.String50), 55 ColDef("InfoUUID", ColumnTypes.String50), 56 ColDef("ForSale", ColumnTypes.String50), 57 ColDef("SalePrice", ColumnTypes.String50), 58 ColDef("Auction", ColumnTypes.String50), 59 ColDef("Area", ColumnTypes.String50), 60 ColDef("EstateID", ColumnTypes.String50), 61 ColDef("Maturity", ColumnTypes.String50), 62 ColDef("OwnerID", ColumnTypes.String50), 63 ColDef("GroupID", ColumnTypes.String50), 64 ColDef("ShowInSearch", ColumnTypes.String50), 65 ColDef("SnapshotID", ColumnTypes.String50), 66 ColDef("Bitmap", ColumnTypes.LongText), 67 ColDef("Category", ColumnTypes.String50), 68 new ColumnDefinition 69 { 70 Name = "ScopeID", 71 Type = new ColumnTypeDef 72 { 73 Type = ColumnType.UUID, 74 defaultValue = OpenMetaverse.UUID.Zero.ToString() 75 } 76 } 77 ), IndexDefs( 78 IndexDef(new string[1] {"ParcelID"}, IndexType.Primary), 79 IndexDef(new string[4] {"RegionID", "OwnerID", "Flags", "Category"}, 80 IndexType.Index), 81 IndexDef(new string[2] {"RegionID", "Name"}, IndexType.Index), 82 IndexDef(new string[1] {"OwnerID"}, IndexType.Index), 83// IndexDef(new string[4]{ "Name", "Description", "ShowInSearch", "Category" }, IndexType.Index), 84 IndexDef(new string[3] {"ForSale", "SalePrice", "Area"}, IndexType.Index) 85 )); 86 87 AddSchema("asevents", ColDefs( 88 ColDef("EID", ColumnTypes.Integer11), 89 new ColumnDefinition 90 { 91 Name = "creator", 92 Type = new ColumnTypeDef 93 { 94 Type = ColumnType.UUID 95 } 96 }, 97 new ColumnDefinition 98 { 99 Name = "region", 100 Type = new ColumnTypeDef 101 { 102 Type = ColumnType.UUID 103 } 104 }, 105 new ColumnDefinition 106 { 107 Name = "parcel", 108 Type = new ColumnTypeDef 109 { 110 Type = ColumnType.UUID 111 } 112 }, 113 ColDef("date", ColumnTypes.DateTime), 114 ColDef("cover", ColumnTypes.Integer11), 115 ColDef("maturity", ColumnTypes.TinyInt4), 116 ColDef("flags", ColumnTypes.Integer11), 117 ColDef("duration", ColumnTypes.Integer11), 118 ColDef("localPosX", ColumnTypes.Float), 119 ColDef("localPosY", ColumnTypes.Float), 120 ColDef("localPosZ", ColumnTypes.Float), 121 ColDef("name", ColumnTypes.String50), 122 ColDef("description", ColumnTypes.String255), 123 ColDef("category", ColumnTypes.String50), 124 new ColumnDefinition 125 { 126 Name = "scopeID", 127 Type = new ColumnTypeDef 128 { 129 Type = ColumnType.UUID, 130 defaultValue = OpenMetaverse.UUID.Zero.ToString() 131 } 132 } 133 ), IndexDefs( 134 IndexDef(new string[1] {"EID"}, IndexType.Primary), 135 IndexDef(new string[1] {"name"}, IndexType.Index), 136 IndexDef(new string[2] {"date", "flags"}, IndexType.Index), 137 IndexDef(new string[2] {"region", "maturity"}, IndexType.Index) 138 )); 139 140 AddSchema("event_notifications", ColDefs( 141 new ColumnDefinition 142 { 143 Name = "UserID", 144 Type = new ColumnTypeDef 145 { 146 Type = ColumnType.UUID 147 } 148 }, 149 ColDef("EventID", ColumnTypes.Integer11) 150 ), IndexDefs( 151 IndexDef(new string[1] {"UserID"}, IndexType.Primary) 152 )); 153 } 154 155 protected override void DoCreateDefaults(IDataConnector genericData) 156 { 157 EnsureAllTablesInSchemaExist(genericData); 158 } 159 160 protected override bool DoValidate(IDataConnector genericData) 161 { 162 return TestThatAllTablesValidate(genericData); 163 } 164 165 protected override void DoMigrate(IDataConnector genericData) 166 { 167 DoCreateDefaults(genericData); 168 } 169 170 protected override void DoPrepareRestorePoint(IDataConnector genericData) 171 { 172 CopyAllTablesToTempVersions(genericData); 173 } 174 } 175}