@@ -0,0 +1,67 @@ | |||
using System; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
using DotNetCore.CAP.EntityFrameworkCore.Test; | |||
namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | |||
{ | |||
[DbContext(typeof(TestDbContext))] | |||
[Migration("20170628102530_Init")] | |||
partial class Init | |||
{ | |||
protected override void BuildTargetModel(ModelBuilder modelBuilder) | |||
{ | |||
modelBuilder | |||
.HasAnnotation("ProductVersion", "1.1.2") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.CapReceivedMessage", b => | |||
{ | |||
b.Property<string>("Id") | |||
.ValueGeneratedOnAdd(); | |||
b.Property<DateTime>("Added"); | |||
b.Property<string>("Content"); | |||
b.Property<string>("KeyName"); | |||
b.Property<DateTime>("LastRun"); | |||
b.Property<int>("Retries"); | |||
b.Property<string>("StateName") | |||
.HasMaxLength(50); | |||
b.HasKey("Id"); | |||
b.ToTable("CapReceivedMessages"); | |||
}); | |||
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.CapSentMessage", b => | |||
{ | |||
b.Property<string>("Id") | |||
.ValueGeneratedOnAdd(); | |||
b.Property<DateTime>("Added"); | |||
b.Property<string>("Content"); | |||
b.Property<string>("KeyName"); | |||
b.Property<DateTime>("LastRun"); | |||
b.Property<int>("Retries"); | |||
b.Property<string>("StateName") | |||
.HasMaxLength(50); | |||
b.HasKey("Id"); | |||
b.ToTable("CapSentMessages"); | |||
}); | |||
} | |||
} | |||
} |
@@ -0,0 +1,55 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | |||
{ | |||
public partial class Init : Migration | |||
{ | |||
protected override void Up(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.CreateTable( | |||
name: "CapReceivedMessages", | |||
columns: table => new | |||
{ | |||
Id = table.Column<string>(nullable: false), | |||
Added = table.Column<DateTime>(nullable: false), | |||
Content = table.Column<string>(nullable: true), | |||
KeyName = table.Column<string>(nullable: true), | |||
LastRun = table.Column<DateTime>(nullable: false), | |||
Retries = table.Column<int>(nullable: false), | |||
StateName = table.Column<string>(maxLength: 50, nullable: true) | |||
}, | |||
constraints: table => | |||
{ | |||
table.PrimaryKey("PK_CapReceivedMessages", x => x.Id); | |||
}); | |||
migrationBuilder.CreateTable( | |||
name: "CapSentMessages", | |||
columns: table => new | |||
{ | |||
Id = table.Column<string>(nullable: false), | |||
Added = table.Column<DateTime>(nullable: false), | |||
Content = table.Column<string>(nullable: true), | |||
KeyName = table.Column<string>(nullable: true), | |||
LastRun = table.Column<DateTime>(nullable: false), | |||
Retries = table.Column<int>(nullable: false), | |||
StateName = table.Column<string>(maxLength: 50, nullable: true) | |||
}, | |||
constraints: table => | |||
{ | |||
table.PrimaryKey("PK_CapSentMessages", x => x.Id); | |||
}); | |||
} | |||
protected override void Down(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.DropTable( | |||
name: "CapReceivedMessages"); | |||
migrationBuilder.DropTable( | |||
name: "CapSentMessages"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
using System; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
using DotNetCore.CAP.EntityFrameworkCore.Test; | |||
namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | |||
{ | |||
[DbContext(typeof(TestDbContext))] | |||
partial class TestDbContextModelSnapshot : ModelSnapshot | |||
{ | |||
protected override void BuildModel(ModelBuilder modelBuilder) | |||
{ | |||
modelBuilder | |||
.HasAnnotation("ProductVersion", "1.1.2") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.CapReceivedMessage", b => | |||
{ | |||
b.Property<string>("Id") | |||
.ValueGeneratedOnAdd(); | |||
b.Property<DateTime>("Added"); | |||
b.Property<string>("Content"); | |||
b.Property<string>("KeyName"); | |||
b.Property<DateTime>("LastRun"); | |||
b.Property<int>("Retries"); | |||
b.Property<string>("StateName") | |||
.HasMaxLength(50); | |||
b.HasKey("Id"); | |||
b.ToTable("CapReceivedMessages"); | |||
}); | |||
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.CapSentMessage", b => | |||
{ | |||
b.Property<string>("Id") | |||
.ValueGeneratedOnAdd(); | |||
b.Property<DateTime>("Added"); | |||
b.Property<string>("Content"); | |||
b.Property<string>("KeyName"); | |||
b.Property<DateTime>("LastRun"); | |||
b.Property<int>("Retries"); | |||
b.Property<string>("StateName") | |||
.HasMaxLength(50); | |||
b.HasKey("Id"); | |||
b.ToTable("CapSentMessages"); | |||
}); | |||
} | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using Microsoft.EntityFrameworkCore; | |||
namespace DotNetCore.CAP.EntityFrameworkCore.Test | |||
{ | |||
public class TestDbContext : CapDbContext | |||
{ | |||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |||
{ | |||
var connectionString = ConnectionUtil.GetConnectionString(); | |||
optionsBuilder.UseSqlServer(connectionString); | |||
} | |||
} | |||
} |