Database Migration Scripts for Reversible Schema Changes

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Traditional database development methods face challenges in reverting to older definitions after new changes are made, especially when multiple developers work simultaneously, leading to conflicts and inefficiencies in testing and deployment.

Innovation Solution

An external repository is introduced with a development mode that allows developers to create migrations from a base version, enabling easy testing and version control, ensuring that changes can be reverted and combined without affecting actual database data, and using a specialized file format to store definitions and migrations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If a developer submits a new version of a definition that is later discovered to be undesirable, then the database data structures are modified to be consistent with the new definition, but it becomes impossible for the developer to return to the older version of the definition

Engineering Contradiction:
Improvespeed of applying definition changesVSAvoidability to revert to older definition version
Core Design Contradiction:
ProductivityVSEase of repair

Solution Approach 1:

The system creates a migration script before actually applying the definition change to the database. This migration script serves as a preliminary action that can be reviewed, tested, and potentially reverted if the new definition proves undesirable. The migration script captures the intended transformation in a reversible manner.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system creates a copy of the definition change in the form of a migration script that stores the transformation logic. This copy allows the developer to review the changes before applying them and to revert by reapplying the inverse migration if needed, without directly modifying the database structure in an irreversible manner.

Inventive Principle:
Principle #26Copying

2Adaptability or versatility

If multiple developers simultaneously provide new versions of a definition, then each developer's changes need to be reconciled, but the automated tool is unable to reconcile changes from two different developers simultaneously

Engineering Contradiction:
Improvesupport for multiple developers working simultaneouslyVSAvoidconflict resolution complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The system segments the definition management process into individual migration scripts for each developer. Each developer works with their own migration script that captures their specific changes. This segmentation allows changes to be applied sequentially and independently, avoiding direct conflicts between simultaneous edits.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system introduces an intermediary migration script that serves as a mediator between multiple developers' changes. The migration script acts as an intermediate representation that can be reviewed, tested, and applied in a controlled manner, allowing conflict resolution through structured processes rather than direct merging of simultaneous edits.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Ease of manufacture

If developers test new database definitions in the traditional approach, then changes are made directly to the database, but this affects actual database data and makes testing risky

Engineering Contradiction:
Improveease of testing new definitionsVSAvoidsafety of production data during testing
Core Design Contradiction:
Ease of manufactureVSReliability

Solution Approach 1:

The system creates a copy of the database structure through migration scripts that represent the intended changes. Developers can test these migration scripts and definition changes in a controlled environment or on copies of the data, without directly modifying the production database. This allows safe testing while preserving the integrity of actual database data.

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The system requires that definition changes be prepared as migration scripts before being applied to the database. This preliminary action allows developers to review, test, and validate the changes in advance, ensuring that only verified and safe changes are applied to production data, thereby protecting the reliability of actual database data.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS11163733B2Deployment of automated migrations for database tables
Publication Date: 2021.11.02 SAP SE
  • US11163733B2 patent drawing
  • US11163733B2 patent drawing
  • US11163733B2 patent drawing

AI summary

In an example embodiment, a new development infrastructure is provided that provides an external repository for database definitions. The development infrastructure also then includes a development mode. When using the development mode, the behavior of the development infrastructure is modified to better fit the development of database artifacts. The developer uses a development base version of a definition (usually the latest released version of the definition) but also creates migrations that indicate how the development base version should be modified to arrive at the developer's intended new definition. While still in development mode, the deployment may be run, which causes data in the development mode that uses the old definition to be dropped and replaced by the base version. The development mode then executes the specified migrations.