From 4eb8f84d5ba9d01c4eec8d6ad550bc68d5ca5154 Mon Sep 17 00:00:00 2001 From: uppuv Date: Wed, 27 Sep 2023 17:18:48 -0400 Subject: [PATCH] Azure Migrations --- .../20230927172606_InitialAnswer.Designer.cs} | 31 ++++---- .../20230927172606_InitialAnswer.cs} | 4 +- ...0927173358_InitialAnswercreate.Designer.cs | 58 +++++++++++++++ .../20230927173358_InitialAnswercreate.cs | 22 ++++++ .../Providers/AnswerProvider.cs | 2 +- .../appsettings.json | 6 +- .../appsettings.json | 6 +- .../Providers/DoculinkProvider.cs | 2 +- .../appsettings.json | 6 +- ...20230817213656_InitialEmployee.Designer.cs | 64 ----------------- .../20230913164315_employeeupdate.cs | 48 ------------- ...30913170055_updatedemployee_id.Designer.cs | 72 ------------------- ...20230927210957_AzureEmployees.Designer.cs} | 4 +- ...ee.cs => 20230927210957_AzureEmployees.cs} | 6 +- .../appsettings.json | 6 +- ...20230927211146_AzureLocations.Designer.cs} | 30 +++++--- ...on.cs => 20230927211146_AzureLocations.cs} | 15 ++-- .../LocationDbContextModelSnapshot.cs | 26 ++++--- .../appsettings.json | 6 +- ...20230927211340_AzureQuestions.Designer.cs} | 36 +++++++--- ...on.cs => 20230927211340_AzureQuestions.cs} | 25 +++++-- .../QuestionDbContextModelSnapshot.cs | 32 +++++++-- .../Providers/QuestionsProvider.cs | 2 +- .../appsettings.json | 6 +- ...927211458_AzureSurveyResponses.Designer.cs | 70 ++++++++++++++++++ ...=> 20230927211458_AzureSurveyResponses.cs} | 16 +++-- .../SurveyResponseDbContextModelSnapshot.cs | 33 ++++++--- .../appsettings.json | 6 +- ...> 20230927211618_AzureSurveys.Designer.cs} | 43 ++++++++--- ...rvey.cs => 20230927211618_AzureSurveys.cs} | 28 ++++++-- .../SurveysDbContextModelSnapshot.cs | 39 +++++++--- .../appsettings.json | 6 +- 32 files changed, 460 insertions(+), 296 deletions(-) rename DamageAssesmentApi/{DamageAssesment.Api.SurveyResponses/Migrations/20230817221348_InitialSurveyResponse.Designer.cs => DamageAssesment.Api.Answers/Migrations/20230927172606_InitialAnswer.Designer.cs} (60%) rename DamageAssesmentApi/{DamageAssesment.Api.Employees/Migrations/20230913170055_updatedemployee_id.cs => DamageAssesment.Api.Answers/Migrations/20230927172606_InitialAnswer.cs} (76%) create mode 100644 DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927173358_InitialAnswercreate.Designer.cs create mode 100644 DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927173358_InitialAnswercreate.cs delete mode 100644 DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230817213656_InitialEmployee.Designer.cs delete mode 100644 DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913164315_employeeupdate.cs delete mode 100644 DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913170055_updatedemployee_id.Designer.cs rename DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/{20230913164315_employeeupdate.Designer.cs => 20230927210957_AzureEmployees.Designer.cs} (96%) rename DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/{20230817213656_InitialEmployee.cs => 20230927210957_AzureEmployees.cs} (81%) rename DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/{20230817214454_InitialLocation.Designer.cs => 20230927211146_AzureLocations.Designer.cs} (73%) rename DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/{20230817214454_InitialLocation.cs => 20230927211146_AzureLocations.cs} (71%) rename DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/{20230817215744_InitialQuestion.Designer.cs => 20230927211340_AzureQuestions.Designer.cs} (83%) rename DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/{20230817215744_InitialQuestion.cs => 20230927211340_AzureQuestions.cs} (79%) create mode 100644 DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230927211458_AzureSurveyResponses.Designer.cs rename DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/{20230817221348_InitialSurveyResponse.cs => 20230927211458_AzureSurveyResponses.cs} (51%) rename DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/{20230817220614_InitialSurvey.Designer.cs => 20230927211618_AzureSurveys.Designer.cs} (57%) rename DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/{20230817220614_InitialSurvey.cs => 20230927211618_AzureSurveys.cs} (53%) diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230817221348_InitialSurveyResponse.Designer.cs b/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927172606_InitialAnswer.Designer.cs similarity index 60% rename from DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230817221348_InitialSurveyResponse.Designer.cs rename to DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927172606_InitialAnswer.Designer.cs index edec629..f66d69b 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230817221348_InitialSurveyResponse.Designer.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927172606_InitialAnswer.Designer.cs @@ -1,5 +1,6 @@ // -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 { /// 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("Id") .ValueGeneratedOnAdd() @@ -32,22 +33,24 @@ namespace DamageAssesment.Api.SurveyResponses.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("EmployeeId") + b.Property("AnswerText") .IsRequired() - .HasMaxLength(6) - .HasColumnType("nvarchar(6)"); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); - b.Property("LocationId") + b.Property("Comment") .IsRequired() - .HasMaxLength(4) - .HasColumnType("nvarchar(4)"); + .HasColumnType("nvarchar(max)"); - b.Property("SurveyId") + b.Property("QuestionId") + .HasColumnType("int"); + + b.Property("SurveyResponseId") .HasColumnType("int"); b.HasKey("Id"); - b.ToTable("SurveyResponses"); + b.ToTable("Answers"); }); #pragma warning restore 612, 618 } diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913170055_updatedemployee_id.cs b/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927172606_InitialAnswer.cs similarity index 76% rename from DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913170055_updatedemployee_id.cs rename to DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927172606_InitialAnswer.cs index 8b004ed..67c56f7 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913170055_updatedemployee_id.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927172606_InitialAnswer.cs @@ -2,10 +2,10 @@ #nullable disable -namespace DamageAssesment.Api.Employees.Migrations +namespace DamageAssesment.Api.Answers.Migrations { /// - public partial class updatedemployee_id : Migration + public partial class InitialAnswer : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927173358_InitialAnswercreate.Designer.cs b/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927173358_InitialAnswercreate.Designer.cs new file mode 100644 index 0000000..0a8c5ce --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927173358_InitialAnswercreate.Designer.cs @@ -0,0 +1,58 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AnswerText") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("QuestionId") + .HasColumnType("int"); + + b.Property("SurveyResponseId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Answers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927173358_InitialAnswercreate.cs b/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927173358_InitialAnswercreate.cs new file mode 100644 index 0000000..3b42551 --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Migrations/20230927173358_InitialAnswercreate.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DamageAssesment.Api.Answers.Migrations +{ + /// + public partial class InitialAnswercreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/Providers/AnswerProvider.cs b/DamageAssesmentApi/DamageAssesment.Api.Answers/Providers/AnswerProvider.cs index 812f66e..291726f 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Answers/Providers/AnswerProvider.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Providers/AnswerProvider.cs @@ -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 Answers, string ErrorMessage)> GetAnswersAsync() diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.Answers/appsettings.json index 1cd2bcb..23b0a8f 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Answers/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/appsettings.json @@ -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;" + } } diff --git a/DamageAssesmentApi/DamageAssesment.Api.Attachments/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.Attachments/appsettings.json index 1b48365..29a4c79 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Attachments/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Attachments/appsettings.json @@ -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;" + } } diff --git a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Providers/DoculinkProvider.cs b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Providers/DoculinkProvider.cs index cf8bcfe..1a77ecf 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Providers/DoculinkProvider.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Providers/DoculinkProvider.cs @@ -27,7 +27,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers this.logger = logger; this.mapper = mapper; this.uploadservice = uploadservice; - SeedData(); + //SeedData(); } diff --git a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/appsettings.json index 0006765..46db839 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/appsettings.json @@ -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", diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230817213656_InitialEmployee.Designer.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230817213656_InitialEmployee.Designer.cs deleted file mode 100644 index d747ab1..0000000 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230817213656_InitialEmployee.Designer.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -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 - { - /// - 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("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("BirthDate") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("OfficePhoneNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("PreferredLanguage") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Employees"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913164315_employeeupdate.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913164315_employeeupdate.cs deleted file mode 100644 index 8b5ff7f..0000000 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913164315_employeeupdate.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DamageAssesment.Api.Employees.Migrations -{ - /// - public partial class employeeupdate : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Id", - table: "Employees", - type: "int", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(450)") - .Annotation("SqlServer:Identity", "1, 1"); - - migrationBuilder.AddColumn( - name: "EmployeeCode", - table: "Employees", - type: "nvarchar(50)", - maxLength: 50, - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "EmployeeCode", - table: "Employees"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Employees", - type: "nvarchar(450)", - nullable: false, - oldClrType: typeof(int), - oldType: "int") - .OldAnnotation("SqlServer:Identity", "1, 1"); - } - } -} diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913170055_updatedemployee_id.Designer.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913170055_updatedemployee_id.Designer.cs deleted file mode 100644 index 35e45ac..0000000 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913170055_updatedemployee_id.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -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 - { - /// - 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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("BirthDate") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("OfficePhoneNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("PreferredLanguage") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Employees"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913164315_employeeupdate.Designer.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230927210957_AzureEmployees.Designer.cs similarity index 96% rename from DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913164315_employeeupdate.Designer.cs rename to DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230927210957_AzureEmployees.Designer.cs index b4aebb2..7110b86 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230913164315_employeeupdate.Designer.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230927210957_AzureEmployees.Designer.cs @@ -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 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230817213656_InitialEmployee.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230927210957_AzureEmployees.cs similarity index 81% rename from DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230817213656_InitialEmployee.cs rename to DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230927210957_AzureEmployees.cs index 607751e..1a544ab 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230817213656_InitialEmployee.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/Migrations/20230927210957_AzureEmployees.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace DamageAssesment.Api.Employees.Migrations { /// - public partial class InitialEmployee : Migration + public partial class AzureEmployees : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -15,7 +15,9 @@ namespace DamageAssesment.Api.Employees.Migrations name: "Employees", columns: table => new { - Id = table.Column(type: "nvarchar(450)", nullable: false), + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + EmployeeCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), BirthDate = table.Column(type: "datetime2", nullable: false), OfficePhoneNumber = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.Employees/appsettings.json index e4445e8..daf21ba 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/appsettings.json @@ -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;" + } } diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230817214454_InitialLocation.Designer.cs b/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230927211146_AzureLocations.Designer.cs similarity index 73% rename from DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230817214454_InitialLocation.Designer.cs rename to DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230927211146_AzureLocations.Designer.cs index 3e27956..ceeb7c2 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230817214454_InitialLocation.Designer.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230927211146_AzureLocations.Designer.cs @@ -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 { /// 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("Id") + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("LocationCode") + .IsRequired() .HasMaxLength(4) .HasColumnType("nvarchar(4)"); b.Property("MaintenanceCenter") .IsRequired() - .HasMaxLength(1) - .HasColumnType("nvarchar(1)"); + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); b.Property("Name") .IsRequired() .HasMaxLength(50) .HasColumnType("nvarchar(50)"); - b.Property("RegionId") - .IsRequired() - .HasColumnType("nvarchar(max)"); + b.Property("RegionId") + .HasColumnType("int"); b.Property("SchoolType") .IsRequired() @@ -56,9 +62,11 @@ namespace DamageAssesment.Api.Locations.Migrations modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Region", b => { - b.Property("Id") - .HasMaxLength(2) - .HasColumnType("nvarchar(2)"); + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Abbreviation") .IsRequired() diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230817214454_InitialLocation.cs b/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230927211146_AzureLocations.cs similarity index 71% rename from DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230817214454_InitialLocation.cs rename to DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230927211146_AzureLocations.cs index 4143c63..a67c6b6 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230817214454_InitialLocation.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/20230927211146_AzureLocations.cs @@ -5,7 +5,7 @@ namespace DamageAssesment.Api.Locations.Migrations { /// - public partial class InitialLocation : Migration + public partial class AzureLocations : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -14,11 +14,13 @@ namespace DamageAssesment.Api.Locations.Migrations name: "Locations", columns: table => new { - Id = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: false), + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RegionId = table.Column(type: "int", nullable: false), + LocationCode = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: false), Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - MaintenanceCenter = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: false), - SchoolType = table.Column(type: "nvarchar(2)", maxLength: 2, nullable: false), - RegionId = table.Column(type: "nvarchar(max)", nullable: false) + MaintenanceCenter = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: false), + SchoolType = table.Column(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(type: "nvarchar(2)", maxLength: 2, nullable: false), + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Abbreviation = table.Column(type: "nvarchar(5)", maxLength: 5, nullable: false) }, diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/LocationDbContextModelSnapshot.cs b/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/LocationDbContextModelSnapshot.cs index 0ae10ad..2d65126 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/LocationDbContextModelSnapshot.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Migrations/LocationDbContextModelSnapshot.cs @@ -23,23 +23,29 @@ namespace DamageAssesment.Api.Locations.Migrations modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Location", b => { - b.Property("Id") + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("LocationCode") + .IsRequired() .HasMaxLength(4) .HasColumnType("nvarchar(4)"); b.Property("MaintenanceCenter") .IsRequired() - .HasMaxLength(1) - .HasColumnType("nvarchar(1)"); + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); b.Property("Name") .IsRequired() .HasMaxLength(50) .HasColumnType("nvarchar(50)"); - b.Property("RegionId") - .IsRequired() - .HasColumnType("nvarchar(max)"); + b.Property("RegionId") + .HasColumnType("int"); b.Property("SchoolType") .IsRequired() @@ -53,9 +59,11 @@ namespace DamageAssesment.Api.Locations.Migrations modelBuilder.Entity("DamageAssesment.Api.Locations.Db.Region", b => { - b.Property("Id") - .HasMaxLength(2) - .HasColumnType("nvarchar(2)"); + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Abbreviation") .IsRequired() diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.Locations/appsettings.json index 37d1aef..a7e3ff7 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Locations/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/appsettings.json @@ -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;" + } } diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230817215744_InitialQuestion.Designer.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230927211340_AzureQuestions.Designer.cs similarity index 83% rename from DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230817215744_InitialQuestion.Designer.cs rename to DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230927211340_AzureQuestions.Designer.cs index 4cbbf64..8f81c7f 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230817215744_InitialQuestion.Designer.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230927211340_AzureQuestions.Designer.cs @@ -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 { /// 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("Language") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CategoryTranslations"); + }); + modelBuilder.Entity("DamageAssesment.Api.Questions.Db.Question", b => { b.Property("Id") @@ -45,10 +69,6 @@ namespace DamageAssesment.Api.Questions.Migrations b.Property("Key") .HasColumnType("bit"); - b.Property("QuestionGroup") - .IsRequired() - .HasColumnType("nvarchar(max)"); - b.Property("QuestionNumber") .HasColumnType("int"); @@ -73,11 +93,11 @@ namespace DamageAssesment.Api.Questions.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("CategoryImage") + b.Property("IconLibrary") .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("CategoryName") + b.Property("IconName") .IsRequired() .HasColumnType("nvarchar(max)"); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230817215744_InitialQuestion.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230927211340_AzureQuestions.cs similarity index 79% rename from DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230817215744_InitialQuestion.cs rename to DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230927211340_AzureQuestions.cs index aaaf018..cd07b7c 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230817215744_InitialQuestion.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/20230927211340_AzureQuestions.cs @@ -5,19 +5,34 @@ namespace DamageAssesment.Api.Questions.Migrations { /// - public partial class InitialQuestion : Migration + public partial class AzureQuestions : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.CreateTable( + name: "CategoryTranslations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CategoryId = table.Column(type: "int", nullable: false), + Title = table.Column(type: "nvarchar(max)", nullable: false), + Language = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CategoryTranslations", x => x.Id); + }); + migrationBuilder.CreateTable( name: "QuestionCategories", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - CategoryName = table.Column(type: "nvarchar(max)", nullable: false), - CategoryImage = table.Column(type: "nvarchar(max)", nullable: false) + IconName = table.Column(type: "nvarchar(max)", nullable: false), + IconLibrary = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { @@ -64,7 +79,6 @@ namespace DamageAssesment.Api.Questions.Migrations Comment = table.Column(type: "bit", nullable: false), Key = table.Column(type: "bit", nullable: false), SurveyId = table.Column(type: "int", nullable: true), - QuestionGroup = table.Column(type: "nvarchar(max)", nullable: false), CategoryId = table.Column(type: "int", nullable: false) }, constraints: table => @@ -87,6 +101,9 @@ namespace DamageAssesment.Api.Questions.Migrations /// protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropTable( + name: "CategoryTranslations"); + migrationBuilder.DropTable( name: "QuestionCategories"); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/QuestionDbContextModelSnapshot.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/QuestionDbContextModelSnapshot.cs index 018f296..397c5d6 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/QuestionDbContextModelSnapshot.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Migrations/QuestionDbContextModelSnapshot.cs @@ -22,6 +22,30 @@ namespace DamageAssesment.Api.Questions.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + modelBuilder.Entity("DamageAssesment.Api.Questions.Db.CategoryTranslation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("Language") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CategoryTranslations"); + }); + modelBuilder.Entity("DamageAssesment.Api.Questions.Db.Question", b => { b.Property("Id") @@ -42,10 +66,6 @@ namespace DamageAssesment.Api.Questions.Migrations b.Property("Key") .HasColumnType("bit"); - b.Property("QuestionGroup") - .IsRequired() - .HasColumnType("nvarchar(max)"); - b.Property("QuestionNumber") .HasColumnType("int"); @@ -70,11 +90,11 @@ namespace DamageAssesment.Api.Questions.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("CategoryImage") + b.Property("IconLibrary") .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("CategoryName") + b.Property("IconName") .IsRequired() .HasColumnType("nvarchar(max)"); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Providers/QuestionsProvider.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Providers/QuestionsProvider.cs index 13b12c5..bd2622d 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Providers/QuestionsProvider.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Providers/QuestionsProvider.cs @@ -19,7 +19,7 @@ namespace DamageAssesment.Api.Questions.Providers this.questionDbContext = questionDbContext; this.logger = logger; this.mapper = mapper; - SeedData(); + //SeedData(); } public void SeedData() diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.Questions/appsettings.json index 8c0132f..e63711e 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/appsettings.json @@ -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;" + } } diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230927211458_AzureSurveyResponses.Designer.cs b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230927211458_AzureSurveyResponses.Designer.cs new file mode 100644 index 0000000..60e0615 --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230927211458_AzureSurveyResponses.Designer.cs @@ -0,0 +1,70 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientDevice") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasMaxLength(6) + .HasColumnType("int"); + + b.Property("KeyAnswerResult") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Latitude") + .HasColumnType("float"); + + b.Property("LocationId") + .HasColumnType("int"); + + b.Property("Longitute") + .HasColumnType("float"); + + b.Property("SurveyId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("SurveyResponses"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230817221348_InitialSurveyResponse.cs b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230927211458_AzureSurveyResponses.cs similarity index 51% rename from DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230817221348_InitialSurveyResponse.cs rename to DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230927211458_AzureSurveyResponses.cs index e886ab1..f2915c4 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230817221348_InitialSurveyResponse.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/20230927211458_AzureSurveyResponses.cs @@ -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 { /// - public partial class InitialSurveyResponse : Migration + public partial class AzureSurveyResponses : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -17,8 +18,13 @@ namespace DamageAssesment.Api.SurveyResponses.Migrations Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), SurveyId = table.Column(type: "int", nullable: false), - LocationId = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: false), - EmployeeId = table.Column(type: "nvarchar(6)", maxLength: 6, nullable: false) + LocationId = table.Column(type: "int", nullable: false), + EmployeeId = table.Column(type: "int", maxLength: 6, nullable: false), + CreatedDate = table.Column(type: "datetime2", nullable: true), + ClientDevice = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + KeyAnswerResult = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), + Longitute = table.Column(type: "float", nullable: true), + Latitude = table.Column(type: "float", nullable: true) }, constraints: table => { diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/SurveyResponseDbContextModelSnapshot.cs b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/SurveyResponseDbContextModelSnapshot.cs index 1870d21..f90e67e 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/SurveyResponseDbContextModelSnapshot.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Migrations/SurveyResponseDbContextModelSnapshot.cs @@ -1,4 +1,5 @@ // +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("Id")); - b.Property("EmployeeId") - .IsRequired() - .HasMaxLength(6) - .HasColumnType("nvarchar(6)"); + b.Property("ClientDevice") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); - b.Property("LocationId") - .IsRequired() - .HasMaxLength(4) - .HasColumnType("nvarchar(4)"); + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasMaxLength(6) + .HasColumnType("int"); + + b.Property("KeyAnswerResult") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Latitude") + .HasColumnType("float"); + + b.Property("LocationId") + .HasColumnType("int"); + + b.Property("Longitute") + .HasColumnType("float"); b.Property("SurveyId") .HasColumnType("int"); diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/appsettings.json index 0042404..45a8ae8 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/appsettings.json @@ -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", diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230817220614_InitialSurvey.Designer.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230927211618_AzureSurveys.Designer.cs similarity index 57% rename from DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230817220614_InitialSurvey.Designer.cs rename to DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230927211618_AzureSurveys.Designer.cs index c0f4172..975ccab 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230817220614_InitialSurvey.Designer.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230927211618_AzureSurveys.Designer.cs @@ -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 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -33,24 +33,47 @@ namespace DamageAssesment.Api.Survey.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("EndDate") + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("EndDate") .HasColumnType("datetime2"); b.Property("IsEnabled") .HasColumnType("bit"); - b.Property("StartDate") + b.Property("StartDate") .HasColumnType("datetime2"); - b.Property("Title") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - b.HasKey("Id"); b.ToTable("Surveys"); }); + + modelBuilder.Entity("DamageAssesment.Api.Surveys.Db.SurveyTranslation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Language") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SurveyId") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.ToTable("SurveysTranslation"); + }); #pragma warning restore 612, 618 } } diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230817220614_InitialSurvey.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230927211618_AzureSurveys.cs similarity index 53% rename from DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230817220614_InitialSurvey.cs rename to DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230927211618_AzureSurveys.cs index 1d62693..c6d61be 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230817220614_InitialSurvey.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/20230927211618_AzureSurveys.cs @@ -3,10 +3,10 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace DamageAssesment.Api.Survey.Migrations +namespace DamageAssesment.Api.Surveys.Migrations { /// - public partial class InitialSurvey : Migration + public partial class AzureSurveys : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -17,15 +17,30 @@ namespace DamageAssesment.Api.Survey.Migrations { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Title = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), - StartDate = table.Column(type: "datetime2", nullable: true), - EndDate = table.Column(type: "datetime2", nullable: true) + StartDate = table.Column(type: "datetime2", nullable: false), + EndDate = table.Column(type: "datetime2", nullable: false), + CreatedDate = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Surveys", x => x.Id); }); + + migrationBuilder.CreateTable( + name: "SurveysTranslation", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SurveyId = table.Column(type: "int", nullable: false), + Title = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Language = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SurveysTranslation", x => x.Id); + }); } /// @@ -33,6 +48,9 @@ namespace DamageAssesment.Api.Survey.Migrations { migrationBuilder.DropTable( name: "Surveys"); + + migrationBuilder.DropTable( + name: "SurveysTranslation"); } } } diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/SurveysDbContextModelSnapshot.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/SurveysDbContextModelSnapshot.cs index 969a062..a5e3f68 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/SurveysDbContextModelSnapshot.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Migrations/SurveysDbContextModelSnapshot.cs @@ -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("Id")); - b.Property("EndDate") + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("EndDate") .HasColumnType("datetime2"); b.Property("IsEnabled") .HasColumnType("bit"); - b.Property("StartDate") + b.Property("StartDate") .HasColumnType("datetime2"); - b.Property("Title") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - b.HasKey("Id"); b.ToTable("Surveys"); }); + + modelBuilder.Entity("DamageAssesment.Api.Surveys.Db.SurveyTranslation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Language") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SurveyId") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.ToTable("SurveysTranslation"); + }); #pragma warning restore 612, 618 } } diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.Surveys/appsettings.json index 0057832..0d6c40d 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/appsettings.json @@ -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;" + } }