Skip to content

Commit c132d94

Browse files
committed
update inital migration
1 parent 1bd1374 commit c132d94

3 files changed

Lines changed: 30 additions & 19 deletions

File tree

src/Services/Marketing/Marketing.API/Migrations/20170601175200_Initial.Designer.cs renamed to src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/20170602122539_Initial.Designer.cs

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Services/Marketing/Marketing.API/Migrations/20170601175200_Initial.cs renamed to src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/20170602122539_Initial.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using System;
22
using System.Collections.Generic;
33
using Microsoft.EntityFrameworkCore.Migrations;
4-
using Microsoft.EntityFrameworkCore.Metadata;
54

6-
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Migrations
5+
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations
76
{
87
public partial class Initial : Migration
98
{
@@ -13,6 +12,10 @@ protected override void Up(MigrationBuilder migrationBuilder)
1312
name: "campaign_hilo",
1413
incrementBy: 10);
1514

15+
migrationBuilder.CreateSequence(
16+
name: "rule_hilo",
17+
incrementBy: 10);
18+
1619
migrationBuilder.CreateTable(
1720
name: "Campaign",
1821
columns: table => new
@@ -29,43 +32,45 @@ protected override void Up(MigrationBuilder migrationBuilder)
2932
});
3033

3134
migrationBuilder.CreateTable(
32-
name: "Rules",
35+
name: "Rule",
3336
columns: table => new
3437
{
35-
Id = table.Column<int>(nullable: false)
36-
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
38+
Id = table.Column<int>(nullable: false),
3739
CampaignId = table.Column<int>(nullable: false),
3840
Description = table.Column<string>(nullable: false),
3941
RuleTypeId = table.Column<int>(nullable: false),
4042
LocationId = table.Column<int>(nullable: true)
4143
},
4244
constraints: table =>
4345
{
44-
table.PrimaryKey("PK_Rules", x => x.Id);
46+
table.PrimaryKey("PK_Rule", x => x.Id);
4547
table.ForeignKey(
46-
name: "FK_Rules_Campaign_CampaignId",
48+
name: "FK_Rule_Campaign_CampaignId",
4749
column: x => x.CampaignId,
4850
principalTable: "Campaign",
4951
principalColumn: "Id",
5052
onDelete: ReferentialAction.Cascade);
5153
});
5254

5355
migrationBuilder.CreateIndex(
54-
name: "IX_Rules_CampaignId",
55-
table: "Rules",
56+
name: "IX_Rule_CampaignId",
57+
table: "Rule",
5658
column: "CampaignId");
5759
}
5860

5961
protected override void Down(MigrationBuilder migrationBuilder)
6062
{
6163
migrationBuilder.DropTable(
62-
name: "Rules");
64+
name: "Rule");
6365

6466
migrationBuilder.DropTable(
6567
name: "Campaign");
6668

6769
migrationBuilder.DropSequence(
6870
name: "campaign_hilo");
71+
72+
migrationBuilder.DropSequence(
73+
name: "rule_hilo");
6974
}
7075
}
7176
}

src/Services/Marketing/Marketing.API/Migrations/MarketingContextModelSnapshot.cs renamed to src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/MarketingContextModelSnapshot.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Microsoft.EntityFrameworkCore.Migrations;
66
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure;
77

8-
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Migrations
8+
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations
99
{
1010
[DbContext(typeof(MarketingContext))]
1111
partial class MarketingContextModelSnapshot : ModelSnapshot
@@ -15,6 +15,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1515
modelBuilder
1616
.HasAnnotation("ProductVersion", "1.1.2")
1717
.HasAnnotation("SqlServer:Sequence:.campaign_hilo", "'campaign_hilo', '', '1', '10', '', '', 'Int64', 'False'")
18+
.HasAnnotation("SqlServer:Sequence:.rule_hilo", "'rule_hilo', '', '1', '10', '', '', 'Int64', 'False'")
1819
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
1920

2021
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Campaign", b =>
@@ -44,7 +45,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
4445
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule", b =>
4546
{
4647
b.Property<int>("Id")
47-
.ValueGeneratedOnAdd();
48+
.ValueGeneratedOnAdd()
49+
.HasAnnotation("SqlServer:HiLoSequenceName", "rule_hilo")
50+
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
4851

4952
b.Property<int>("CampaignId");
5053

@@ -58,7 +61,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
5861

5962
b.HasIndex("CampaignId");
6063

61-
b.ToTable("Rules");
64+
b.ToTable("Rule");
6265

6366
b.HasDiscriminator<int>("RuleTypeId");
6467
});
@@ -97,7 +100,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
97100

98101
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule", b =>
99102
{
100-
b.HasOne("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Campaign", "Campaign")
103+
b.HasOne("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Campaign")
101104
.WithMany("Rules")
102105
.HasForeignKey("CampaignId")
103106
.OnDelete(DeleteBehavior.Cascade);

0 commit comments

Comments
 (0)