Migration in DBMS
In an application, It is quite inevitable to have changes on the database. The changes can be on the structure of data or even the data itself.
It is a good idea to apply changes to a database as versioned and reversible set of steps.
A representation of changes to be done the database can be called Migration. Two types of migration are Schema and Data migrations.
Schema Migration
Writing migration files which is versioned is a good approach to handle the schema migration.
Migration files contain the set of queries or commands that would make changes to a database. It can also contain the set of queries to be run in order to reverse the changes made by the migration.
Forward migration will read next migration version and run the steps. Backward migration will read reverse in the current migration version and run the steps.
Data Migration
Data migration is the process of transferring data between storage types, formats, or computer systems. It is a key consideration for any system implementation, upgrade, or consolidation.
Data migration is usually performed programmatically to achieve an automated migration, freeing up human resources from tedious tasks. It is required when organizations or individuals change computer systems or upgrade to new systems, or when systems merge (such as when the organizations that use them undergo a merger or takeover).