Преглед изворни кода

Fix deploy: add scripts/ folder, create webdata.mdb via ADOX, run migrations

- Copy scripts/ folder on deploy so runMigrations.vbs is available on server
- Create empty webdata.mdb via ADOX (32-bit cscript) on first deploy
- Run migrations after each deploy using SysWOW64\cscript.exe (JET 4.0 requires 32-bit)
- Remove stale webdata.accdb (wrong format for JET 4.0 provider)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pull/5/head
Nano пре 6 дана
родитељ
комит
e379eec766
2 измењених фајлова са 36 додато и 1 уклоњено
  1. +36
    -1
      ci/deploy-aspblogbrainordure-test.ps1
  2. BIN
      db/webdata.accdb

+ 36
- 1
ci/deploy-aspblogbrainordure-test.ps1 Прегледај датотеку

@@ -80,7 +80,7 @@ Log "Extracted to $srcPath"
$publicDst = Join-Path $WEBROOT "public"
New-Item -ItemType Directory -Force -Path $publicDst | Out-Null

foreach ($folder in @("public", "core", "app")) {
foreach ($folder in @("public", "core", "app", "scripts")) {
$folderSrc = Join-Path $srcPath $folder
$folderDst = Join-Path $WEBROOT $folder
if (Test-Path $folderSrc) {
@@ -121,6 +121,41 @@ if (Test-Path $webConfigPath) {
Log "Updated web.config."
}

# Create webdata.mdb if it doesn't exist (use 32-bit cscript — JET 4.0 is 32-bit only)
$mdbPath = "$WEBROOT\db\webdata.mdb"
if (-not (Test-Path $mdbPath)) {
Log "Creating empty webdata.mdb via ADOX (32-bit cscript)..."
$tmpVbs = "C:\Scripts\create_mdb_tmp.vbs"
@"
Dim cat
Set cat = CreateObject("ADOX.Catalog")
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$mdbPath;"
Set cat = Nothing
WScript.Quit 0
"@ | Out-File -FilePath $tmpVbs -Encoding ASCII
& "C:\Windows\SysWOW64\cscript.exe" "//nologo" $tmpVbs
Remove-Item $tmpVbs -Force -ErrorAction SilentlyContinue
if (Test-Path $mdbPath) {
Log "Created webdata.mdb."
} else {
Log "ERROR: Failed to create webdata.mdb"
exit 1
}
}

# Run database migrations (32-bit cscript required for JET OLEDB)
$migrationsVbs = Join-Path $WEBROOT "scripts\runMigrations.vbs"
if (Test-Path $migrationsVbs) {
Log "Running database migrations..."
$output = & "C:\Windows\SysWOW64\cscript.exe" "//nologo" $migrationsVbs "up" 2>&1
$output | ForEach-Object { Log " [migrate] $_" }
if ($LASTEXITCODE -ne 0) {
Log "ERROR: Migration failed (exit code $LASTEXITCODE)"
exit 1
}
Log "Migrations complete."
}

# Grant IIS_IUSRS write access to db folder
$dbPath = Join-Path $WEBROOT "db"
New-Item -ItemType Directory -Force -Path $dbPath | Out-Null



Loading…
Откажи
Сачувај

Powered by TurnKey Linux.