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

@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DamageAssesment.Api.Questions.Migrations
{
[DbContext(typeof(QuestionDbContext))]
[Migration("20230817215744_InitialQuestion")]
partial class InitialQuestion
[Migration("20230927211340_AzureQuestions")]
partial class AzureQuestions
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -25,6 +25,30 @@ namespace DamageAssesment.Api.Questions.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("DamageAssesment.Api.Questions.Db.CategoryTranslation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("int");
b.Property<string>("Language")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("CategoryTranslations");
});
modelBuilder.Entity("DamageAssesment.Api.Questions.Db.Question", b =>
{
b.Property<int>("Id")
@ -45,10 +69,6 @@ namespace DamageAssesment.Api.Questions.Migrations
b.Property<bool>("Key")
.HasColumnType("bit");
b.Property<string>("QuestionGroup")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("QuestionNumber")
.HasColumnType("int");
@ -73,11 +93,11 @@ namespace DamageAssesment.Api.Questions.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("CategoryImage")
b.Property<string>("IconLibrary")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("CategoryName")
b.Property<string>("IconName")
.IsRequired()
.HasColumnType("nvarchar(max)");

View File

@ -5,19 +5,34 @@
namespace DamageAssesment.Api.Questions.Migrations
{
/// <inheritdoc />
public partial class InitialQuestion : Migration
public partial class AzureQuestions : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CategoryTranslations",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CategoryId = table.Column<int>(type: "int", nullable: false),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Language = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CategoryTranslations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "QuestionCategories",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CategoryName = table.Column<string>(type: "nvarchar(max)", nullable: false),
CategoryImage = table.Column<string>(type: "nvarchar(max)", nullable: false)
IconName = table.Column<string>(type: "nvarchar(max)", nullable: false),
IconLibrary = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
@ -64,7 +79,6 @@ namespace DamageAssesment.Api.Questions.Migrations
Comment = table.Column<bool>(type: "bit", nullable: false),
Key = table.Column<bool>(type: "bit", nullable: false),
SurveyId = table.Column<int>(type: "int", nullable: true),
QuestionGroup = table.Column<string>(type: "nvarchar(max)", nullable: false),
CategoryId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
@ -87,6 +101,9 @@ namespace DamageAssesment.Api.Questions.Migrations
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CategoryTranslations");
migrationBuilder.DropTable(
name: "QuestionCategories");

View File

@ -22,6 +22,30 @@ namespace DamageAssesment.Api.Questions.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("DamageAssesment.Api.Questions.Db.CategoryTranslation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("int");
b.Property<string>("Language")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("CategoryTranslations");
});
modelBuilder.Entity("DamageAssesment.Api.Questions.Db.Question", b =>
{
b.Property<int>("Id")
@ -42,10 +66,6 @@ namespace DamageAssesment.Api.Questions.Migrations
b.Property<bool>("Key")
.HasColumnType("bit");
b.Property<string>("QuestionGroup")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("QuestionNumber")
.HasColumnType("int");
@ -70,11 +90,11 @@ namespace DamageAssesment.Api.Questions.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("CategoryImage")
b.Property<string>("IconLibrary")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("CategoryName")
b.Property<string>("IconName")
.IsRequired()
.HasColumnType("nvarchar(max)");

View File

@ -19,7 +19,7 @@ namespace DamageAssesment.Api.Questions.Providers
this.questionDbContext = questionDbContext;
this.logger = logger;
this.mapper = mapper;
SeedData();
//SeedData();
}
public void SeedData()

View File

@ -9,7 +9,11 @@
}
},
"AllowedHosts": "*",
//"ConnectionStrings": {
// "QuestionConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
//},
"ConnectionStrings": {
"QuestionConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
"QuestionConnection": "Server=tcp:da-dev.database.windows.net,1433;Initial Catalog=da-dev-db;Encrypt=True;User ID=admin-dev;Password=b3tgRABw8LGE75k;TrustServerCertificate=False;Connection Timeout=30;"
}
}