Add migrations
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
namespace LeafWeb.Core.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class InitialCreate : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.FluxnetSite",
|
||||
c => new
|
||||
{
|
||||
FluxnetId = c.String(nullable: false, maxLength: 128),
|
||||
SiteName = c.String(),
|
||||
Country = c.String(),
|
||||
LandUnit = c.String(),
|
||||
})
|
||||
.PrimaryKey(t => t.FluxnetId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.LeafInputFile",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false, identity: true),
|
||||
Filename = c.String(),
|
||||
Contents = c.Binary(),
|
||||
LeafInput_Id = c.Int(),
|
||||
})
|
||||
.PrimaryKey(t => t.Id)
|
||||
.ForeignKey("dbo.LeafInput", t => t.LeafInput_Id)
|
||||
.Index(t => t.LeafInput_Id);
|
||||
|
||||
CreateTable(
|
||||
"dbo.LeafInput",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false, identity: true),
|
||||
CurrentStatus = c.Int(nullable: false),
|
||||
Name = c.String(nullable: false),
|
||||
Email = c.String(nullable: false),
|
||||
Identifier = c.String(nullable: false),
|
||||
SiteId = c.String(nullable: false),
|
||||
Added = c.DateTime(nullable: false),
|
||||
PhotosynthesisType_Id = c.String(maxLength: 128),
|
||||
})
|
||||
.PrimaryKey(t => t.Id)
|
||||
.ForeignKey("dbo.PhotosynthesisType", t => t.PhotosynthesisType_Id)
|
||||
.Index(t => t.PhotosynthesisType_Id);
|
||||
|
||||
CreateTable(
|
||||
"dbo.LeafOutputFile",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false, identity: true),
|
||||
Filename = c.String(),
|
||||
Contents = c.Binary(),
|
||||
LeafInput_Id = c.Int(),
|
||||
})
|
||||
.PrimaryKey(t => t.Id)
|
||||
.ForeignKey("dbo.LeafInput", t => t.LeafInput_Id)
|
||||
.Index(t => t.LeafInput_Id);
|
||||
|
||||
CreateTable(
|
||||
"dbo.PhotosynthesisType",
|
||||
c => new
|
||||
{
|
||||
Id = c.String(nullable: false, maxLength: 128),
|
||||
Name = c.String(),
|
||||
SortOrder = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.Id);
|
||||
|
||||
CreateTable(
|
||||
"dbo.LeafInputStatus",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false, identity: true),
|
||||
Status = c.Int(nullable: false),
|
||||
Description = c.String(),
|
||||
Details = c.String(),
|
||||
DateTime = c.DateTime(nullable: false),
|
||||
LeafInput_Id = c.Int(),
|
||||
})
|
||||
.PrimaryKey(t => t.Id)
|
||||
.ForeignKey("dbo.LeafInput", t => t.LeafInput_Id)
|
||||
.Index(t => t.LeafInput_Id);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropForeignKey("dbo.LeafInputStatus", "LeafInput_Id", "dbo.LeafInput");
|
||||
DropForeignKey("dbo.LeafInput", "PhotosynthesisType_Id", "dbo.PhotosynthesisType");
|
||||
DropForeignKey("dbo.LeafOutputFile", "LeafInput_Id", "dbo.LeafInput");
|
||||
DropForeignKey("dbo.LeafInputFile", "LeafInput_Id", "dbo.LeafInput");
|
||||
DropIndex("dbo.LeafInputStatus", new[] { "LeafInput_Id" });
|
||||
DropIndex("dbo.LeafOutputFile", new[] { "LeafInput_Id" });
|
||||
DropIndex("dbo.LeafInput", new[] { "PhotosynthesisType_Id" });
|
||||
DropIndex("dbo.LeafInputFile", new[] { "LeafInput_Id" });
|
||||
DropTable("dbo.LeafInputStatus");
|
||||
DropTable("dbo.PhotosynthesisType");
|
||||
DropTable("dbo.LeafOutputFile");
|
||||
DropTable("dbo.LeafInput");
|
||||
DropTable("dbo.LeafInputFile");
|
||||
DropTable("dbo.FluxnetSite");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user