Skip to content
Interface language: English
Audit / Signal

An AI-assisted database migration needs a restore rehearsal

Assess an AI-prepared database migration through the data change, reference backup, isolated restoration and interruption conditions.

Article language: English

A hand beside a gold-coloured mechanism with a suspended clear drop-shaped object and a pale sphere.
In this article

“If something goes wrong, we will roll back the change” sounds good until someone asks what exactly must come back. A column name? The contents of a deleted field? Requests recorded in the meantime? An AI-prepared script may have a section labelled rollback, but the heading itself does not restore information. Check whether that path works on material representative of the planned change and whether everyone knows when it may be used.

A database migration is a controlled change to its structure or data. Accepting one therefore requires more than confirming that commands are syntactically correct. First set out what changes, the starting state and the result the application should see. Then conduct an agreed restore rehearsal in an isolated environment. This article describes how to prepare that acceptance process, without performing a production migration or providing universal commands to paste into your database.

What changes in the structure and what changes in the meaning of data?

Imagine a fictional service system where one description of a deadline is to be split into a date and a comment. AI proposes adding fields, transferring values and later deleting the old column. That is several decisions, not one cosmetic fix. Some records may contain a precise day; others may say “after delivery is confirmed”. The new structure does not decide what to enter in those two cases.

Start with a data map: the old field, its actual meaning, the new representation and the transfer rule. Establish a separate path for ambiguous values. Do not let the model invent a date merely to fill a required field. Choose control records representing these differences and have the process owner approve the expected result. Checking technical syntax cannot replace that decision.

Check relationships: what points to the changed record, where its identifier is used and which reports read the old field. The record total before and after the change is not enough. Two errors may cancel each other out numerically. The article on an SQL query counting rows instead of cases (in Polish) shows why the meaning of a result must be reconstructed. A migration has to preserve that meaning in durable state.

Establish compatibility with the application. Can the existing version read the new representation? Can the new version handle a record that has not yet been transferred? Which version may write data during the transition? These questions determine deployment order. The ability to restore old code alone does not mean that code will handle the changed database correctly.

Add places outside the database to the plan: files, a job queue and integrations, if they participate in the process. There is no need to list the entire infrastructure just in case. You do need to see effects that may occur before or after the change finishes. For a process spanning several systems, map the possible effects of partial execution. The article on partial execution of an agent task (in Polish) shows how to identify them.

Can the backup actually restore the state?

PostgreSQL's SQL dump documentation describes an export that can recreate a database and separate conditions for restoring it. Among other things, it notes the need for appropriate roles and permissions, and the difference between a single-database backup and information shared across a PostgreSQL installation. The existence of a file alone does not confirm a complete restoration of the environment.

For acceptance, ask for the agreed backup to be restored to a separate location and the selected data to be read. Record which copy was used, what was restored, which steps were manual and what limitations remained. Do not treat “backup completed” as the result of this rehearsal. Creating a backup and using it are different actions, even if a tool shows a similar green message.

Check how the restore tool responds to an error. PostgreSQL's restore description notes that psql can, by default, continue running a script after an SQL error; different behaviour requires suitable configuration. Read the full rehearsal result and the state afterwards. Do not conclude that restoration was complete merely because the final message appeared or some expected tables exist.

In the deadline example, choose a set of recognisable cases. After restoration, check their identifiers, contents and relationships, not just the number of tables. Also open the relevant path in the isolated application if it is within scope. The person taking over needs to know whether useful information was recovered or merely a database that accepts a connection.

Keep the reference backup independent of a directory that the rehearsal might overwrite. Define access and permitted material. Controlled data should let the team examine the rules without accidentally moving confidential production data into an AI tool. The AI automation test environment (in Polish) article discusses isolation conditions. Adding “test” to a name does not change the connection target.

A file hash and evidence version (in Polish) can help identify the backup. A hash does not confirm that the contents are correct or restorable, but it can connect a rehearsal result to the exact material used. The report should keep those conclusions separate. A new backup made after the migration must not silently replace the reference point from before the change.

Establish the time needed to restore and the organisational conditions for starting it. A rehearsal may show that the backup works but that recovery takes longer than the service interruption allowed. Do not simply change the label to “ready”. A decision is needed on whether to change the plan, scope or how the business continues working during restoration.

Which effects does a transaction rollback cover?

The PostgreSQL introduction to transactions explains grouping operations and rolling back changes within a transaction. It also describes savepoints that allow a return to a particular point in that run. These are mechanisms of a specific system and must be related to the actual script and the way it is run.

Do not assume the word “rollback” makes the entire project reversible. An operation committed earlier, a transformation that removes detail from data, and a message sent to an external system raise different questions. In the fictional deadline split, restoring a column name need not recover the original sentence if it was not preserved anywhere. The plan should identify that before execution begins.

Aeneia conceptual photography

SQLite's ALTER TABLE documentation describes its own supported changes and dependencies on existing structure, indexes, views and other references. The method is not identical across all databases and versions. An AI-prepared solution must therefore be checked for your engine and configuration rather than relying on general knowledge of SQL, the database command language.

For each step, name the completion condition and the next path after a refusal. Does migration stop before changing data? Does it leave a recognisable partial state? Will a rerun repeat a transfer already performed? Answers should come from the design and rehearsal. It is not enough for an assistant to add a “safe to retry” comment to a script. Establish how it recognises prior execution.

Distinguish rolling back an unfinished operation from returning after normal work has continued for some time. Restoring an old backup may omit new cases saved after it was made. The plan must state how that interval will be handled and who decides whether a return is acceptable. Do not leave that decision until an incident, when users are still adding data and the team does not know which writes to preserve.

How should an interruption and return be rehearsed?

Build a scenario on isolated material. Record the initial state, expected change and a controlled interruption point chosen with the database owner. It might be refusal to transfer an ambiguous value. The point is not to break the entire environment at random, but to recognise a particular behaviour: what changed and how the process continues.

Include material that does not fit the new representation. In our example, a deadline sentence may contain two conditions or a date referring to another event. Decide whether such a record stays unchanged and is marked for clarification or blocks the agreed stage. This is a decision about useful data, not just script completion. If every test record is perfectly orderly, the migration will not show how it handles the exception that concerned the process owner.

First assess successful execution. Compare selected cases, relationship behaviour and application reads within the rehearsal's scope. Then run a separate failure scenario and the planned restoration. These answer different questions. A successful migration does not confirm the return path, and a successful restoration of the old state does not prove that the new data model is correct.

Add a write made after the start of the reference period if the real plan allows work to continue then. Agree in advance what should happen to that write. The check will then cover a harder situation than an immediate return after migration on a dataset to which nothing new was added. Do not claim that every concurrent-work problem has been solved if only one such case was examined.

Also check that the old writer is stopped. If the previous application version or a queued task can still write the old format, the new structure needs an agreed boundary. The choice of solution belongs to the technical design, but the person accepting it should see evidence of the expected behaviour. Switching the screen to a new version does not explain what happens to tasks started earlier.

Record actual results and timings, including errors. If the rehearsal stopped for lack of permission, do not describe it as successful restoration after migration. It may have revealed an important obstacle, but the question of the remaining path is still open. This article does not report an executed database test; it identifies evidence that should be produced when a particular solution is accepted.

Who decides to start the change?

The person approving needs a concise package: the plan version, identified initial state, reference backup, results of both paths and a list of open limitations. State the conditions for interruption and the role authorised to resume. Accepting rehearsals and authorising production execution are separate decisions. AI should not infer the second merely because the first is complete.

The principles of human approval for AI actions (in Polish) help connect consent to a particular operation and scope. For a migration, it must be clear which database, version and moment the decision covers. A changed connection target or script correction after approval needs to be assessed against the acceptance conditions again. Neither is automatically covered by an earlier “yes”.

If a preview of planned changes was prepared without a write, keep its result as separate evidence. It shows intent for a particular input, not proof that migration or restoration works. After a script change, return to the relevant part of the rehearsal. That way a good plan review does not accidentally replace a missing execution.

In the follow-up plan, record who will check the first use of the new representation and when maintaining the old representation may end. Do not remove the reference point merely because the first screen opened. An agreed confirmation period and scope, appropriate to the process, are needed. Keeping a backup should not mean unlimited data access; establish storage rules separately.

Aeneia Audit can help organise operational acceptance of AI-prepared work: boundaries, responsibility, rehearsal and quality of evidence. Review of the database engine itself and specialist migration decisions require the appropriate expertise and an agreed scope.

Aeneia Audit

Establish what evidence of change and restoration should precede acceptance of a migration prepared with an AI agent's help. Discuss acceptance conditions for a database change

Primary sources were checked on 30 October 2026. The deadline example is fictional. The described migration was not run, no production backup was retrieved and no operation was performed on a client's system.

Aeneia / Aeneia editorial

Editorial article. Source links are included in the text.

About Aeneia

Brands we have worked with

  • L’Oréal
  • Garnier
  • Netflix
  • Carrefour
  • Warner Bros. Discovery
  • Biedronka
  • HBO Max
  • Wolt
  • Żabka
  • COSRX
  • Embassy of China in Poland
  • Mixa
Aeneia / Initium

From knowledge to a decision

Tell us what you want to put in order. We will agree on where to start.

Contact Aeneia

We partner with and use solutions from:

  • Google
  • OpenAI
  • Microsoft
  • Stripe
  • Anthropic
  • Linear