aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Data/BaseSqliteRepository.cs')
-rw-r--r--Emby.Server.Implementations/Data/BaseSqliteRepository.cs24
1 files changed, 23 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
index c7ac630a0..8febe83b2 100644
--- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
+++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
@@ -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"
+ }));
+ }
}
}