2013-02-04 07:18:59 +03: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 07:07:07 +03:00
|
|
|
var dirs = new List<RootFolder>();
|
2013-02-04 07:18:59 +03:00
|
|
|
while (dataReader.Read())
|
|
|
|
{
|
2013-02-05 07:07:07 +03:00
|
|
|
var rootFolder = new RootFolder { Path = dataReader["Path"].ToString() };
|
2013-02-04 07:18:59 +03:00
|
|
|
dirs.Add(rootFolder);
|
|
|
|
}
|
|
|
|
objectDb.InsertMany(dirs);
|
|
|
|
}
|
|
|
|
//Database.RemoveTable("RootDirs");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|