From a0c6749bad1d9f95ec178f64a864af5a23e32076 Mon Sep 17 00:00:00 2001 From: code liturgy Date: Fri, 18 Nov 2022 00:38:56 +0000 Subject: [PATCH] ok --- CodeLiturgy.Views/DbContexts/SiteDbContext.cs | 8 + .../SiteDb/20221118003609_first.Designer.cs | 159 ++++++++++++++++++ .../Migrations/SiteDb/20221118003609_first.cs | 103 ++++++++++++ .../SiteDb/SiteDbContextModelSnapshot.cs | 156 +++++++++++++++++ 4 files changed, 426 insertions(+) create mode 100644 CodeLiturgy.Views/Migrations/SiteDb/20221118003609_first.Designer.cs create mode 100644 CodeLiturgy.Views/Migrations/SiteDb/20221118003609_first.cs create mode 100644 CodeLiturgy.Views/Migrations/SiteDb/SiteDbContextModelSnapshot.cs diff --git a/CodeLiturgy.Views/DbContexts/SiteDbContext.cs b/CodeLiturgy.Views/DbContexts/SiteDbContext.cs index 371d495..4ba1434 100644 --- a/CodeLiturgy.Views/DbContexts/SiteDbContext.cs +++ b/CodeLiturgy.Views/DbContexts/SiteDbContext.cs @@ -1,6 +1,7 @@ using CodeLiturgy.Data.Application; using Microsoft.EntityFrameworkCore; using BlueWest.EfMethods; +using CodeLiturgy.Domain.Model; namespace CodeLiturgy.Domain { @@ -23,6 +24,13 @@ namespace CodeLiturgy.Domain { Database.EnsureCreated(); } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + modelBuilder.ConfigureCurrentDbModel(); + + } } } diff --git a/CodeLiturgy.Views/Migrations/SiteDb/20221118003609_first.Designer.cs b/CodeLiturgy.Views/Migrations/SiteDb/20221118003609_first.Designer.cs new file mode 100644 index 0000000..fdbc85b --- /dev/null +++ b/CodeLiturgy.Views/Migrations/SiteDb/20221118003609_first.Designer.cs @@ -0,0 +1,159 @@ +// +using System; +using CodeLiturgy.Domain; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CodeLiturgy.Views.Migrations.SiteDb +{ + [DbContext(typeof(SiteDbContext))] + [Migration("20221118003609_first")] + partial class first + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CodeLiturgy.Data.Application.Site", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Domain") + .HasColumnType("text"); + + b.Property("EnvironmentId") + .HasColumnType("text"); + + b.Property("EnvironmentType") + .HasColumnType("integer"); + + b.Property("LastChanged") + .HasColumnType("timestamp with time zone"); + + b.Property("UrlAddress") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("EnvironmentId"); + + b.ToTable("Sites"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.SiteEnvironment", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Environments"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.Users.ApplicationUser", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasColumnType("text"); + + b.Property("NormalizedUserName") + .HasColumnType("text"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("ApplicationUser"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.Site", b => + { + b.HasOne("CodeLiturgy.Data.Application.SiteEnvironment", "Environment") + .WithMany("Sites") + .HasForeignKey("EnvironmentId"); + + b.Navigation("Environment"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.SiteEnvironment", b => + { + b.HasOne("CodeLiturgy.Data.Application.Users.ApplicationUser", "User") + .WithMany("Environments") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.SiteEnvironment", b => + { + b.Navigation("Sites"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.Users.ApplicationUser", b => + { + b.Navigation("Environments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CodeLiturgy.Views/Migrations/SiteDb/20221118003609_first.cs b/CodeLiturgy.Views/Migrations/SiteDb/20221118003609_first.cs new file mode 100644 index 0000000..da7bd86 --- /dev/null +++ b/CodeLiturgy.Views/Migrations/SiteDb/20221118003609_first.cs @@ -0,0 +1,103 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CodeLiturgy.Views.Migrations.SiteDb +{ + /// + public partial class first : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "ApplicationUser", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + UserName = table.Column(type: "text", nullable: true), + NormalizedUserName = table.Column(type: "text", nullable: true), + Email = table.Column(type: "text", nullable: true), + NormalizedEmail = table.Column(type: "text", nullable: true), + EmailConfirmed = table.Column(type: "boolean", nullable: false), + PasswordHash = table.Column(type: "text", nullable: true), + SecurityStamp = table.Column(type: "text", nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true), + PhoneNumber = table.Column(type: "text", nullable: true), + PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), + TwoFactorEnabled = table.Column(type: "boolean", nullable: false), + LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), + LockoutEnabled = table.Column(type: "boolean", nullable: false), + AccessFailedCount = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApplicationUser", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Environments", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: true), + UserId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Environments", x => x.Id); + table.ForeignKey( + name: "FK_Environments_ApplicationUser_UserId", + column: x => x.UserId, + principalTable: "ApplicationUser", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "Sites", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + EnvironmentId = table.Column(type: "text", nullable: true), + Domain = table.Column(type: "text", nullable: true), + UrlAddress = table.Column(type: "text", nullable: true), + EnvironmentType = table.Column(type: "integer", nullable: false), + CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), + LastChanged = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Sites", x => x.Id); + table.ForeignKey( + name: "FK_Sites_Environments_EnvironmentId", + column: x => x.EnvironmentId, + principalTable: "Environments", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Environments_UserId", + table: "Environments", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Sites_EnvironmentId", + table: "Sites", + column: "EnvironmentId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Sites"); + + migrationBuilder.DropTable( + name: "Environments"); + + migrationBuilder.DropTable( + name: "ApplicationUser"); + } + } +} diff --git a/CodeLiturgy.Views/Migrations/SiteDb/SiteDbContextModelSnapshot.cs b/CodeLiturgy.Views/Migrations/SiteDb/SiteDbContextModelSnapshot.cs new file mode 100644 index 0000000..2075f4c --- /dev/null +++ b/CodeLiturgy.Views/Migrations/SiteDb/SiteDbContextModelSnapshot.cs @@ -0,0 +1,156 @@ +// +using System; +using CodeLiturgy.Domain; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CodeLiturgy.Views.Migrations.SiteDb +{ + [DbContext(typeof(SiteDbContext))] + partial class SiteDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CodeLiturgy.Data.Application.Site", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Domain") + .HasColumnType("text"); + + b.Property("EnvironmentId") + .HasColumnType("text"); + + b.Property("EnvironmentType") + .HasColumnType("integer"); + + b.Property("LastChanged") + .HasColumnType("timestamp with time zone"); + + b.Property("UrlAddress") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("EnvironmentId"); + + b.ToTable("Sites"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.SiteEnvironment", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Environments"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.Users.ApplicationUser", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasColumnType("text"); + + b.Property("NormalizedUserName") + .HasColumnType("text"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("ApplicationUser"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.Site", b => + { + b.HasOne("CodeLiturgy.Data.Application.SiteEnvironment", "Environment") + .WithMany("Sites") + .HasForeignKey("EnvironmentId"); + + b.Navigation("Environment"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.SiteEnvironment", b => + { + b.HasOne("CodeLiturgy.Data.Application.Users.ApplicationUser", "User") + .WithMany("Environments") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.SiteEnvironment", b => + { + b.Navigation("Sites"); + }); + + modelBuilder.Entity("CodeLiturgy.Data.Application.Users.ApplicationUser", b => + { + b.Navigation("Environments"); + }); +#pragma warning restore 612, 618 + } + } +}