mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 11:57:03 +08:00
Formatting cleanup.
This commit is contained in:
@@ -36,7 +36,7 @@ using log4net;
|
||||
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
///
|
||||
/// The Migration theory is based on the ruby on rails concept.
|
||||
/// Each database driver is going to be allowed to have files in
|
||||
@@ -77,11 +77,11 @@ namespace OpenSim.Data
|
||||
// private string _subtype;
|
||||
private Assembly _assem;
|
||||
private Regex _match;
|
||||
|
||||
|
||||
private static readonly string _migrations_create = "create table migrations(name varchar(100), version int)";
|
||||
// private static readonly string _migrations_init = "insert into migrations values('migrations', 1)";
|
||||
// private static readonly string _migrations_find = "select version from migrations where name='migrations'";
|
||||
|
||||
|
||||
public Migration(DbConnection conn, Assembly assem, string type)
|
||||
{
|
||||
_type = type;
|
||||
@@ -105,7 +105,7 @@ namespace OpenSim.Data
|
||||
// clever, eh, we figure out which migrations version we are
|
||||
int migration_version = FindVersion("migrations");
|
||||
|
||||
if (migration_version > 0)
|
||||
if (migration_version > 0)
|
||||
return;
|
||||
|
||||
// If not, create the migration tables
|
||||
@@ -130,14 +130,14 @@ namespace OpenSim.Data
|
||||
m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!");
|
||||
|
||||
DbCommand cmd = _conn.CreateCommand();
|
||||
foreach (KeyValuePair<int, string> kvp in migrations)
|
||||
foreach (KeyValuePair<int, string> kvp in migrations)
|
||||
{
|
||||
int newversion = kvp.Key;
|
||||
cmd.CommandText = kvp.Value;
|
||||
// we need to up the command timeout to infinite as we might be doing long migrations.
|
||||
cmd.CommandTimeout = 0;
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
|
||||
if (version == 0)
|
||||
{
|
||||
InsertVersion(_type, newversion);
|
||||
@@ -158,7 +158,7 @@ namespace OpenSim.Data
|
||||
// foreach (string s in names)
|
||||
// {
|
||||
// Match m = _match.Match(s);
|
||||
// if (m.Success)
|
||||
// if (m.Success)
|
||||
// {
|
||||
// int MigrationVersion = int.Parse(m.Groups[1].ToString());
|
||||
// if (MigrationVersion > max)
|
||||
@@ -168,10 +168,10 @@ namespace OpenSim.Data
|
||||
// return max;
|
||||
// }
|
||||
|
||||
public int Version
|
||||
public int Version
|
||||
{
|
||||
get { return FindVersion(_type); }
|
||||
set {
|
||||
set {
|
||||
if (Version < 1)
|
||||
{
|
||||
InsertVersion(_type, value);
|
||||
@@ -179,11 +179,11 @@ namespace OpenSim.Data
|
||||
else
|
||||
{
|
||||
UpdateVersion(_type, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int FindVersion(string type)
|
||||
private int FindVersion(string type)
|
||||
{
|
||||
int version = 0;
|
||||
DbCommand cmd = _conn.CreateCommand();
|
||||
@@ -206,22 +206,22 @@ namespace OpenSim.Data
|
||||
return version;
|
||||
}
|
||||
|
||||
private void InsertVersion(string type, int version)
|
||||
private void InsertVersion(string type, int version)
|
||||
{
|
||||
DbCommand cmd = _conn.CreateCommand();
|
||||
cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")";
|
||||
m_log.InfoFormat("[MIGRATIONS] Creating {0} at version {1}", type, version);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
private void UpdateVersion(string type, int version)
|
||||
|
||||
private void UpdateVersion(string type, int version)
|
||||
{
|
||||
DbCommand cmd = _conn.CreateCommand();
|
||||
cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'";
|
||||
m_log.InfoFormat("[MIGRATIONS] Updating {0} to version {1}", type, version);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
|
||||
// private SortedList<int, string> GetAllMigrations()
|
||||
// {
|
||||
// return GetMigrationsAfter(0);
|
||||
@@ -261,4 +261,4 @@ namespace OpenSim.Data
|
||||
return migrations;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user