rework additional repositories

This commit is contained in:
Luke Pulverenti
2016-11-18 04:28:39 -05:00
parent fa714425dd
commit 9f40c1982b
8 changed files with 543 additions and 634 deletions

View File

@@ -69,7 +69,7 @@ namespace Emby.Server.Implementations.Data
//}
db.ExecuteAll(string.Join(";", queries));
return db;
}
@@ -119,5 +119,27 @@ namespace Emby.Server.Implementations.Data
{
}
protected void AddColumn(IDatabaseConnection connection, string table, string columnName, string type)
{
foreach (var row in connection.Query("PRAGMA table_info(" + table + ")"))
{
if (row[1].SQLiteType != SQLiteType.Null)
{
var name = row[1].ToString();
if (string.Equals(name, columnName, StringComparison.OrdinalIgnoreCase))
{
return;
}
}
}
connection.ExecuteAll(string.Join(";", new string[]
{
"alter table " + table,
"add column " + columnName + " " + type + " NULL"
}));
}
}
}