Split LeafOutputFile content into different table for performance
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace LeafWeb.Core.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
|
||||
public sealed partial class LeafOutputFileContents : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(LeafOutputFileContents));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201605210257006_LeafOutputFileContents"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
namespace LeafWeb.Core.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class LeafOutputFileContents : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.LeafOutputFileContents",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false),
|
||||
Contents = c.Binary(),
|
||||
})
|
||||
.PrimaryKey(t => t.Id)
|
||||
.ForeignKey("dbo.LeafOutputFile", t => t.Id)
|
||||
.Index(t => t.Id);
|
||||
|
||||
Sql(
|
||||
"INSERT INTO dbo.LeafOutputFileContents "
|
||||
+ "(Id, Contents) "
|
||||
+ "SELECT Id, Contents "
|
||||
+ "FROM dbo.LeafOutputFile");
|
||||
|
||||
DropColumn("dbo.LeafOutputFile", "Contents");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.LeafOutputFile", "Contents", c => c.Binary());
|
||||
|
||||
Sql(
|
||||
"UPDATE dbo.LeafOutputFile "
|
||||
+ "SET dbo.LeafOutputFile.Contents = FileContents.Contents "
|
||||
+ "FROM dbo.LeafOutputFileContents as FileContents "
|
||||
+ "WHERE dbo.LeafOutputFile.Id = FileContents.Id");
|
||||
|
||||
DropForeignKey("dbo.LeafOutputFileContents", "Id", "dbo.LeafOutputFile");
|
||||
DropIndex("dbo.LeafOutputFileContents", new[] { "Id" });
|
||||
DropTable("dbo.LeafOutputFileContents");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user