The initial results were puzzling. While seven tables matched perfectly, three did not. A granular investigation revealed a subtle but critical issue in how data was being transported. Several columns in the database were defined as a plain numeric type. In Postgres, this type preserves the exact precision of the stored data. For example, a travel rating stored as 5.0 remains 5.0, and a geographical latitude ending in a zero, such as 40.056930, retains that final digit.
However, the Lovable query tool used for the export returned results in JSON format. The JSON standard does not distinguish between an integer and a floating-point number in a way that preserves trailing zeros. Consequently, during the transport process, 5.0 was truncated to 5. While a human reader might consider these values equivalent, a checksum does not. More importantly, the change would have altered the visual presentation of the site, turning a professional "5.0" rating into a plain "5."
The solution was to ensure that every row left the live database as explicit text, bypassing the precision-stripping tendencies of the JSON intermediary. Once this adjustment was made, the three problematic tables matched to the last digit.
Pages: the site wasn’t deterministic
The final validation of a database copy is the output of the application it supports. Because this travel directory utilizes static site generation—prerendering its 745 pages by reading directly from the database—the developer was able to run a "diff" between two full builds: one generated from the original database and one from the new copy.
The comparison initially flagged 71 differences. Every discrepancy occurred in the "nearby places" section of the pages. The underlying query for this feature sorted listings by their rating, but because many listings shared the same rating, the sort order was technically undefined for those "tied" rows. In such cases, Postgres returns rows in the order they appear on the disk.
A database that has been actively edited for a year stores its data differently than a freshly loaded copy. Consequently, the "nearby places" were reshuffling simply because the data occupied different physical sectors on the server. This revealed a pre-existing bug: the live site was non-deterministic. The "nearby places" box could change between any two deployments without any underlying data changes. By adding a secondary sort criteria—"then by name"—the developer made the process deterministic. A subsequent comparison of 1,309 generated files returned zero differences.
The copy surfaced bugs the original was hiding
One of the unexpected benefits of the migration was its role as a diagnostic tool. Running the site’s server code against a fresh, clean database forced the execution of code paths that had remained dormant for months. This process revealed that the live site was, in fact, partially broken.
A contact form on the directory had been silently failing since May. A previous security update had modified four "notify me" triggers to call a function that did not exist in the production database. Every time a user attempted to send a message or post a review, the database encountered an error on insertion and aborted the save. Because the form was rarely used, the error had gone unnoticed.
Furthermore, a second bug was discovered within the notification logic itself. The function responsible for sending alerts was designed to read a secret key from the Supabase vault via a REST API. However, the vault is not exposed over that specific API, resulting in a consistent 401 Unauthorized error. The migration process allowed the developer to identify and fix the first bug on the live site immediately, while the second was resolved within the new project environment.
