added log trim command

This commit is contained in:
Keivan Beigi 2013-06-18 18:01:08 -07:00
commit 73f3459264
16 changed files with 62 additions and 69 deletions

View file

@ -1,8 +0,0 @@
namespace NzbDrone.Core.Datastore
{
public interface IReadModels<T> where T : ModelBase
{
T All();
T Get(int id);
}
}

View file

@ -1,9 +0,0 @@
namespace NzbDrone.Core.Datastore
{
public interface IWriteModels<T> where T : ModelBase
{
T Add(T model);
T Update(T model);
void Delete(int id);
}
}

View file

@ -0,0 +1,24 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Tags("")]
[Migration(6)]
public class add_index_to_log_time : NzbDroneMigrationBase
{
protected override void LogDbUpgrade()
{
Delete.Table("Logs");
Create.TableForModel("Logs")
.WithColumn("Message").AsString()
.WithColumn("Time").AsDateTime().Indexed()
.WithColumn("Logger").AsString()
.WithColumn("Method").AsString().Nullable()
.WithColumn("Exception").AsString().Nullable()
.WithColumn("ExceptionType").AsString().Nullable()
.WithColumn("Level").AsString();
}
}
}

View file

@ -1,7 +1,6 @@
using System;
using FluentMigrator.Runner;
using NLog;
using NzbDrone.Common.Composition;
namespace NzbDrone.Core.Datastore.Migration.Framework
{

View file

@ -14,18 +14,18 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
public override void Up()
{
if ((MigrationType)ApplicationContext == MigrationType.Main)
switch ((MigrationType)ApplicationContext)
{
MainDbUpgrade();
}
else if ((MigrationType)ApplicationContext == MigrationType.Log)
{
LogDbUpgrade();
}
else
{
LogDbUpgrade();
MainDbUpgrade();
case MigrationType.Main:
MainDbUpgrade();
return;
case MigrationType.Log:
LogDbUpgrade();
return;
default:
LogDbUpgrade();
MainDbUpgrade();
return;
}
}

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Datastore
namespace NzbDrone.Core.Datastore
{
public enum MigrationType
{

View file

@ -1,6 +1,4 @@
using System.Data;
using System.Diagnostics;
using Marr.Data;
using System.Diagnostics;
namespace NzbDrone.Core.Datastore
{

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
namespace NzbDrone.Core.Datastore
{

View file

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
namespace NzbDrone.Core.Datastore
{

View file

@ -1,8 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Marr.Data;
using Marr.Data.Mapping;
using NzbDrone.Core.Configuration;