2012-03-01 05:36:39 +03:00
|
|
|
using System;
|
|
|
|
using System.Data;
|
|
|
|
using System.Linq;
|
|
|
|
using Migrator.Framework;
|
|
|
|
|
|
|
|
namespace NzbDrone.Services.Service.Migrations
|
|
|
|
{
|
|
|
|
[Migration(20120229)]
|
|
|
|
public class Migration20120229 : Migration
|
|
|
|
{
|
|
|
|
public override void Up()
|
|
|
|
{
|
|
|
|
Database.AddTable("ExceptionInstances", new Column("Id", DbType.Int64, ColumnProperty.PrimaryKeyWithIdentity),
|
2012-03-01 08:10:56 +03:00
|
|
|
new Column("ExceptionHash", DbType.String, ColumnProperty.NotNull),
|
2012-03-01 05:36:39 +03:00
|
|
|
new Column("LogMessage", DbType.String, 3000, ColumnProperty.NotNull),
|
|
|
|
MigrationsHelper.TimestampColumn,
|
2012-03-01 10:58:11 +03:00
|
|
|
MigrationsHelper.UGuidColumn,
|
2012-03-01 05:36:39 +03:00
|
|
|
MigrationsHelper.ProductionColumn);
|
|
|
|
|
2012-03-01 08:10:56 +03:00
|
|
|
Database.AddTable("Exceptions", new Column("Hash", DbType.String, ColumnProperty.Unique),
|
2012-03-01 05:36:39 +03:00
|
|
|
new Column("Logger", DbType.String, ColumnProperty.NotNull),
|
|
|
|
new Column("Type", DbType.String, ColumnProperty.NotNull),
|
|
|
|
new Column("String", DbType.String, ColumnProperty.NotNull),
|
|
|
|
MigrationsHelper.VersionColumn);
|
|
|
|
|
2012-03-01 08:10:56 +03:00
|
|
|
var indexName = MigrationsHelper.GetIndexName("Exceptions", "Hash");
|
|
|
|
Database.AddIndex(indexName, "Exceptions", "Hash");
|
|
|
|
|
|
|
|
//Database.AddForeignKey("FK_Exceptions_ExceptionInstances", "Exceptions", "Hash", "ExceptionInstances", "ExceptionHash", ForeignKeyConstraint.Cascade);
|
2012-03-01 05:36:39 +03:00
|
|
|
|
|
|
|
Database.ExecuteNonQuery("ALTER TABLE ExceptionReports ALTER COLUMN String NTEXT");
|
|
|
|
Database.ExecuteNonQuery("ALTER TABLE Exceptions ALTER COLUMN String NTEXT");
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void Down()
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|