Upload project.

This commit is contained in:
StevenJW
2020-06-07 22:36:12 +01:00
parent 0df30b8f36
commit 5829fb5504
170 changed files with 31989 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ThAmCo.Events.Data;
namespace ThAmCo.Events.Data.Migrations
{
[DbContext(typeof(EventsDbContext))]
[Migration("20181029103724_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("thamco.events")
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ThAmCo.Events.Data.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<string>("FirstName")
.IsRequired();
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Customers");
b.HasData(
new { Id = 1, Email = "bob@example.com", FirstName = "Robert", Surname = "Robertson" },
new { Id = 2, Email = "betty@example.com", FirstName = "Betty", Surname = "Thornton" },
new { Id = 3, Email = "jin@example.com", FirstName = "Jin", Surname = "Jellybeans" }
);
});
modelBuilder.Entity("ThAmCo.Events.Data.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("Date");
b.Property<TimeSpan?>("Duration");
b.Property<string>("Title")
.IsRequired();
b.Property<string>("TypeId")
.IsRequired()
.IsFixedLength(true)
.HasMaxLength(3);
b.HasKey("Id");
b.ToTable("Events");
b.HasData(
new { Id = 1, Date = new DateTime(2016, 4, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), Duration = new TimeSpan(0, 6, 0, 0, 0), Title = "Bob's Big 50", TypeId = "PTY" },
new { Id = 2, Date = new DateTime(2018, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Duration = new TimeSpan(0, 12, 0, 0, 0), Title = "Best Wedding Yet", TypeId = "WED" }
);
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.Property<int>("CustomerId");
b.Property<int>("EventId");
b.Property<bool>("Attended");
b.HasKey("CustomerId", "EventId");
b.HasIndex("EventId");
b.ToTable("Guests");
b.HasData(
new { CustomerId = 1, EventId = 1, Attended = true },
new { CustomerId = 2, EventId = 1, Attended = false },
new { CustomerId = 1, EventId = 2, Attended = false },
new { CustomerId = 3, EventId = 2, Attended = false }
);
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.HasOne("ThAmCo.Events.Data.Customer", "Customer")
.WithMany("Bookings")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Bookings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,130 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ThAmCo.Events.Data.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "thamco.events");
migrationBuilder.CreateTable(
name: "Customers",
schema: "thamco.events",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Surname = table.Column<string>(nullable: false),
FirstName = table.Column<string>(nullable: false),
Email = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Customers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Events",
schema: "thamco.events",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Title = table.Column<string>(nullable: false),
Date = table.Column<DateTime>(nullable: false),
Duration = table.Column<TimeSpan>(nullable: true),
TypeId = table.Column<string>(fixedLength: true, maxLength: 3, nullable: false),
},
constraints: table =>
{
table.PrimaryKey("PK_Events", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Guests",
schema: "thamco.events",
columns: table => new
{
CustomerId = table.Column<int>(nullable: false),
EventId = table.Column<int>(nullable: false),
Attended = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Guests", x => new { x.CustomerId, x.EventId });
table.ForeignKey(
name: "FK_Guests_Customers_CustomerId",
column: x => x.CustomerId,
principalSchema: "thamco.events",
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Guests_Events_EventId",
column: x => x.EventId,
principalSchema: "thamco.events",
principalTable: "Events",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
schema: "thamco.events",
table: "Customers",
columns: new[] { "Id", "Email", "FirstName", "Surname" },
values: new object[,]
{
{ 1, "bob@example.com", "Robert", "Robertson" },
{ 2, "betty@example.com", "Betty", "Thornton" },
{ 3, "jin@example.com", "Jin", "Jellybeans" }
});
migrationBuilder.InsertData(
schema: "thamco.events",
table: "Events",
columns: new[] { "Id", "Date", "Duration", "Title", "TypeId" },
values: new object[,]
{
{ 1, new DateTime(2016, 4, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 6, 0, 0, 0), "Bob's Big 50", "PTY" },
{ 2, new DateTime(2018, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 12, 0, 0, 0), "Best Wedding Yet", "WED" }
});
migrationBuilder.InsertData(
schema: "thamco.events",
table: "Guests",
columns: new[] { "CustomerId", "EventId", "Attended" },
values: new object[,]
{
{ 1, 1, true },
{ 2, 1, false },
{ 1, 2, false },
{ 3, 2, false }
});
migrationBuilder.CreateIndex(
name: "IX_Guests_EventId",
schema: "thamco.events",
table: "Guests",
column: "EventId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Guests",
schema: "thamco.events");
migrationBuilder.DropTable(
name: "Customers",
schema: "thamco.events");
migrationBuilder.DropTable(
name: "Events",
schema: "thamco.events");
}
}
}

View File

@@ -0,0 +1,178 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ThAmCo.Events.Data;
namespace ThAmCo.Events.Data.Migrations
{
[DbContext(typeof(EventsDbContext))]
[Migration("20181127120440_AddStaffing")]
partial class AddStaffing
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("thamco.events")
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ThAmCo.Events.Data.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<string>("FirstName")
.IsRequired();
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Customers");
b.HasData(
new { Id = 1, Email = "bob@example.com", FirstName = "Robert", Surname = "Robertson" },
new { Id = 2, Email = "betty@example.com", FirstName = "Betty", Surname = "Thornton" },
new { Id = 3, Email = "jin@example.com", FirstName = "Jin", Surname = "Jellybeans" }
);
});
modelBuilder.Entity("ThAmCo.Events.Data.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("Date");
b.Property<TimeSpan?>("Duration");
b.Property<string>("Title")
.IsRequired();
b.Property<string>("TypeId")
.IsRequired()
.IsFixedLength(true)
.HasMaxLength(3);
b.Property<string>("VenueReference");
b.HasKey("Id");
b.ToTable("Events");
b.HasData(
new { Id = 1, Date = new DateTime(2016, 4, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), Duration = new TimeSpan(0, 6, 0, 0, 0), Title = "Bob's Big 50", TypeId = "PTY" },
new { Id = 2, Date = new DateTime(2018, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Duration = new TimeSpan(0, 12, 0, 0, 0), Title = "Best Wedding Yet", TypeId = "WED" }
);
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.Property<int>("CustomerId");
b.Property<int>("EventId");
b.Property<bool>("Attended");
b.HasKey("CustomerId", "EventId");
b.HasIndex("EventId");
b.ToTable("Guests");
b.HasData(
new { CustomerId = 1, EventId = 1, Attended = true },
new { CustomerId = 2, EventId = 1, Attended = false },
new { CustomerId = 1, EventId = 2, Attended = false },
new { CustomerId = 3, EventId = 2, Attended = false }
);
});
modelBuilder.Entity("ThAmCo.Events.Data.Staff", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<bool>("FirstAid");
b.Property<string>("FirstName")
.IsRequired();
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Staff");
b.HasData(
new { Id = 1, Email = "a@a.a", FirstAid = false, FirstName = "Alan", Surname = "Partridge" },
new { Id = 2, Email = "rege@hotmail.com", FirstAid = true, FirstName = "Roger", Surname = "Stephenson" },
new { Id = 3, Email = "alans@jims.net", FirstAid = false, FirstName = "Alans", Surname = "Smith" }
);
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.Property<int>("StaffId");
b.Property<int>("EventId");
b.HasKey("StaffId", "EventId");
b.HasIndex("EventId");
b.ToTable("Staffing");
b.HasData(
new { StaffId = 1, EventId = 2 },
new { StaffId = 2, EventId = 1 },
new { StaffId = 3, EventId = 1 }
);
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.HasOne("ThAmCo.Events.Data.Customer", "Customer")
.WithMany("Bookings")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Bookings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Staffings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Staff", "Staff")
.WithMany("Staffings")
.HasForeignKey("StaffId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,119 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ThAmCo.Events.Data.Migrations
{
public partial class AddStaffing : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "VenueReference",
schema: "thamco.events",
table: "Events",
nullable: true);
migrationBuilder.CreateTable(
name: "Staff",
schema: "thamco.events",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Surname = table.Column<string>(nullable: false),
FirstName = table.Column<string>(nullable: false),
Email = table.Column<string>(nullable: false),
FirstAid = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Staff", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Staffing",
schema: "thamco.events",
columns: table => new
{
StaffId = table.Column<int>(nullable: false),
EventId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Staffing", x => new { x.StaffId, x.EventId });
table.ForeignKey(
name: "FK_Staffing_Events_EventId",
column: x => x.EventId,
principalSchema: "thamco.events",
principalTable: "Events",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Staffing_Staff_StaffId",
column: x => x.StaffId,
principalSchema: "thamco.events",
principalTable: "Staff",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
schema: "thamco.events",
table: "Staff",
columns: new[] { "Id", "Email", "FirstAid", "FirstName", "Surname" },
values: new object[] { 1, "a@a.a", false, "Alan", "Partridge" });
migrationBuilder.InsertData(
schema: "thamco.events",
table: "Staff",
columns: new[] { "Id", "Email", "FirstAid", "FirstName", "Surname" },
values: new object[] { 2, "rege@hotmail.com", true, "Roger", "Stephenson" });
migrationBuilder.InsertData(
schema: "thamco.events",
table: "Staff",
columns: new[] { "Id", "Email", "FirstAid", "FirstName", "Surname" },
values: new object[] { 3, "alans@jims.net", false, "Alans", "Smith" });
migrationBuilder.InsertData(
schema: "thamco.events",
table: "Staffing",
columns: new[] { "StaffId", "EventId" },
values: new object[] { 1, 2 });
migrationBuilder.InsertData(
schema: "thamco.events",
table: "Staffing",
columns: new[] { "StaffId", "EventId" },
values: new object[] { 2, 1 });
migrationBuilder.InsertData(
schema: "thamco.events",
table: "Staffing",
columns: new[] { "StaffId", "EventId" },
values: new object[] { 3, 1 });
migrationBuilder.CreateIndex(
name: "IX_Staffing_EventId",
schema: "thamco.events",
table: "Staffing",
column: "EventId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Staffing",
schema: "thamco.events");
migrationBuilder.DropTable(
name: "Staff",
schema: "thamco.events");
migrationBuilder.DropColumn(
name: "VenueReference",
schema: "thamco.events",
table: "Events");
}
}
}

View File

@@ -0,0 +1,262 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ThAmCo.Events.Data;
namespace ThAmCo.Events.Data.Migrations
{
[DbContext(typeof(EventsDbContext))]
[Migration("20181204160544_AddFoodReference")]
partial class AddFoodReference
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("thamco.events")
.HasAnnotation("ProductVersion", "2.2.0-preview3-35497")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ThAmCo.Events.Data.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<string>("FirstName")
.IsRequired();
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Customers");
b.HasData(
new
{
Id = 1,
Email = "bob@example.com",
FirstName = "Robert",
Surname = "Robertson"
},
new
{
Id = 2,
Email = "betty@example.com",
FirstName = "Betty",
Surname = "Thornton"
},
new
{
Id = 3,
Email = "jin@example.com",
FirstName = "Jin",
Surname = "Jellybeans"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("Date");
b.Property<TimeSpan?>("Duration");
b.Property<int>("FoodReference");
b.Property<string>("Title")
.IsRequired();
b.Property<string>("TypeId")
.IsRequired()
.IsFixedLength(true)
.HasMaxLength(3);
b.Property<string>("VenueReference");
b.HasKey("Id");
b.ToTable("Events");
b.HasData(
new
{
Id = 1,
Date = new DateTime(2016, 4, 12, 0, 0, 0, 0, DateTimeKind.Unspecified),
Duration = new TimeSpan(0, 6, 0, 0, 0),
FoodReference = 0,
Title = "Bob's Big 50",
TypeId = "PTY"
},
new
{
Id = 2,
Date = new DateTime(2018, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Duration = new TimeSpan(0, 12, 0, 0, 0),
FoodReference = 0,
Title = "Best Wedding Yet",
TypeId = "WED"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.Property<int>("CustomerId");
b.Property<int>("EventId");
b.Property<bool>("Attended");
b.HasKey("CustomerId", "EventId");
b.HasIndex("EventId");
b.ToTable("Guests");
b.HasData(
new
{
CustomerId = 1,
EventId = 1,
Attended = true
},
new
{
CustomerId = 2,
EventId = 1,
Attended = false
},
new
{
CustomerId = 1,
EventId = 2,
Attended = false
},
new
{
CustomerId = 3,
EventId = 2,
Attended = false
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Staff", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<bool>("FirstAid");
b.Property<string>("FirstName")
.IsRequired();
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Staff");
b.HasData(
new
{
Id = 1,
Email = "a@a.a",
FirstAid = false,
FirstName = "Alan",
Surname = "Partridge"
},
new
{
Id = 2,
Email = "rege@hotmail.com",
FirstAid = true,
FirstName = "Roger",
Surname = "Stephenson"
},
new
{
Id = 3,
Email = "alans@jims.net",
FirstAid = false,
FirstName = "Alans",
Surname = "Smith"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.Property<int>("StaffId");
b.Property<int>("EventId");
b.HasKey("StaffId", "EventId");
b.HasIndex("EventId");
b.ToTable("Staffing");
b.HasData(
new
{
StaffId = 1,
EventId = 2
},
new
{
StaffId = 2,
EventId = 1
},
new
{
StaffId = 3,
EventId = 1
});
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.HasOne("ThAmCo.Events.Data.Customer", "Customer")
.WithMany("Bookings")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Bookings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Staffings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Staff", "Staff")
.WithMany("Staffings")
.HasForeignKey("StaffId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ThAmCo.Events.Data.Migrations
{
public partial class AddFoodReference : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "FoodReference",
schema: "thamco.events",
table: "Events",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FoodReference",
schema: "thamco.events",
table: "Events");
}
}
}

View File

@@ -0,0 +1,266 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ThAmCo.Events.Data;
namespace ThAmCo.Events.Data.Migrations
{
[DbContext(typeof(EventsDbContext))]
[Migration("20181205115027_AddSoftDeleteEvent")]
partial class AddSoftDeleteEvent
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("thamco.events")
.HasAnnotation("ProductVersion", "2.2.0-preview3-35497")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ThAmCo.Events.Data.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<string>("FirstName")
.IsRequired();
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Customers");
b.HasData(
new
{
Id = 1,
Email = "bob@example.com",
FirstName = "Robert",
Surname = "Robertson"
},
new
{
Id = 2,
Email = "betty@example.com",
FirstName = "Betty",
Surname = "Thornton"
},
new
{
Id = 3,
Email = "jin@example.com",
FirstName = "Jin",
Surname = "Jellybeans"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("Date");
b.Property<TimeSpan?>("Duration");
b.Property<int>("FoodReference");
b.Property<bool>("IsDeleted");
b.Property<string>("Title")
.IsRequired();
b.Property<string>("TypeId")
.IsRequired()
.IsFixedLength(true)
.HasMaxLength(3);
b.Property<string>("VenueReference");
b.HasKey("Id");
b.ToTable("Events");
b.HasData(
new
{
Id = 1,
Date = new DateTime(2016, 4, 12, 0, 0, 0, 0, DateTimeKind.Unspecified),
Duration = new TimeSpan(0, 6, 0, 0, 0),
FoodReference = 0,
IsDeleted = false,
Title = "Bob's Big 50",
TypeId = "PTY"
},
new
{
Id = 2,
Date = new DateTime(2018, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Duration = new TimeSpan(0, 12, 0, 0, 0),
FoodReference = 0,
IsDeleted = false,
Title = "Best Wedding Yet",
TypeId = "WED"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.Property<int>("CustomerId");
b.Property<int>("EventId");
b.Property<bool>("Attended");
b.HasKey("CustomerId", "EventId");
b.HasIndex("EventId");
b.ToTable("Guests");
b.HasData(
new
{
CustomerId = 1,
EventId = 1,
Attended = true
},
new
{
CustomerId = 2,
EventId = 1,
Attended = false
},
new
{
CustomerId = 1,
EventId = 2,
Attended = false
},
new
{
CustomerId = 3,
EventId = 2,
Attended = false
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Staff", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<bool>("FirstAid");
b.Property<string>("FirstName")
.IsRequired();
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Staff");
b.HasData(
new
{
Id = 1,
Email = "a@a.a",
FirstAid = false,
FirstName = "Alan",
Surname = "Partridge"
},
new
{
Id = 2,
Email = "rege@hotmail.com",
FirstAid = true,
FirstName = "Roger",
Surname = "Stephenson"
},
new
{
Id = 3,
Email = "alans@jims.net",
FirstAid = false,
FirstName = "Alans",
Surname = "Smith"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.Property<int>("StaffId");
b.Property<int>("EventId");
b.HasKey("StaffId", "EventId");
b.HasIndex("EventId");
b.ToTable("Staffing");
b.HasData(
new
{
StaffId = 1,
EventId = 2
},
new
{
StaffId = 2,
EventId = 1
},
new
{
StaffId = 3,
EventId = 1
});
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.HasOne("ThAmCo.Events.Data.Customer", "Customer")
.WithMany("Bookings")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Bookings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Staffings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Staff", "Staff")
.WithMany("Staffings")
.HasForeignKey("StaffId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ThAmCo.Events.Data.Migrations
{
public partial class AddSoftDeleteEvent : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
schema: "thamco.events",
table: "Events",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsDeleted",
schema: "thamco.events",
table: "Events");
}
}
}

View File

@@ -0,0 +1,271 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ThAmCo.Events.Data;
namespace ThAmCo.Events.Data.Migrations
{
[DbContext(typeof(EventsDbContext))]
[Migration("20181205125146_AddSoftDeleteCustomer")]
partial class AddSoftDeleteCustomer
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("thamco.events")
.HasAnnotation("ProductVersion", "2.2.0-preview3-35497")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ThAmCo.Events.Data.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<string>("FirstName")
.IsRequired();
b.Property<bool>("IsDeleted");
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Customers");
b.HasData(
new
{
Id = 1,
Email = "bob@example.com",
FirstName = "Robert",
IsDeleted = false,
Surname = "Robertson"
},
new
{
Id = 2,
Email = "betty@example.com",
FirstName = "Betty",
IsDeleted = false,
Surname = "Thornton"
},
new
{
Id = 3,
Email = "jin@example.com",
FirstName = "Jin",
IsDeleted = false,
Surname = "Jellybeans"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("Date");
b.Property<TimeSpan?>("Duration");
b.Property<int>("FoodReference");
b.Property<bool>("IsDeleted");
b.Property<string>("Title")
.IsRequired();
b.Property<string>("TypeId")
.IsRequired()
.IsFixedLength(true)
.HasMaxLength(3);
b.Property<string>("VenueReference");
b.HasKey("Id");
b.ToTable("Events");
b.HasData(
new
{
Id = 1,
Date = new DateTime(2016, 4, 12, 0, 0, 0, 0, DateTimeKind.Unspecified),
Duration = new TimeSpan(0, 6, 0, 0, 0),
FoodReference = 0,
IsDeleted = false,
Title = "Bob's Big 50",
TypeId = "PTY"
},
new
{
Id = 2,
Date = new DateTime(2018, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Duration = new TimeSpan(0, 12, 0, 0, 0),
FoodReference = 0,
IsDeleted = false,
Title = "Best Wedding Yet",
TypeId = "WED"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.Property<int>("CustomerId");
b.Property<int>("EventId");
b.Property<bool>("Attended");
b.HasKey("CustomerId", "EventId");
b.HasIndex("EventId");
b.ToTable("Guests");
b.HasData(
new
{
CustomerId = 1,
EventId = 1,
Attended = true
},
new
{
CustomerId = 2,
EventId = 1,
Attended = false
},
new
{
CustomerId = 1,
EventId = 2,
Attended = false
},
new
{
CustomerId = 3,
EventId = 2,
Attended = false
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Staff", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<bool>("FirstAid");
b.Property<string>("FirstName")
.IsRequired();
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Staff");
b.HasData(
new
{
Id = 1,
Email = "a@a.a",
FirstAid = false,
FirstName = "Alan",
Surname = "Partridge"
},
new
{
Id = 2,
Email = "rege@hotmail.com",
FirstAid = true,
FirstName = "Roger",
Surname = "Stephenson"
},
new
{
Id = 3,
Email = "alans@jims.net",
FirstAid = false,
FirstName = "Alans",
Surname = "Smith"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.Property<int>("StaffId");
b.Property<int>("EventId");
b.HasKey("StaffId", "EventId");
b.HasIndex("EventId");
b.ToTable("Staffing");
b.HasData(
new
{
StaffId = 1,
EventId = 2
},
new
{
StaffId = 2,
EventId = 1
},
new
{
StaffId = 3,
EventId = 1
});
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.HasOne("ThAmCo.Events.Data.Customer", "Customer")
.WithMany("Bookings")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Bookings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Staffings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Staff", "Staff")
.WithMany("Staffings")
.HasForeignKey("StaffId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ThAmCo.Events.Data.Migrations
{
public partial class AddSoftDeleteCustomer : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
schema: "thamco.events",
table: "Customers",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsDeleted",
schema: "thamco.events",
table: "Customers");
}
}
}

View File

@@ -0,0 +1,269 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ThAmCo.Events.Data;
namespace ThAmCo.Events.Data.Migrations
{
[DbContext(typeof(EventsDbContext))]
partial class EventsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("thamco.events")
.HasAnnotation("ProductVersion", "2.2.0-preview3-35497")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ThAmCo.Events.Data.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<string>("FirstName")
.IsRequired();
b.Property<bool>("IsDeleted");
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Customers");
b.HasData(
new
{
Id = 1,
Email = "bob@example.com",
FirstName = "Robert",
IsDeleted = false,
Surname = "Robertson"
},
new
{
Id = 2,
Email = "betty@example.com",
FirstName = "Betty",
IsDeleted = false,
Surname = "Thornton"
},
new
{
Id = 3,
Email = "jin@example.com",
FirstName = "Jin",
IsDeleted = false,
Surname = "Jellybeans"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Event", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("Date");
b.Property<TimeSpan?>("Duration");
b.Property<int>("FoodReference");
b.Property<bool>("IsDeleted");
b.Property<string>("Title")
.IsRequired();
b.Property<string>("TypeId")
.IsRequired()
.IsFixedLength(true)
.HasMaxLength(3);
b.Property<string>("VenueReference");
b.HasKey("Id");
b.ToTable("Events");
b.HasData(
new
{
Id = 1,
Date = new DateTime(2016, 4, 12, 0, 0, 0, 0, DateTimeKind.Unspecified),
Duration = new TimeSpan(0, 6, 0, 0, 0),
FoodReference = 0,
IsDeleted = false,
Title = "Bob's Big 50",
TypeId = "PTY"
},
new
{
Id = 2,
Date = new DateTime(2018, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Duration = new TimeSpan(0, 12, 0, 0, 0),
FoodReference = 0,
IsDeleted = false,
Title = "Best Wedding Yet",
TypeId = "WED"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.Property<int>("CustomerId");
b.Property<int>("EventId");
b.Property<bool>("Attended");
b.HasKey("CustomerId", "EventId");
b.HasIndex("EventId");
b.ToTable("Guests");
b.HasData(
new
{
CustomerId = 1,
EventId = 1,
Attended = true
},
new
{
CustomerId = 2,
EventId = 1,
Attended = false
},
new
{
CustomerId = 1,
EventId = 2,
Attended = false
},
new
{
CustomerId = 3,
EventId = 2,
Attended = false
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Staff", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired();
b.Property<bool>("FirstAid");
b.Property<string>("FirstName")
.IsRequired();
b.Property<string>("Surname")
.IsRequired();
b.HasKey("Id");
b.ToTable("Staff");
b.HasData(
new
{
Id = 1,
Email = "a@a.a",
FirstAid = false,
FirstName = "Alan",
Surname = "Partridge"
},
new
{
Id = 2,
Email = "rege@hotmail.com",
FirstAid = true,
FirstName = "Roger",
Surname = "Stephenson"
},
new
{
Id = 3,
Email = "alans@jims.net",
FirstAid = false,
FirstName = "Alans",
Surname = "Smith"
});
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.Property<int>("StaffId");
b.Property<int>("EventId");
b.HasKey("StaffId", "EventId");
b.HasIndex("EventId");
b.ToTable("Staffing");
b.HasData(
new
{
StaffId = 1,
EventId = 2
},
new
{
StaffId = 2,
EventId = 1
},
new
{
StaffId = 3,
EventId = 1
});
});
modelBuilder.Entity("ThAmCo.Events.Data.GuestBooking", b =>
{
b.HasOne("ThAmCo.Events.Data.Customer", "Customer")
.WithMany("Bookings")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Bookings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ThAmCo.Events.Data.Staffing", b =>
{
b.HasOne("ThAmCo.Events.Data.Event", "Event")
.WithMany("Staffings")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("ThAmCo.Events.Data.Staff", "Staff")
.WithMany("Staffings")
.HasForeignKey("StaffId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}