Skip to main content

No Hand-Written Migrations: How Fullfinity Handles Schema Changes

Hand-written database migrations are one of the biggest hidden costs in ERP development. Learn how Fullfinity derives the schema from your models, records the changes that need a decision, and what that means for your team.

No Hand-Written Migrations: How Fullfinity Handles Schema Changes

If you've ever managed a production ERP deployment, you know the feeling. It's late. You're pushing a schema change to a live system. You've tested it three times in staging, but staging is never quite production. And somewhere buried in the migration history is a file from eight months ago that someone wrote, merged, and nobody fully understands anymore.

Database migrations are supposed to be a solved problem. In practice, they're one of the most consistent sources of deployment anxiety, production downtime, and developer friction in ERP projects. Fullfinity was built to take most of that problem away at the architectural level.

Why Migration Files Become a Liability Over Time

Most developers accept migration files as just part of the job. Write a model change, generate a migration, commit it, run it in production. It seems fine for a while.

But ERP systems aren't typical web apps. They have dozens of interrelated modules. Multiple developers touching the same models. Businesses that customize the schema for their own workflows. Over time, the migration history becomes a long chain of interdependent files that you can't easily modify, can't safely reorder, and can't always understand without context.

Here's what actually happens in practice:

  • Migration conflicts pile up when two developers modify the same model in separate branches. Resolving them is tedious and error-prone.
  • Squashing migrations is theoretically possible but rarely clean. You always lose some history, and it breaks setups that haven't run every migration in sequence.
  • Custom module migrations can conflict with core module migrations in ways that are nearly impossible to debug without reading through hundreds of lines of auto-generated SQL.
  • Deployment windows get longer because running migrations on large tables blocks reads and writes. A column addition on a table with millions of rows can mean real downtime.

None of this is unique to any one framework. It's an inherent property of hand-written migration management. The files accumulate. The system gets harder to reason about. And every new developer has to load a mental model of "what state is the database supposed to be in" before they can make confident changes.

What "No Hand-Written Migrations" Actually Means

This is worth being precise about because it's easy to misunderstand.

It doesn't mean Fullfinity ignores schema changes, and it doesn't mean there is no record of them. It means you don't author migrations for ordinary changes. The schema is derived from the models. The models are the source of truth.

Schema changes fall into two kinds:

  • Additive changes need nothing from you. A new field, model, index or table is found by comparing the models with the database when it is upgraded. The system adds what is missing and backfills existing rows from the field's default or calculation.
  • Changes that need a decision are recorded with one command. Renaming, removing or retyping a field can't be inferred safely, so resolve asks what happened and writes an entry to the module's change ledger, a schema_changes.yaml file that lives inside the module, along with an updated schema snapshot. Both files are committed with the code. You answer a question, and the tool writes the entry.

Nothing is applied when the application starts. A database changes only when someone runs upgrade against it, so the upgrade is a visible, deliberate step in every deployment, and it's one command rather than a queue of files.

How the System Makes This Safe

The obvious concern with automatic schema management is safety. If the system is applying schema changes for you, what stops it from doing something destructive?

Additive changes are applied automatically. Adding a new column, a new index, a new table. These are safe by definition. Nothing that already works can break from them.

The diff never drops anything. If a field simply disappears from the code, its column stays where it is. A column is dropped only when its removal has been recorded as a delete.

The build refuses an unrecorded breaking change. A schema check fails on any rename, removal or type change that hasn't been recorded, so one can't ship by accident. That's also what makes renames safe: recorded as a rename, the upgrade copies the old column's data to the new one before dropping the old.

Complex transforms are code you review. A type change that needs its data converted is recorded as a complex change with a small transform hook, and the check refuses the entry until it has a fixture test.

Every upgrade is one transaction. New columns, replayed ledger entries and transforms commit together or roll back together, so a failure never leaves a half-migrated database.

The result is a system where the common case, adding fields, adding tables, modifying indexes, just works without a migration file. And the dangerous cases, dropping columns with live data, changing types in breaking ways, still require a deliberate decision that is recorded once and replayed everywhere.

The Real Cost of Migration Management in ERP Projects

When I talk to developers who've implemented or customized a traditional ERP like SAP, one thing that comes up consistently is time. Not just the time to write migrations, but the time to manage them across environments.

Think about a typical ERP implementation project. You have:

  • A development environment where developers are actively building
  • A staging environment for testing
  • A production environment running live business data
  • Possibly a UAT environment that clients are using

Every schema change has to flow through all of these. Someone has to make sure the migrations are applied in the right order in each environment. Someone has to handle the cases where a client's staging environment is two weeks behind because nobody ran migrations after the last sprint. Someone has to deal with the support ticket that comes in at 3pm on a Friday because a migration that worked in dev fails in production due to a data constraint that only exists in the real database.

None of this is glamorous work. It's friction. And it accumulates across every sprint, every module, every deployment.

With derived schema management, most of this shrinks. Every environment replays the same recorded changes in the same order, and each database keeps its own record of which changes it has applied, so a staging environment that is two weeks behind simply catches up on its next upgrade. Upgrading is still a step in every deployment, but it's one command with nothing to hand-order.

For ERP implementation consultants specifically, this matters a lot. A significant portion of implementation work is managing environments and ensuring consistency. Reducing that overhead directly translates to faster project delivery and fewer support issues post-launch.

Extending the Schema in Custom Modules

One of the more interesting implications of not hand-writing migrations is what it does for extensibility.

In a traditional ERP setup, if you want to add fields to a core module's model, you have to write a migration that modifies the core table. That migration has to be coordinated with the core module's migration history. It creates a dependency that can cause real problems when you upgrade the core module later.

Fullfinity's approach is different. Because the schema is derived from the models, and because the model inheritance system is designed to be truly extensible, you can add fields in a custom module simply by extending the base model. The next upgrade adds the columns. No migration files. Your module's ledger is its own, and its entries replay after those of the modules it depends on, so a field of yours can follow a core table that gets renamed.

Core changes can still affect you, and you hear about them before they do. preview --db lists every reference in your installed custom modules that a new version would break, linked to the recorded change that caused it, and an upgrade that fails rolls back as a whole.

This is a significant practical benefit for consultants and developers building client-specific customizations. You extend the model in your module, you define your fields, and they appear in the database on the next upgrade. When you need to remove a customization, you remove it from the model and record the removal with resolve. The next upgrade drops the column.

It's also why the modular architecture and the schema management are deeply connected. You can install or uninstall modules independently: installing a module adds its tables and columns, and uninstalling it drops what it brought.

What This Means for Deployments

Deployment pipelines for ERP systems are often more complex than they need to be, largely because of migration management. A typical deployment script might look something like:

  1. Pull new code
  2. Stop the application server
  3. Run database migrations
  4. Verify migrations completed successfully
  5. Restart the application server
  6. Verify the application is healthy

Steps 3 and 4 are where things go wrong. Long-running migrations on large tables can mean your application is down for minutes or longer. A migration that fails halfway through can leave the database in an inconsistent state. Rolling back is painful.

With Fullfinity, the database step is one command, and a safer one. upgrade applies additive changes and replays recorded ones in a single transaction, so a failure leaves the database exactly as it was. The usual order is to run the upgrade, then restart the application on the new code. Open browser tabs keep working against the old server until it's replaced, then reload onto the new one.

This makes frequent deployment more practical for ERP systems. Most releases add fields and tables, and adding columns is quick. The operations that touch every row, a rename's data copy or a type change on a very large table, are the ones to plan a window for.

For freelancers managing multiple client deployments, this is particularly valuable. Keeping a dozen client environments up to date and consistent is hard when every update requires manual migration management. One command can upgrade every database a deployment owns, each in its own transaction, and report which passed.

Common Objections and Honest Answers

"I want to control exactly what SQL runs in production."

This is a legitimate concern, and it's worth being direct about it. You're not flying blind: preview prints the changelog of every recorded change in a release, renames and removals are entries you can read in the ledger, and complex transforms are code you write and review. What you give up is hand-writing the SQL for additive changes. For most teams, that's a good trade. For teams with very specific database compliance requirements, it's worth evaluating carefully.

"What about large table alterations that need special handling?"

Adding columns to large PostgreSQL tables is actually faster than most people expect. Type changes on tables with hundreds of millions of rows need careful handling in any system. Fullfinity never applies them automatically: a type change is recorded as a complex change, and its transform hook is where you choose a batched or online strategy.

"We need a migration history for audit purposes."

Schema change auditing is a real requirement in some regulated industries, and there is a formal history. Every rename, removal and transform is a numbered entry in the module's ledger, committed to version control alongside the model change that caused it. Each database records which entries it has applied and refuses to run code older than its own history, and the changelog for a release is generated from the same ledger.

The Bigger Picture: Less Time on Infrastructure, More on the Business

There's a theme running through everything above. Time.

Migration management is an infrastructure concern. It's not what your developers should be spending most of their time on. It's not what your consultants should be spending client hours on. It's maintenance overhead that exists because most ERP systems were designed before better approaches were available.

Fullfinity's position is that the ORM should handle schema management so your team can focus on building the features and workflows that actually create value. The modular architecture means you're only working with the modules relevant to your use case. Derived schema management means adding to a model just works, and changing one takes a single recorded decision. The extensible design means customizations don't create long-term maintenance debt.

This isn't about making things easy in a superficial way. It's about eliminating a category of work that doesn't need to exist.

Conclusion

Database migration management is one of those problems that developers accept as inevitable. It doesn't have to be.

Deriving the schema from the models is a real architectural decision with real tradeoffs, and it's worth understanding those tradeoffs before you commit to it. But for most ERP implementations, the benefits are concrete:

  • Faster deployments with fewer failure modes
  • Less coordination overhead across environments and team members
  • Cleaner extensibility for custom modules and client-specific customizations

If you're evaluating ERP platforms and migration management is a pain point in your current setup, this is worth looking at seriously. Explore the full platform to see how the schema management approach fits into the broader architecture, including the access-aware ORM, the async runtime, and the module system.

The goal is an ERP that gets out of your way. Hand-written migration files are one less thing to think about.

More articles

View all →