1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Core/Datastore/Migrations/Migration20130203.cs
2013-02-15 16:52:50 -08:00

33 lines
939 B
C#

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"))
{
var dirs = new List<RootFolder>();
while (dataReader.Read())
{
var rootFolder = new RootFolder { Path = dataReader["Path"].ToString() };
dirs.Add(rootFolder);
}
objectDb.InsertMany(dirs);
}
//Database.RemoveTable("RootDirs");
}
}
}