fixes the db migration

This commit is contained in:
2018-08-05 06:04:10 +02:00
parent 0c69d5abbc
commit 2d7df973f9
11 changed files with 100 additions and 71 deletions

View File

@ -1,14 +1,15 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20180722232456_gitrepo")]
partial class gitrepo
[Migration("20180805122812_gitprojectref")]
partial class gitprojectref
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@ -680,6 +681,8 @@ namespace Yavsc.Migrations
b.Property<DateTime>("DateModified");
b.Property<string>("Description");
b.Property<DateTime?>("EventDate");
b.Property<long?>("LocationId");
@ -727,6 +730,8 @@ namespace Yavsc.Migrations
b.Property<DateTime>("DateModified");
b.Property<string>("Description");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
@ -1268,6 +1273,8 @@ namespace Yavsc.Migrations
b.Property<DateTime>("DateModified");
b.Property<string>("Description");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
@ -1356,6 +1363,8 @@ namespace Yavsc.Migrations
b.Property<string>("Description");
b.Property<long>("GitId");
b.Property<string>("Name")
.IsRequired();
@ -1400,7 +1409,8 @@ namespace Yavsc.Migrations
modelBuilder.Entity("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference", b =>
{
b.Property<string>("Path");
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Branch")
.HasAnnotation("MaxLength", 512);
@ -1408,10 +1418,13 @@ namespace Yavsc.Migrations
b.Property<string>("OwnerId")
.HasAnnotation("MaxLength", 1024);
b.Property<string>("Path")
.IsRequired();
b.Property<string>("Url")
.HasAnnotation("MaxLength", 2048);
b.HasKey("Path");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
@ -1882,7 +1895,7 @@ namespace Yavsc.Migrations
b.HasOne("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference")
.WithMany()
.HasForeignKey("Name");
.HasForeignKey("GitId");
b.HasOne("Yavsc.Models.Payment.PayPalPayment")
.WithMany()

View File

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class gitrepo : Migration
public partial class gitprojectref : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@ -54,20 +56,20 @@ namespace Yavsc.Migrations
migrationBuilder.DropForeignKey(name: "FK_Project_Activity_ActivityCode", table: "Project");
migrationBuilder.DropForeignKey(name: "FK_Project_ApplicationUser_ClientId", table: "Project");
migrationBuilder.DropForeignKey(name: "FK_Project_PerformerProfile_PerformerId", table: "Project");
migrationBuilder.DropForeignKey(name: "FK_ProjectBuildConfiguration_Project_ProjectId", table: "ProjectBuildConfiguration");
migrationBuilder.CreateTable(
name: "GitRepositoryReference",
columns: table => new
{
Path = table.Column<string>(nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Branch = table.Column<string>(nullable: true),
OwnerId = table.Column<string>(nullable: true),
Path = table.Column<string>(nullable: false),
Url = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GitRepositoryReference", x => x.Path);
table.PrimaryKey("PK_GitRepositoryReference", x => x.Id);
table.ForeignKey(
name: "FK_GitRepositoryReference_ApplicationUser_OwnerId",
column: x => x.OwnerId,
@ -75,6 +77,23 @@ namespace Yavsc.Migrations
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.AddColumn<long>(
name: "GitId",
table: "Project",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<string>(
name: "Description",
table: "RdvQuery",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Description",
table: "HairMultiCutQuery",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Description",
table: "HairCutQuery",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
@ -405,11 +424,11 @@ namespace Yavsc.Migrations
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Project_GitRepositoryReference_Name",
name: "FK_Project_GitRepositoryReference_GitId",
table: "Project",
column: "Name",
column: "GitId",
principalTable: "GitRepositoryReference",
principalColumn: "Path",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Project_PerformerProfile_PerformerId",
@ -418,13 +437,6 @@ namespace Yavsc.Migrations
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ProjectBuildConfiguration_Project_ProjectId",
table: "ProjectBuildConfiguration",
column: "ProjectId",
principalTable: "Project",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
@ -476,9 +488,13 @@ namespace Yavsc.Migrations
migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity");
migrationBuilder.DropForeignKey(name: "FK_Project_Activity_ActivityCode", table: "Project");
migrationBuilder.DropForeignKey(name: "FK_Project_ApplicationUser_ClientId", table: "Project");
migrationBuilder.DropForeignKey(name: "FK_Project_GitRepositoryReference_Name", table: "Project");
migrationBuilder.DropForeignKey(name: "FK_Project_GitRepositoryReference_GitId", table: "Project");
migrationBuilder.DropForeignKey(name: "FK_Project_PerformerProfile_PerformerId", table: "Project");
migrationBuilder.DropForeignKey(name: "FK_ProjectBuildConfiguration_Project_ProjectId", table: "ProjectBuildConfiguration");
migrationBuilder.DropColumn(name: "GitId", table: "Project");
migrationBuilder.DropColumn(name: "Description", table: "RdvQuery");
migrationBuilder.DropColumn(name: "Description", table: "HairMultiCutQuery");
migrationBuilder.DropColumn(name: "Description", table: "HairCutQuery");
migrationBuilder.DropTable("GitRepositoryReference");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",

View File

@ -678,6 +678,8 @@ namespace Yavsc.Migrations
b.Property<DateTime>("DateModified");
b.Property<string>("Description");
b.Property<DateTime?>("EventDate");
b.Property<long?>("LocationId");
@ -725,6 +727,8 @@ namespace Yavsc.Migrations
b.Property<DateTime>("DateModified");
b.Property<string>("Description");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
@ -1266,6 +1270,8 @@ namespace Yavsc.Migrations
b.Property<DateTime>("DateModified");
b.Property<string>("Description");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
@ -1354,6 +1360,8 @@ namespace Yavsc.Migrations
b.Property<string>("Description");
b.Property<long>("GitId");
b.Property<string>("Name")
.IsRequired();
@ -1398,7 +1406,8 @@ namespace Yavsc.Migrations
modelBuilder.Entity("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference", b =>
{
b.Property<string>("Path");
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Branch")
.HasAnnotation("MaxLength", 512);
@ -1406,10 +1415,13 @@ namespace Yavsc.Migrations
b.Property<string>("OwnerId")
.HasAnnotation("MaxLength", 1024);
b.Property<string>("Path")
.IsRequired();
b.Property<string>("Url")
.HasAnnotation("MaxLength", 2048);
b.HasKey("Path");
b.HasKey("Id");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
@ -1880,7 +1892,7 @@ namespace Yavsc.Migrations
b.HasOne("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference")
.WithMany()
.HasForeignKey("Name");
.HasForeignKey("GitId");
b.HasOne("Yavsc.Models.Payment.PayPalPayment")
.WithMany()