1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 17:59:14 +00:00
Radarr/NzbDrone.Services/NzbDrone.Services.Service/Migrations/Migration20120229.cs
2012-02-29 23:58:11 -08:00

40 lines
No EOL
2 KiB
C#

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),
new Column("ExceptionHash", DbType.String, ColumnProperty.NotNull),
new Column("LogMessage", DbType.String, 3000, ColumnProperty.NotNull),
MigrationsHelper.TimestampColumn,
MigrationsHelper.UGuidColumn,
MigrationsHelper.ProductionColumn);
Database.AddTable("Exceptions", new Column("Hash", DbType.String, ColumnProperty.Unique),
new Column("Logger", DbType.String, ColumnProperty.NotNull),
new Column("Type", DbType.String, ColumnProperty.NotNull),
new Column("String", DbType.String, ColumnProperty.NotNull),
MigrationsHelper.VersionColumn);
var indexName = MigrationsHelper.GetIndexName("Exceptions", "Hash");
Database.AddIndex(indexName, "Exceptions", "Hash");
//Database.AddForeignKey("FK_Exceptions_ExceptionInstances", "Exceptions", "Hash", "ExceptionInstances", "ExceptionHash", ForeignKeyConstraint.Cascade);
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();
}
}
}