Sonarr/NzbDrone.Core/Datastore/Migrations/Migration20130203.cs

33 lines
939 B
C#
Raw Normal View History

2013-02-04 04:18:59 +00:00
using System.Collections.Generic;
using Migrator.Framework;
using NzbDrone.Core.Repository;
using NzbDrone.Core.RootFolders;
namespace NzbDrone.Core.Datastore.Migrations
{
[Migration(20130203)]
public class Migration20130203 : NzbDroneMigration
{
protected override void MainDbUpgrade()
{
var objectDb = GetObjectDb();
var rootFolderRepo = new RootFolderRepository(objectDb);
using (var dataReader = Database.ExecuteQuery("SELECT * from RootDirs"))
{
2013-02-05 04:07:07 +00:00
var dirs = new List<RootFolder>();
2013-02-04 04:18:59 +00:00
while (dataReader.Read())
{
2013-02-05 04:07:07 +00:00
var rootFolder = new RootFolder { Path = dataReader["Path"].ToString() };
2013-02-04 04:18:59 +00:00
dirs.Add(rootFolder);
}
objectDb.InsertMany(dirs);
}
//Database.RemoveTable("RootDirs");
}
}
}