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

30 lines
868 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();
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);
}
2013-02-04 04:18:59 +00:00
//Database.RemoveTable("RootDirs");
}
}
}