From 31b1a89ccbae7f2748b950f8517190737fdaf7db Mon Sep 17 00:00:00 2001 From: Filip Date: Tue, 3 Nov 2020 10:41:32 +0100 Subject: [PATCH] Recreated migratoin for sql server for content and seo --- ...gner.cs => 20201103090517_AddContentAndSEO.Designer.cs} | 7 +++---- ...ContentAndSEO.cs => 20201103090517_AddContentAndSEO.cs} | 3 +-- .../Migrations/DbModelSnapshot.cs | 5 ++--- data/Piranha.Data.EF/Db.cs | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) rename data/Piranha.Data.EF.SQLServer/Migrations/{20201016123837_AddContentAndSEO.Designer.cs => 20201103090517_AddContentAndSEO.Designer.cs} (99%) rename data/Piranha.Data.EF.SQLServer/Migrations/{20201016123837_AddContentAndSEO.cs => 20201103090517_AddContentAndSEO.cs} (99%) diff --git a/data/Piranha.Data.EF.SQLServer/Migrations/20201016123837_AddContentAndSEO.Designer.cs b/data/Piranha.Data.EF.SQLServer/Migrations/20201103090517_AddContentAndSEO.Designer.cs similarity index 99% rename from data/Piranha.Data.EF.SQLServer/Migrations/20201016123837_AddContentAndSEO.Designer.cs rename to data/Piranha.Data.EF.SQLServer/Migrations/20201103090517_AddContentAndSEO.Designer.cs index 773911c97..37350cb4a 100644 --- a/data/Piranha.Data.EF.SQLServer/Migrations/20201016123837_AddContentAndSEO.Designer.cs +++ b/data/Piranha.Data.EF.SQLServer/Migrations/20201103090517_AddContentAndSEO.Designer.cs @@ -10,7 +10,7 @@ namespace Piranha.Data.EF.SQLServer.Migrations { [DbContext(typeof(SQLServerDb))] - [Migration("20201016123837_AddContentAndSEO")] + [Migration("20201103090517_AddContentAndSEO")] partial class AddContentAndSEO { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -1141,7 +1141,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("IsDefault") .HasColumnType("bit"); - b.Property("LanguageId") + b.Property("LanguageId") .HasColumnType("uniqueidentifier"); b.Property("LastModified") @@ -1572,8 +1572,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasOne("Piranha.Data.Language", "Language") .WithMany() .HasForeignKey("LanguageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity("Piranha.Data.SiteField", b => diff --git a/data/Piranha.Data.EF.SQLServer/Migrations/20201016123837_AddContentAndSEO.cs b/data/Piranha.Data.EF.SQLServer/Migrations/20201103090517_AddContentAndSEO.cs similarity index 99% rename from data/Piranha.Data.EF.SQLServer/Migrations/20201016123837_AddContentAndSEO.cs rename to data/Piranha.Data.EF.SQLServer/Migrations/20201103090517_AddContentAndSEO.cs index 7d2a9879e..1f922475c 100644 --- a/data/Piranha.Data.EF.SQLServer/Migrations/20201016123837_AddContentAndSEO.cs +++ b/data/Piranha.Data.EF.SQLServer/Migrations/20201103090517_AddContentAndSEO.cs @@ -10,8 +10,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AddColumn( name: "LanguageId", table: "Piranha_Sites", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + nullable: true); migrationBuilder.AddColumn( name: "MetaFollow", diff --git a/data/Piranha.Data.EF.SQLServer/Migrations/DbModelSnapshot.cs b/data/Piranha.Data.EF.SQLServer/Migrations/DbModelSnapshot.cs index 5bb9fee2c..682a9e86f 100644 --- a/data/Piranha.Data.EF.SQLServer/Migrations/DbModelSnapshot.cs +++ b/data/Piranha.Data.EF.SQLServer/Migrations/DbModelSnapshot.cs @@ -1139,7 +1139,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsDefault") .HasColumnType("bit"); - b.Property("LanguageId") + b.Property("LanguageId") .HasColumnType("uniqueidentifier"); b.Property("LastModified") @@ -1570,8 +1570,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasOne("Piranha.Data.Language", "Language") .WithMany() .HasForeignKey("LanguageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); + .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity("Piranha.Data.SiteField", b => diff --git a/data/Piranha.Data.EF/Db.cs b/data/Piranha.Data.EF/Db.cs index 819f87b1f..32880fba7 100644 --- a/data/Piranha.Data.EF/Db.cs +++ b/data/Piranha.Data.EF/Db.cs @@ -405,7 +405,7 @@ protected override void OnModelCreating(ModelBuilder mb) mb.Entity().Property(s => s.Description).HasMaxLength(256); mb.Entity().Property(s => s.Hostnames).HasMaxLength(256); mb.Entity().Property(s => s.Culture).HasMaxLength(6); - mb.Entity().HasOne(s => s.Language).WithMany().IsRequired().OnDelete(DeleteBehavior.Restrict); + mb.Entity().HasOne(s => s.Language).WithMany().OnDelete(DeleteBehavior.Restrict); mb.Entity().HasIndex(s => s.InternalId).IsUnique();