From 8424dd6ede72a0a08b88917ed9fe4a78a07f5810 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Wed, 6 Jul 2011 00:37:58 -0700 Subject: [PATCH] Increased some columns sizes to avoid cutoffs. --- NzbDrone.Core.Test/LogProviderTest.cs | 32 +++++++++++++++++++ .../Datastore/Migrations/Migration20110703.cs | 22 ------------- .../Datastore/Migrations/Migration20110705.cs | 32 +++++++++++++++++++ NzbDrone.Core/Datastore/MigrationsHelper.cs | 4 +-- NzbDrone.Core/NzbDrone.Core.csproj | 2 +- 5 files changed, 67 insertions(+), 25 deletions(-) delete mode 100644 NzbDrone.Core/Datastore/Migrations/Migration20110703.cs create mode 100644 NzbDrone.Core/Datastore/Migrations/Migration20110705.cs diff --git a/NzbDrone.Core.Test/LogProviderTest.cs b/NzbDrone.Core.Test/LogProviderTest.cs index 4ee5a2091..ec147eab1 100644 --- a/NzbDrone.Core.Test/LogProviderTest.cs +++ b/NzbDrone.Core.Test/LogProviderTest.cs @@ -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().Should().HaveCount(1); + + var logItem = db.Fetch().First(); + + logItem.Message.Should().HaveLength(message.Length); + Assert.AreEqual(message, logItem.Message); + } + [Test] public void clearLog() diff --git a/NzbDrone.Core/Datastore/Migrations/Migration20110703.cs b/NzbDrone.Core/Datastore/Migrations/Migration20110703.cs deleted file mode 100644 index e1f176e99..000000000 --- a/NzbDrone.Core/Datastore/Migrations/Migration20110703.cs +++ /dev/null @@ -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(); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Datastore/Migrations/Migration20110705.cs b/NzbDrone.Core/Datastore/Migrations/Migration20110705.cs new file mode 100644 index 000000000..1bcef53d3 --- /dev/null +++ b/NzbDrone.Core/Datastore/Migrations/Migration20110705.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Datastore/MigrationsHelper.cs b/NzbDrone.Core/Datastore/MigrationsHelper.cs index fa4e55986..b5b74ab8e 100644 --- a/NzbDrone.Core/Datastore/MigrationsHelper.cs +++ b/NzbDrone.Core/Datastore/MigrationsHelper.cs @@ -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); } } diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index ae18cc3bb..0368c892b 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -176,7 +176,7 @@ - +