Added our own custom migrations, a lot easier to migrate DB versions now.

This commit is contained in:
tidusjar 2016-10-22 20:38:05 +01:00
commit 6e3339ad3c
16 changed files with 492 additions and 30 deletions

View file

@ -59,6 +59,12 @@ CREATE TABLE IF NOT EXISTS DBInfo
SchemaVersion INTEGER
);
CREATE TABLE IF NOT EXISTS VersionInfo
(
Version INTEGER NOT NULL,
Description VARCHAR(100) NOT NULL
);
CREATE TABLE IF NOT EXISTS ScheduledJobs
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,

View file

@ -24,6 +24,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
#endregion
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Dapper;
@ -109,7 +111,29 @@ namespace PlexRequests.Store
con.Close();
}
public static IEnumerable<VersionInfo> GetVersionInfo(this IDbConnection con)
{
con.Open();
var result = con.Query<VersionInfo>("SELECT * FROM VersionInfo");
con.Close();
return result;
}
public static void AddVersionInfo(this IDbConnection con, VersionInfo ver)
{
con.Open();
con.Insert(ver);
con.Close();
}
[Table("VersionInfo")]
public class VersionInfo
{
public int Version { get; set; }
public string Description { get; set; }
}
[Table("DBInfo")]
public class DbInfo