diff --git a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203155915_ChangedModels.Designer.cs b/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203155915_ChangedModels.Designer.cs
deleted file mode 100644
index 97932d92e3..0000000000
--- a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203155915_ChangedModels.Designer.cs
+++ /dev/null
@@ -1,349 +0,0 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using OutOfSchool.Services;
-
-namespace OutOfSchool.IdentityServer.Migrations
-{
- [DbContext(typeof(OutOfSchoolDbContext))]
- [Migration("20210203155915_ChangedModels")]
- partial class ChangedModels
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .UseIdentityColumns()
- .HasAnnotation("Relational:MaxIdentifierLength", 128)
- .HasAnnotation("ProductVersion", "5.0.2");
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
- {
- b.Property("Id")
- .HasColumnType("nvarchar(450)");
-
- b.Property("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Name")
- .HasMaxLength(256)
- .HasColumnType("nvarchar(256)");
-
- b.Property("NormalizedName")
- .HasMaxLength(256)
- .HasColumnType("nvarchar(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedName")
- .IsUnique()
- .HasDatabaseName("RoleNameIndex")
- .HasFilter("[NormalizedName] IS NOT NULL");
-
- b.ToTable("AspNetRoles");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int")
- .UseIdentityColumn();
-
- b.Property("ClaimType")
- .HasColumnType("nvarchar(max)");
-
- b.Property("ClaimValue")
- .HasColumnType("nvarchar(max)");
-
- b.Property("RoleId")
- .IsRequired()
- .HasColumnType("nvarchar(450)");
-
- b.HasKey("Id");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetRoleClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int")
- .UseIdentityColumn();
-
- b.Property("ClaimType")
- .HasColumnType("nvarchar(max)");
-
- b.Property("ClaimValue")
- .HasColumnType("nvarchar(max)");
-
- b.Property("UserId")
- .IsRequired()
- .HasColumnType("nvarchar(450)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserClaims");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
- {
- b.Property("LoginProvider")
- .HasColumnType("nvarchar(450)");
-
- b.Property("ProviderKey")
- .HasColumnType("nvarchar(450)");
-
- b.Property("ProviderDisplayName")
- .HasColumnType("nvarchar(max)");
-
- b.Property("UserId")
- .IsRequired()
- .HasColumnType("nvarchar(450)");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.HasIndex("UserId");
-
- b.ToTable("AspNetUserLogins");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
- {
- b.Property("UserId")
- .HasColumnType("nvarchar(450)");
-
- b.Property("RoleId")
- .HasColumnType("nvarchar(450)");
-
- b.HasKey("UserId", "RoleId");
-
- b.HasIndex("RoleId");
-
- b.ToTable("AspNetUserRoles");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
- {
- b.Property("UserId")
- .HasColumnType("nvarchar(450)");
-
- b.Property("LoginProvider")
- .HasColumnType("nvarchar(450)");
-
- b.Property("Name")
- .HasColumnType("nvarchar(450)");
-
- b.Property("Value")
- .HasColumnType("nvarchar(max)");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("AspNetUserTokens");
- });
-
- modelBuilder.Entity("OutOfSchool.Services.Models.User", b =>
- {
- b.Property("Id")
- .HasColumnType("nvarchar(450)");
-
- b.Property("AccessFailedCount")
- .HasColumnType("int");
-
- b.Property("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("nvarchar(max)");
-
- b.Property("CreatingTime")
- .HasColumnType("datetime2");
-
- b.Property("Discriminator")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Email")
- .HasMaxLength(256)
- .HasColumnType("nvarchar(256)");
-
- b.Property("EmailConfirmed")
- .HasColumnType("bit");
-
- b.Property("LastLogin")
- .HasColumnType("datetime2");
-
- b.Property("LockoutEnabled")
- .HasColumnType("bit");
-
- b.Property("LockoutEnd")
- .HasColumnType("datetimeoffset");
-
- b.Property("NormalizedEmail")
- .HasMaxLength(256)
- .HasColumnType("nvarchar(256)");
-
- b.Property("NormalizedUserName")
- .HasMaxLength(256)
- .HasColumnType("nvarchar(256)");
-
- b.Property("PasswordHash")
- .HasColumnType("nvarchar(max)");
-
- b.Property("PhoneNumber")
- .HasColumnType("nvarchar(max)");
-
- b.Property("PhoneNumberConfirmed")
- .HasColumnType("bit");
-
- b.Property("SecurityStamp")
- .HasColumnType("nvarchar(max)");
-
- b.Property("TwoFactorEnabled")
- .HasColumnType("bit");
-
- b.Property("UserName")
- .HasMaxLength(256)
- .HasColumnType("nvarchar(256)");
-
- b.HasKey("Id");
-
- b.HasIndex("NormalizedEmail")
- .HasDatabaseName("EmailIndex");
-
- b.HasIndex("NormalizedUserName")
- .IsUnique()
- .HasDatabaseName("UserNameIndex")
- .HasFilter("[NormalizedUserName] IS NOT NULL");
-
- b.ToTable("AspNetUsers");
-
- b.HasDiscriminator("Discriminator").HasValue("User");
- });
-
- modelBuilder.Entity("OutOfSchool.Services.Models.Organization", b =>
- {
- b.HasBaseType("OutOfSchool.Services.Models.User");
-
- b.Property("Description")
- .IsRequired()
- .HasMaxLength(750)
- .HasColumnType("nvarchar(750)");
-
- b.Property("EDRPOU")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Facebook")
- .HasColumnType("nvarchar(max)");
-
- b.Property("INPP")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Image")
- .HasColumnType("varbinary(max)");
-
- b.Property("Instagram")
- .HasColumnType("nvarchar(max)");
-
- b.Property("MFO")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("OrganizationId")
- .HasColumnType("bigint");
-
- b.Property("Title")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Type")
- .HasColumnType("int");
-
- b.Property("Website")
- .HasColumnType("nvarchar(max)");
-
- b.HasDiscriminator().HasValue("Organization");
- });
-
- modelBuilder.Entity("OutOfSchool.Services.Models.Parent", b =>
- {
- b.HasBaseType("OutOfSchool.Services.Models.User");
-
- b.Property("FirstName")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("LastName")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("ParentId")
- .HasColumnType("bigint");
-
- b.HasDiscriminator().HasValue("Parent");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
- {
- b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
- {
- b.HasOne("OutOfSchool.Services.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
- {
- b.HasOne("OutOfSchool.Services.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
- {
- b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
- .WithMany()
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("OutOfSchool.Services.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
- {
- b.HasOne("OutOfSchool.Services.Models.User", null)
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203164045_ChangedModelsWithoutInheritingFromUser.cs b/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203164045_ChangedModelsWithoutInheritingFromUser.cs
deleted file mode 100644
index 15bd72a6fa..0000000000
--- a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203164045_ChangedModelsWithoutInheritingFromUser.cs
+++ /dev/null
@@ -1,208 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace OutOfSchool.IdentityServer.Migrations
-{
- public partial class ChangedModelsWithoutInheritingFromUser : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "Description",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "Discriminator",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "EDRPOU",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "Facebook",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "FirstName",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "INPP",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "Image",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "Instagram",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "LastName",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "MFO",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "OrganizationId",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "ParentId",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "Title",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "Type",
- table: "AspNetUsers");
-
- migrationBuilder.DropColumn(
- name: "Website",
- table: "AspNetUsers");
-
- migrationBuilder.CreateTable(
- name: "Organizations",
- columns: table => new
- {
- OrganizationId = table.Column(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Title = table.Column(type: "nvarchar(max)", nullable: false),
- Website = table.Column(type: "nvarchar(max)", nullable: true),
- Facebook = table.Column(type: "nvarchar(max)", nullable: true),
- Instagram = table.Column(type: "nvarchar(max)", nullable: true),
- Description = table.Column(type: "nvarchar(750)", maxLength: 750, nullable: false),
- MFO = table.Column(type: "nvarchar(max)", nullable: false),
- EDRPOU = table.Column(type: "nvarchar(max)", nullable: false),
- INPP = table.Column(type: "nvarchar(max)", nullable: false),
- Image = table.Column(type: "varbinary(max)", nullable: true),
- Type = table.Column(type: "int", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Organizations", x => x.OrganizationId);
- });
-
- migrationBuilder.CreateTable(
- name: "Parents",
- columns: table => new
- {
- ParentId = table.Column(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- FirstName = table.Column(type: "nvarchar(max)", nullable: false),
- LastName = table.Column(type: "nvarchar(max)", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Parents", x => x.ParentId);
- });
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Organizations");
-
- migrationBuilder.DropTable(
- name: "Parents");
-
- migrationBuilder.AddColumn(
- name: "Description",
- table: "AspNetUsers",
- type: "nvarchar(750)",
- maxLength: 750,
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "Discriminator",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: false,
- defaultValue: "");
-
- migrationBuilder.AddColumn(
- name: "EDRPOU",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "Facebook",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "FirstName",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "INPP",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "Image",
- table: "AspNetUsers",
- type: "varbinary(max)",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "Instagram",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "LastName",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "MFO",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "OrganizationId",
- table: "AspNetUsers",
- type: "bigint",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "ParentId",
- table: "AspNetUsers",
- type: "bigint",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "Title",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "Type",
- table: "AspNetUsers",
- type: "int",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "Website",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
- }
- }
-}
diff --git a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203164045_ChangedModelsWithoutInheritingFromUser.Designer.cs b/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210204163858_init.Designer.cs
similarity index 98%
rename from OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203164045_ChangedModelsWithoutInheritingFromUser.Designer.cs
rename to OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210204163858_init.Designer.cs
index 4196005ef5..516ea3b6b6 100644
--- a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203164045_ChangedModelsWithoutInheritingFromUser.Designer.cs
+++ b/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210204163858_init.Designer.cs
@@ -7,11 +7,11 @@
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using OutOfSchool.Services;
-namespace OutOfSchool.IdentityServer.Migrations
+namespace OutOfSchool.IdentityServer.Data.Migrations.OutOfSchoolMigrations
{
[DbContext(typeof(OutOfSchoolDbContext))]
- [Migration("20210203164045_ChangedModelsWithoutInheritingFromUser")]
- partial class ChangedModelsWithoutInheritingFromUser
+ [Migration("20210204163858_init")]
+ partial class init
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
diff --git a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203155915_ChangedModels.cs b/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210204163858_init.cs
similarity index 89%
rename from OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203155915_ChangedModels.cs
rename to OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210204163858_init.cs
index 9a108b09f7..7025165b79 100644
--- a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210203155915_ChangedModels.cs
+++ b/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/20210204163858_init.cs
@@ -1,9 +1,9 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
-namespace OutOfSchool.IdentityServer.Migrations
+namespace OutOfSchool.IdentityServer.Data.Migrations.OutOfSchoolMigrations
{
- public partial class ChangedModels : Migration
+ public partial class init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@@ -28,21 +28,6 @@ protected override void Up(MigrationBuilder migrationBuilder)
Id = table.Column(type: "nvarchar(450)", nullable: false),
CreatingTime = table.Column(type: "datetime2", nullable: false),
LastLogin = table.Column(type: "datetime2", nullable: true),
- Discriminator = table.Column(type: "nvarchar(max)", nullable: false),
- OrganizationId = table.Column(type: "bigint", nullable: true),
- Title = table.Column(type: "nvarchar(max)", nullable: true),
- Website = table.Column(type: "nvarchar(max)", nullable: true),
- Facebook = table.Column(type: "nvarchar(max)", nullable: true),
- Instagram = table.Column(type: "nvarchar(max)", nullable: true),
- Description = table.Column(type: "nvarchar(750)", maxLength: 750, nullable: true),
- MFO = table.Column(type: "nvarchar(max)", nullable: true),
- EDRPOU = table.Column(type: "nvarchar(max)", nullable: true),
- INPP = table.Column(type: "nvarchar(max)", nullable: true),
- Image = table.Column(type: "varbinary(max)", nullable: true),
- Type = table.Column(type: "int", nullable: true),
- ParentId = table.Column(type: "bigint", nullable: true),
- FirstName = table.Column(type: "nvarchar(max)", nullable: true),
- LastName = table.Column(type: "nvarchar(max)", nullable: true),
UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
@@ -63,6 +48,42 @@ protected override void Up(MigrationBuilder migrationBuilder)
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
+ migrationBuilder.CreateTable(
+ name: "Organizations",
+ columns: table => new
+ {
+ OrganizationId = table.Column(type: "bigint", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Title = table.Column(type: "nvarchar(max)", nullable: false),
+ Website = table.Column(type: "nvarchar(max)", nullable: true),
+ Facebook = table.Column(type: "nvarchar(max)", nullable: true),
+ Instagram = table.Column(type: "nvarchar(max)", nullable: true),
+ Description = table.Column(type: "nvarchar(750)", maxLength: 750, nullable: false),
+ MFO = table.Column(type: "nvarchar(max)", nullable: false),
+ EDRPOU = table.Column(type: "nvarchar(max)", nullable: false),
+ INPP = table.Column(type: "nvarchar(max)", nullable: false),
+ Image = table.Column(type: "varbinary(max)", nullable: true),
+ Type = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Organizations", x => x.OrganizationId);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Parents",
+ columns: table => new
+ {
+ ParentId = table.Column(type: "bigint", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ FirstName = table.Column(type: "nvarchar(max)", nullable: false),
+ LastName = table.Column(type: "nvarchar(max)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Parents", x => x.ParentId);
+ });
+
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
@@ -226,6 +247,12 @@ protected override void Down(MigrationBuilder migrationBuilder)
migrationBuilder.DropTable(
name: "AspNetUserTokens");
+ migrationBuilder.DropTable(
+ name: "Organizations");
+
+ migrationBuilder.DropTable(
+ name: "Parents");
+
migrationBuilder.DropTable(
name: "AspNetRoles");
diff --git a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs b/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs
index c896e9fab5..dc3d8376af 100644
--- a/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs
+++ b/OutOfSchool/IdentityServer/Data/Migrations/OutOfSchoolMigrations/OutOfSchoolDbContextModelSnapshot.cs
@@ -6,7 +6,7 @@
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using OutOfSchool.Services;
-namespace OutOfSchool.IdentityServer.Migrations
+namespace OutOfSchool.IdentityServer.Data.Migrations.OutOfSchoolMigrations
{
[DbContext(typeof(OutOfSchoolDbContext))]
partial class OutOfSchoolDbContextModelSnapshot : ModelSnapshot
diff --git a/OutOfSchool/IdentityServer/OutOfSchool.IdentityServer.csproj b/OutOfSchool/IdentityServer/OutOfSchool.IdentityServer.csproj
index 755f979d03..14b9d32dc1 100644
--- a/OutOfSchool/IdentityServer/OutOfSchool.IdentityServer.csproj
+++ b/OutOfSchool/IdentityServer/OutOfSchool.IdentityServer.csproj
@@ -27,6 +27,10 @@
+
+
+
+
diff --git a/OutOfSchool/IdentityServer/Program.cs b/OutOfSchool/IdentityServer/Program.cs
index 8d701a039c..fdf7744178 100644
--- a/OutOfSchool/IdentityServer/Program.cs
+++ b/OutOfSchool/IdentityServer/Program.cs
@@ -8,7 +8,9 @@
using Microsoft.Extensions.Hosting;
using System.Linq;
using System.Security.Claims;
+using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
using OutOfSchool.IdentityServer;
using OutOfSchool.IdentityServer.Data;
using OutOfSchool.Services;
@@ -23,18 +25,22 @@ public static void Main(string[] args)
using (var scope = host.Services.CreateScope())
{
+ var context = scope.ServiceProvider.GetRequiredService();
+ // TODO: Move from Console to logger
+ while (!context.Database.CanConnect())
+ {
+ Task.Delay(500).Wait();
+ Console.WriteLine("Waiting for db connection");
+ }
scope.ServiceProvider.GetRequiredService()
.Database.Migrate();
-
- var context = scope.ServiceProvider.GetRequiredService();
var identityContext = scope.ServiceProvider.GetRequiredService();
var configService = scope.ServiceProvider.GetRequiredService();
var apiSecret = configService["outofschoolapi:ApiSecret"];
var clientSecret = configService["m2m.client:ClientSecret"];
- identityContext.Database.Migrate();
context.Database.Migrate();
-
+ identityContext.Database.Migrate();
if (!context.Clients.Any())
{
foreach (var client in Config.Clients(clientSecret))
diff --git a/OutOfSchool/OutOfSchool.DataAccess/OutOfSchoolDbContext.cs b/OutOfSchool/OutOfSchool.DataAccess/OutOfSchoolDbContext.cs
index 538394414d..f44436b7eb 100644
--- a/OutOfSchool/OutOfSchool.DataAccess/OutOfSchoolDbContext.cs
+++ b/OutOfSchool/OutOfSchool.DataAccess/OutOfSchoolDbContext.cs
@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
+using System;
+using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using OutOfSchool.Services.Models;
@@ -8,17 +9,10 @@ public class OutOfSchoolDbContext : IdentityDbContext
{
public OutOfSchoolDbContext(DbContextOptions options) : base(options)
{
-
- }
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.UseSqlServer("Server=localhost,1433; Database=Master;User Id=SA;Password=Oos-password1",b =>
- {
- b.MigrationsAssembly("OutOfSchool.IdentityServer");
- });
}
+
public DbSet Parents { get; set; }
public DbSet Organizations { get; set; }
}