table update tested
This commit is contained in:
parent
26b360e0a9
commit
01ccd97528
1
DamageAssesmentApi/.gitignore
vendored
1
DamageAssesmentApi/.gitignore
vendored
@ -396,3 +396,4 @@ FodyWeavers.xsd
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
**/migrations/
|
39
db/migrate-sqldb_v1.ps1
Normal file
39
db/migrate-sqldb_v1.ps1
Normal file
@ -0,0 +1,39 @@
|
||||
# Define the path to your application's root directory
|
||||
$applicationRoot = "C:\Users\santh\OneDrive\Desktop\DOCKERS\ubuntu\Sprint6\C1011\Backend-API-Services\DamageAssesmentApi\"
|
||||
#To execute: powershell -ExecutionPolicy Bypass -File .\migrate-sqldb.ps1
|
||||
# Define the list of microservice directories
|
||||
$microservices = @(
|
||||
"DamageAssesment.Api.Answers",
|
||||
"DamageAssesment.Api.Attachments",
|
||||
"DamageAssesment.Api.DocuLinks",
|
||||
"DamageAssesment.Api.Employees",
|
||||
"DamageAssesment.Api.Locations",
|
||||
"DamageAssesment.Api.Questions",
|
||||
"DamageAssesment.Api.Responses",
|
||||
"DamageAssesment.Api.Surveys"
|
||||
)
|
||||
|
||||
|
||||
# Define the migration name with the current date and time
|
||||
$migrationName = "Migration_" + (Get-Date -Format "yyyyMMdd_HHmmss")
|
||||
|
||||
# Function to run migrations for a microservice
|
||||
Function Run-Migrations {
|
||||
param (
|
||||
[string]$microservicePath
|
||||
)
|
||||
|
||||
Write-Host "Running Migrations for $microservicePath..."
|
||||
Set-Location -Path $microservicePath
|
||||
dotnet ef migrations add $migrationName
|
||||
dotnet ef database update
|
||||
Write-Host "Migrations for $microservicePath completed."
|
||||
}
|
||||
|
||||
# Run migrations for each microservice
|
||||
$microservices | ForEach-Object {
|
||||
$microservicePath = Join-Path -Path $applicationRoot -ChildPath $_
|
||||
Run-Migrations -microservicePath $microservicePath
|
||||
}
|
||||
|
||||
Write-Host "All Migrations Completed."
|
Loading…
Reference in New Issue
Block a user