Download as pdf or txt
Download as pdf or txt
You are on page 1of 70

Schema Migration

Introduction
• A database schema is the structure of a database,
which describes the relationships between the
different tables and fields in the database.
• A database schema change, also known as schema
migration, or simply migration refers to any alteration
to this structure, such as adding a new table,
modifying the data type of a field, or changing the
relationships between tables.
• Database schema changes are typically necessary when
a database needs to be updated to support new
features or functionality, or to improve system
performance or security.
• In some cases, schema changes may also be required
to fix bugs or other issues with the database.
Migrate works between old and New
Scheme
Migrate up
Migrate Down
Schema Changes in RDBMS
Cont’d
• The first time there is a change in the object model,
such as introducing preferredShippingType on the
Customer object, we have to change the object and
change the database table, because without changing
the table the application will be out of sync with the
database.
• When we get errors like ORA-00942: table or view does
not exist or ORA-00904:
"PREFERRED_SHIPPING_TYPE": invalid identifier, we
know we have this problem.
• Typically, a database schema migration has been a
project in itself.
• For deployment of the schema changes, database
change scripts are developed, using diff techniques,
for all the changes in the development database.
Migrations for Green Field Projects
Cont’d
Cont’d
Cont’d
Cont’d
Cont’d
Migrations in Legacy Projects
Cont’d
Schema Changes in a NoSQL Data
Store
Cont’d
Cont’d
Cont’d
Cont’d
Incremental Migration
Cont’d
Cont’d
Cont’d
Migrations in Graph Databases
Changing Aggregate Structure
Polyglot Persistence
Introduction
Beyond NoSQL
XML Databases
• XML Database is used to store huge amount
of information in the XML format.
• As the use of XML is increasing in every field,
it is required to have a secured place to store
the XML documents.
• The data stored in the database can be
queried using Xquery.
• They can handle data which is of any size or
format
Choosing Your Database

You might also like