Azure Migrations

This commit is contained in:
uppuv
2023-09-27 17:18:48 -04:00
parent d0023114a3
commit 4eb8f84d5b
32 changed files with 460 additions and 296 deletions

View File

@ -9,11 +9,11 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DamageAssesment.Api.Survey.Migrations
namespace DamageAssesment.Api.Surveys.Migrations
{
[DbContext(typeof(SurveysDbContext))]
[Migration("20230817220614_InitialSurvey")]
partial class InitialSurvey
[Migration("20230927211618_AzureSurveys")]
partial class AzureSurveys
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -33,24 +33,47 @@ namespace DamageAssesment.Api.Survey.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("EndDate")
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<bool>("IsEnabled")
.HasColumnType("bit");
b.Property<DateTime?>("StartDate")
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
b.ToTable("Surveys");
});
modelBuilder.Entity("DamageAssesment.Api.Surveys.Db.SurveyTranslation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Language")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("SurveyId")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.ToTable("SurveysTranslation");
});
#pragma warning restore 612, 618
}
}

View File

@ -3,10 +3,10 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DamageAssesment.Api.Survey.Migrations
namespace DamageAssesment.Api.Surveys.Migrations
{
/// <inheritdoc />
public partial class InitialSurvey : Migration
public partial class AzureSurveys : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -17,15 +17,30 @@ namespace DamageAssesment.Api.Survey.Migrations
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
IsEnabled = table.Column<bool>(type: "bit", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: true),
EndDate = table.Column<DateTime>(type: "datetime2", nullable: true)
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Surveys", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SurveysTranslation",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
SurveyId = table.Column<int>(type: "int", nullable: false),
Title = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Language = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SurveysTranslation", x => x.Id);
});
}
/// <inheritdoc />
@ -33,6 +48,9 @@ namespace DamageAssesment.Api.Survey.Migrations
{
migrationBuilder.DropTable(
name: "Surveys");
migrationBuilder.DropTable(
name: "SurveysTranslation");
}
}
}

View File

@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DamageAssesment.Api.Survey.Migrations
namespace DamageAssesment.Api.Surveys.Migrations
{
[DbContext(typeof(SurveysDbContext))]
partial class SurveysDbContextModelSnapshot : ModelSnapshot
@ -30,24 +30,47 @@ namespace DamageAssesment.Api.Survey.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("EndDate")
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<bool>("IsEnabled")
.HasColumnType("bit");
b.Property<DateTime?>("StartDate")
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
b.ToTable("Surveys");
});
modelBuilder.Entity("DamageAssesment.Api.Surveys.Db.SurveyTranslation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Language")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("SurveyId")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.ToTable("SurveysTranslation");
});
#pragma warning restore 612, 618
}
}