diff --git a/ci/deploy-aspblogbrainordure-test.ps1 b/ci/deploy-aspblogbrainordure-test.ps1 index e1d5e66..9b7e59b 100644 --- a/ci/deploy-aspblogbrainordure-test.ps1 +++ b/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 diff --git a/db/webdata.accdb b/db/webdata.accdb deleted file mode 100644 index b24c06f..0000000 Binary files a/db/webdata.accdb and /dev/null differ