Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Resgrid.Providers.Migrations.Migrations
{
[Migration(68)]
public class M0068_AddIsPermanentFailureToWeatherAlertSources : Migration
[Migration(74)]
public class M0074_AddIsPermanentFailureToWeatherAlertSources : Migration
Comment on lines +5 to +6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for migration ID conflicts and verify the numbering sequence

echo "=== Checking for migration ID 68 in both migration providers ==="
rg -n "Migration\(68\)" --type cs

echo ""
echo "=== Checking for migrations 69-73 to understand the numbering gap ==="
for id in 69 70 71 72 73; do
  echo "--- Migration $id ---"
  rg -n "Migration\($id\)" --type cs
done

echo ""
echo "=== Listing all migration files to verify sequence ==="
fd -e cs -p "M[0-9]{4}_.*\.cs" Providers/Resgrid.Providers.Migrations/ Providers/Resgrid.Providers.MigrationsPg/ | sort

Repository: Resgrid/Core

Length of output: 14165


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Find where IsPermanentFailure is introduced/removed ==="
rg -n "IsPermanentFailure" --type cs Providers/Resgrid.Providers.Migrations/ Providers/Resgrid.Providers.MigrationsPg/ || true

echo
echo "=== Check Up/Down content for the reviewed migration ==="
sed -n '1,220p' Providers/Resgrid.Providers.Migrations/Migrations/M0074_AddIsPermanentFailureToWeatherAlertSources.cs

Repository: Resgrid/Core

Length of output: 1358


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Migrations touching WeatherAlertSources ==="
rg -n "WeatherAlertSources" --type cs Providers/Resgrid.Providers.Migrations/ Providers/Resgrid.Providers.MigrationsPg/ || true

echo
echo "=== Migrations touching IsPermanentFailure (sanity check) ==="
rg -n "IsPermanentFailure" --type cs Providers/Resgrid.Providers.Migrations/ Providers/Resgrid.Providers.MigrationsPg/ || true

Repository: Resgrid/Core

Length of output: 3110


Handle FluentMigrator VersionInfo history when changing this migration ID (68 → 74).

This migration now uses [Migration(74)] and is the only place that adds/removes WeatherAlertSources.IsPermanentFailure. However, [Migration(68)] is already used in the codebase by M0068_ChatbotTables(.cs/.Pg.cs).

If any environment already has VersionInfo showing 68 for the old version of this migration, it will not execute the new 74, and it may also skip the current migration logic for 68 (chatbot tables), leaving schema/history inconsistent.

Please verify (for both SQL Server and Postgres DBs) what VersionInfo records for versions 68 and 74, and apply a consistent repair plan (e.g., update VersionInfo from 68 → 74 where appropriate, or run missing migrations) so both the IsPermanentFailure change and the chatbot tables change are applied correctly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@Providers/Resgrid.Providers.Migrations/Migrations/M0074_AddIsPermanentFailureToWeatherAlertSources.cs`
around lines 5 - 6, The migration ID was changed to [Migration(74)] in class
M0074_AddIsPermanentFailureToWeatherAlertSources but M0068_ChatbotTables already
uses 68, so you must reconcile VersionInfo history: check the VersionInfo
table/records in both SQL Server and Postgres for entries 68 and 74, and either
update any existing VersionInfo rows that incorrectly point to 68 to 74 or
apply/run the missing migration(s) so both the
WeatherAlertSources.IsPermanentFailure change (the column added/removed by
M0074_AddIsPermanentFailureToWeatherAlertSources) and the chatbot tables
migration (M0068_ChatbotTables) are present; ensure the final VersionInfo
contains the correct sequence numbers, and if you choose to update VersionInfo
rows perform the update atomically with a backup and document the change so
FluentMigrator’s history matches the actual schema.

{
public override void Up()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Resgrid.Providers.MigrationsPg.Migrations
{
[Migration(68)]
public class M0068_AddIsPermanentFailureToWeatherAlertSourcesPg : Migration
[Migration(74)]
public class M0074_AddIsPermanentFailureToWeatherAlertSourcesPg : Migration
{
public override void Up()
{
Expand Down
Loading