Increased some columns sizes to avoid cutoffs.

pull/7/merge
kay.one 14 years ago
parent f0735c0693
commit 8424dd6ede

@ -50,6 +50,38 @@ namespace NzbDrone.Core.Test
Assert.AreEqual("write_log", logItem.Method);
}
[Test]
public void write_long_log()
{
//setup
var message = String.Empty;
for (int i = 0; i < 100; i++)
{
message += Guid.NewGuid();
}
var db = MockLib.GetEmptyDatabase(true);
var sonicTarget = new DatabaseTarget(db);
LogManager.Configuration.AddTarget("DbLogger", sonicTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, sonicTarget));
LogManager.Configuration.Reload();
Logger Logger = LogManager.GetCurrentClassLogger();
//Act
Logger.Info(message);
//Assert
db.Fetch<Log>().Should().HaveCount(1);
var logItem = db.Fetch<Log>().First();
logItem.Message.Should().HaveLength(message.Length);
Assert.AreEqual(message, logItem.Message);
}
[Test]
public void clearLog()

@ -1,22 +0,0 @@
using System;
using System.Data;
using Migrator.Framework;
namespace NzbDrone.Core.Datastore.Migrations
{
[Migration(20110703)]
public class Migration20110703 : Migration
{
public override void Up()
{
}
public override void Down()
{
throw new NotImplementedException();
}
}
}

@ -0,0 +1,32 @@
using System;
using System.Data;
using Migrator.Framework;
namespace NzbDrone.Core.Datastore.Migrations
{
[Migration(20110705)]
public class Migration20110705 : Migration
{
public override void Up()
{
//Upgrade column size
Database.ChangeColumn("Series", new Column("Overview", DbType.String, 4000, ColumnProperty.Null));
Database.ChangeColumn("Series", new Column("Path", DbType.String, 4000, ColumnProperty.NotNull));
Database.ChangeColumn("Episodes", new Column("Overview", DbType.String, 4000, ColumnProperty.Null));
Database.ChangeColumn("EpisodeFiles", new Column("Path", DbType.String, 4000, ColumnProperty.NotNull));
Database.ChangeColumn("RootDirs", new Column("Path", DbType.String, 4000, ColumnProperty.NotNull));
Database.ChangeColumn("Logs", new Column("Message", DbType.String, 4000, ColumnProperty.NotNull));
Database.ChangeColumn("Logs", new Column("Exception", DbType.String, 4000, ColumnProperty.Null));
}
public override void Down()
{
throw new NotImplementedException();
}
}
}

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Datastore
EnsureDatabase(connetionString);
Logger.Info("Preparing run database migration");
Logger.Info("Preparing to run database migration");
try
{
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Datastore
}
catch (Exception e)
{
Logger.FatalException("An error has occured while migrating database", e);
Logger.FatalException("An error has occurred while migrating database", e);
}
}

@ -176,7 +176,7 @@
<Compile Include="Datastore\MigrationLogger.cs" />
<Compile Include="Datastore\MigrationsHelper.cs" />
<Compile Include="Datastore\CustomeMapper.cs" />
<Compile Include="Datastore\Migrations\Migration20110703.cs" />
<Compile Include="Datastore\Migrations\Migration20110705.cs" />
<Compile Include="Datastore\Migrations\Migration20110622.cs" />
<Compile Include="Datastore\SqliteProvider.cs" />
<Compile Include="Fluent.cs" />

Loading…
Cancel
Save