/Aurora/DataManager/Migration/Migrators/Stats/StatsMigrator_2.cs
C# | 103 lines | 69 code | 8 blank | 26 comment | 0 complexity | 6030cf2d46bd2cc4fa3b16b45d537c80 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.DataManager.Migration; 31using Aurora.Framework; 32using Aurora.Framework.Utilities; 33 34namespace Aurora.DataManager 35{ 36 public class StatsMigrator_2 : Migrator 37 { 38 public StatsMigrator_2() 39 { 40 Version = new Version(0, 0, 2); 41 MigrationName = "Stats"; 42 43 schema = new List<SchemaDefinition>(); 44 45 AddSchema("statsdata", ColDefs(ColDef("session_id", ColumnTypes.String50), 46 ColDef("agent_id", ColumnTypes.String50), 47 ColDef("region_id", ColumnTypes.String50), 48 ColDef("agents_in_view", ColumnTypes.String50), 49 ColDef("fps", ColumnTypes.Integer11), 50 ColDef("a_language", ColumnTypes.String50), 51 ColDef("mem_use", ColumnTypes.Integer11), 52 ColDef("meters_traveled", ColumnTypes.Integer11), 53 ColDef("ping", ColumnTypes.Integer11), 54 ColDef("regions_visited", ColumnTypes.Integer11), 55 ColDef("run_time", ColumnTypes.String50), 56 ColDef("sim_fps", ColumnTypes.Integer11), 57 ColDef("start_time", ColumnTypes.Integer11), 58 ColDef("client_version", ColumnTypes.String50), 59 ColDef("s_cpu", ColumnTypes.String128), 60 ColDef("s_gpu", ColumnTypes.String128), 61 ColDef("s_gpuclass", ColumnTypes.String50), 62 ColDef("s_gpuvendor", ColumnTypes.String50), 63 ColDef("s_gpuversion", ColumnTypes.String50), 64 ColDef("s_os", ColumnTypes.String50), 65 ColDef("s_ram", ColumnTypes.String50), 66 ColDef("d_object_kb", ColumnTypes.Integer11), 67 ColDef("d_texture_kb", ColumnTypes.Integer11), 68 ColDef("d_world_kb", ColumnTypes.Integer11), 69 ColDef("n_in_kb", ColumnTypes.Integer11), 70 ColDef("n_in_pk", ColumnTypes.Integer11), 71 ColDef("n_out_kb", ColumnTypes.Integer11), 72 ColDef("n_out_pk", ColumnTypes.Integer11), 73 ColDef("f_dropped", ColumnTypes.Integer11), 74 ColDef("f_failed_resends", ColumnTypes.Integer11), 75 ColDef("f_invalid", ColumnTypes.Integer11), 76 ColDef("f_off_circuit", ColumnTypes.Integer11), 77 ColDef("f_resent", ColumnTypes.Integer11), 78 ColDef("f_send_packet", ColumnTypes.Integer11)), 79 IndexDefs( 80 IndexDef(new string[1] {"session_id"}, IndexType.Primary))); 81 } 82 83 protected override void DoCreateDefaults(IDataConnector genericData) 84 { 85 EnsureAllTablesInSchemaExist(genericData); 86 } 87 88 protected override bool DoValidate(IDataConnector genericData) 89 { 90 return TestThatAllTablesValidate(genericData); 91 } 92 93 protected override void DoMigrate(IDataConnector genericData) 94 { 95 DoCreateDefaults(genericData); 96 } 97 98 protected override void DoPrepareRestorePoint(IDataConnector genericData) 99 { 100 CopyAllTablesToTempVersions(genericData); 101 } 102 } 103}