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

@ -1,5 +1,6 @@
// <auto-generated />
using DamageAssesment.Api.SurveyResponses.Db;
using System;
using DamageAssesment.Api.Answers.Db;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
@ -8,11 +9,11 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DamageAssesment.Api.SurveyResponses.Migrations
namespace DamageAssesment.Api.Answers.Migrations
{
[DbContext(typeof(SurveyResponseDbContext))]
[Migration("20230817221348_InitialSurveyResponse")]
partial class InitialSurveyResponse
[DbContext(typeof(AnswerDbContext))]
[Migration("20230927172606_InitialAnswer")]
partial class InitialAnswer
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -24,7 +25,7 @@ namespace DamageAssesment.Api.SurveyResponses.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("DamageAssesment.Api.SurveyResponses.Db.SurveyResponse", b =>
modelBuilder.Entity("DamageAssesment.Api.Answers.Db.Answer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -32,22 +33,24 @@ namespace DamageAssesment.Api.SurveyResponses.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("EmployeeId")
b.Property<string>("AnswerText")
.IsRequired()
.HasMaxLength(6)
.HasColumnType("nvarchar(6)");
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("LocationId")
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(4)
.HasColumnType("nvarchar(4)");
.HasColumnType("nvarchar(max)");
b.Property<int>("SurveyId")
b.Property<int>("QuestionId")
.HasColumnType("int");
b.Property<int?>("SurveyResponseId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("SurveyResponses");
b.ToTable("Answers");
});
#pragma warning restore 612, 618
}

View File

@ -2,10 +2,10 @@
#nullable disable
namespace DamageAssesment.Api.Employees.Migrations
namespace DamageAssesment.Api.Answers.Migrations
{
/// <inheritdoc />
public partial class updatedemployee_id : Migration
public partial class InitialAnswer : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)

View File

@ -0,0 +1,58 @@
// <auto-generated />
using System;
using DamageAssesment.Api.Answers.Db;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DamageAssesment.Api.Answers.Migrations
{
[DbContext(typeof(AnswerDbContext))]
[Migration("20230927173358_InitialAnswercreate")]
partial class InitialAnswercreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("DamageAssesment.Api.Answers.Db.Answer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AnswerText")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Comment")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("QuestionId")
.HasColumnType("int");
b.Property<int?>("SurveyResponseId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Answers");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DamageAssesment.Api.Answers.Migrations
{
/// <inheritdoc />
public partial class InitialAnswercreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -18,7 +18,7 @@ namespace DamageAssesment.Api.Answers.Providers
this.answerDbContext = answerDbContext;
this.logger = logger;
this.mapper = mapper;
//SeedData();
SeedData();
}
public async Task<(bool IsSuccess, IEnumerable<Models.Answer> Answers, string ErrorMessage)> GetAnswersAsync()

View File

@ -9,7 +9,11 @@
}
},
"AllowedHosts": "*",
//"ConnectionStrings": {
// "AnswerConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
//},
"ConnectionStrings": {
"AnswerConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
"AnswerConnection": "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;"
}
}

View File

@ -13,7 +13,11 @@
"folderpath": "DMS_Attachments/Active",
"Deletepath": "DMS_Attachments/Deleted"
},
//"ConnectionStrings": {
// "AttachmentConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
//}
"ConnectionStrings": {
"AttachmentConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
"AttachmentConnection": "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;"
}
}

View File

@ -27,7 +27,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
this.logger = logger;
this.mapper = mapper;
this.uploadservice = uploadservice;
SeedData();
//SeedData();
}

View File

@ -6,8 +6,12 @@
}
},
"AllowedHosts": "*",
//"ConnectionStrings": {
// "DoculinConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
//},
"ConnectionStrings": {
"DoculinConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
"DoculinConnection": "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;"
},
"Fileupload": {
"folderpath": "DASA_Documents/Active",

View File

@ -1,64 +0,0 @@
// <auto-generated />
using System;
using DamageAssesment.Api.Employees.Db;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DamageAssesment.Api.Employees.Migrations
{
[DbContext(typeof(EmployeeDbContext))]
[Migration("20230817213656_InitialEmployee")]
partial class InitialEmployee
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("DamageAssesment.Api.Employees.Db.Employee", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("BirthDate")
.HasColumnType("datetime2");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("OfficePhoneNumber")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PreferredLanguage")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Employees");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,48 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DamageAssesment.Api.Employees.Migrations
{
/// <inheritdoc />
public partial class employeeupdate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "Id",
table: "Employees",
type: "int",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(450)")
.Annotation("SqlServer:Identity", "1, 1");
migrationBuilder.AddColumn<string>(
name: "EmployeeCode",
table: "Employees",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EmployeeCode",
table: "Employees");
migrationBuilder.AlterColumn<string>(
name: "Id",
table: "Employees",
type: "nvarchar(450)",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.OldAnnotation("SqlServer:Identity", "1, 1");
}
}
}

View File

@ -1,72 +0,0 @@
// <auto-generated />
using System;
using DamageAssesment.Api.Employees.Db;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DamageAssesment.Api.Employees.Migrations
{
[DbContext(typeof(EmployeeDbContext))]
[Migration("20230913170055_updatedemployee_id")]
partial class updatedemployee_id
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("DamageAssesment.Api.Employees.Db.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("BirthDate")
.HasColumnType("datetime2");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("EmployeeCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("OfficePhoneNumber")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PreferredLanguage")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Employees");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DamageAssesment.Api.Employees.Migrations
{
[DbContext(typeof(EmployeeDbContext))]
[Migration("20230913164315_employeeupdate")]
partial class employeeupdate
[Migration("20230927210957_AzureEmployees")]
partial class AzureEmployees
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace DamageAssesment.Api.Employees.Migrations
{
/// <inheritdoc />
public partial class InitialEmployee : Migration
public partial class AzureEmployees : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -15,7 +15,9 @@ namespace DamageAssesment.Api.Employees.Migrations
name: "Employees",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EmployeeCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
BirthDate = table.Column<DateTime>(type: "datetime2", nullable: false),
OfficePhoneNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),

View File

@ -14,7 +14,11 @@
"endpoint2": "xxx",
"endpoint3": "xxx"
},
//"ConnectionStrings": {
// "EmployeeConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
//},
"ConnectionStrings": {
"EmployeeConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
"EmployeeConnection": "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;"
}
}

View File

@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DamageAssesment.Api.Locations.Migrations
{
[DbContext(typeof(LocationDbContext))]
[Migration("20230817214454_InitialLocation")]
partial class InitialLocation
[Migration("20230927211146_AzureLocations")]
partial class AzureLocations
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -26,23 +26,29 @@ namespace DamageAssesment.Api.Locations.Migrations
modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Location", b =>
{
b.Property<string>("Id")
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("LocationCode")
.IsRequired()
.HasMaxLength(4)
.HasColumnType("nvarchar(4)");
b.Property<string>("MaintenanceCenter")
.IsRequired()
.HasMaxLength(1)
.HasColumnType("nvarchar(1)");
.HasMaxLength(4)
.HasColumnType("nvarchar(4)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RegionId")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("RegionId")
.HasColumnType("int");
b.Property<string>("SchoolType")
.IsRequired()
@ -56,9 +62,11 @@ namespace DamageAssesment.Api.Locations.Migrations
modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Region", b =>
{
b.Property<string>("Id")
.HasMaxLength(2)
.HasColumnType("nvarchar(2)");
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Abbreviation")
.IsRequired()

View File

@ -5,7 +5,7 @@
namespace DamageAssesment.Api.Locations.Migrations
{
/// <inheritdoc />
public partial class InitialLocation : Migration
public partial class AzureLocations : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -14,11 +14,13 @@ namespace DamageAssesment.Api.Locations.Migrations
name: "Locations",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RegionId = table.Column<int>(type: "int", nullable: false),
LocationCode = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
MaintenanceCenter = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false),
SchoolType = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false),
RegionId = table.Column<string>(type: "nvarchar(max)", nullable: false)
MaintenanceCenter = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false),
SchoolType = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false)
},
constraints: table =>
{
@ -29,7 +31,8 @@ namespace DamageAssesment.Api.Locations.Migrations
name: "Regions",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Abbreviation = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: false)
},

View File

@ -23,23 +23,29 @@ namespace DamageAssesment.Api.Locations.Migrations
modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Location", b =>
{
b.Property<string>("Id")
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("LocationCode")
.IsRequired()
.HasMaxLength(4)
.HasColumnType("nvarchar(4)");
b.Property<string>("MaintenanceCenter")
.IsRequired()
.HasMaxLength(1)
.HasColumnType("nvarchar(1)");
.HasMaxLength(4)
.HasColumnType("nvarchar(4)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RegionId")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("RegionId")
.HasColumnType("int");
b.Property<string>("SchoolType")
.IsRequired()
@ -53,9 +59,11 @@ namespace DamageAssesment.Api.Locations.Migrations
modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Region", b =>
{
b.Property<string>("Id")
.HasMaxLength(2)
.HasColumnType("nvarchar(2)");
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Abbreviation")
.IsRequired()

View File

@ -9,7 +9,11 @@
}
},
"AllowedHosts": "*",
//"ConnectionStrings": {
// "LocationConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
//},
"ConnectionStrings": {
"LocationConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
"LocationConnection": "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;"
}
}

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;"
}
}

View File

@ -0,0 +1,70 @@
// <auto-generated />
using System;
using DamageAssesment.Api.SurveyResponses.Db;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DamageAssesment.Api.Responses.Migrations
{
[DbContext(typeof(SurveyResponseDbContext))]
[Migration("20230927211458_AzureSurveyResponses")]
partial class AzureSurveyResponses
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("DamageAssesment.Api.SurveyResponses.Db.SurveyResponse", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientDevice")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("CreatedDate")
.HasColumnType("datetime2");
b.Property<int>("EmployeeId")
.HasMaxLength(6)
.HasColumnType("int");
b.Property<string>("KeyAnswerResult")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<double?>("Latitude")
.HasColumnType("float");
b.Property<int>("LocationId")
.HasColumnType("int");
b.Property<double?>("Longitute")
.HasColumnType("float");
b.Property<int>("SurveyId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("SurveyResponses");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,11 +1,12 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DamageAssesment.Api.SurveyResponses.Migrations
namespace DamageAssesment.Api.Responses.Migrations
{
/// <inheritdoc />
public partial class InitialSurveyResponse : Migration
public partial class AzureSurveyResponses : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -17,8 +18,13 @@ namespace DamageAssesment.Api.SurveyResponses.Migrations
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
SurveyId = table.Column<int>(type: "int", nullable: false),
LocationId = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false),
EmployeeId = table.Column<string>(type: "nvarchar(6)", maxLength: 6, nullable: false)
LocationId = table.Column<int>(type: "int", nullable: false),
EmployeeId = table.Column<int>(type: "int", maxLength: 6, nullable: false),
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
ClientDevice = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
KeyAnswerResult = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
Longitute = table.Column<double>(type: "float", nullable: true),
Latitude = table.Column<double>(type: "float", nullable: true)
},
constraints: table =>
{

View File

@ -1,4 +1,5 @@
// <auto-generated />
using System;
using DamageAssesment.Api.SurveyResponses.Db;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@ -7,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DamageAssesment.Api.SurveyResponses.Migrations
namespace DamageAssesment.Api.Responses.Migrations
{
[DbContext(typeof(SurveyResponseDbContext))]
partial class SurveyResponseDbContextModelSnapshot : ModelSnapshot
@ -29,15 +30,29 @@ namespace DamageAssesment.Api.SurveyResponses.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("EmployeeId")
.IsRequired()
.HasMaxLength(6)
.HasColumnType("nvarchar(6)");
b.Property<string>("ClientDevice")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("LocationId")
.IsRequired()
.HasMaxLength(4)
.HasColumnType("nvarchar(4)");
b.Property<DateTime?>("CreatedDate")
.HasColumnType("datetime2");
b.Property<int>("EmployeeId")
.HasMaxLength(6)
.HasColumnType("int");
b.Property<string>("KeyAnswerResult")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<double?>("Latitude")
.HasColumnType("float");
b.Property<int>("LocationId")
.HasColumnType("int");
b.Property<double?>("Longitute")
.HasColumnType("float");
b.Property<int>("SurveyId")
.HasColumnType("int");

View File

@ -6,8 +6,12 @@
}
},
"AllowedHosts": "*",
//"ConnectionStrings": {
// "SurveyResponseConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
//},
"ConnectionStrings": {
"SurveyResponseConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
"SurveyResponseConnection": "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;"
},
"EndPointSettings": {
"AnswerUrlBase": "http://localhost:5200",

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
}
}

View File

@ -9,7 +9,11 @@
}
},
"AllowedHosts": "*",
//"ConnectionStrings": {
// "SurveyConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
//},
"ConnectionStrings": {
"SurveyConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
"SurveyConnection": "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;"
}
}