

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Methods for tracking database schema changes in MySQL?
Whenever a table is present in a project with a single database, we can do database schema changes using schema version or migration. It aims to keep track of database schema changes or structural changes.
The table creation to keep track of schema changes.
mysql> create table SchemaDatabaseMethodDemo -> ( -> `WhenTime` timestamp not null default CURRENT_TIMESTAMP, -> `TheKey` varchar(200) not null, -> `Version` varchar(200), -> primary key(`TheKey`) -> )ENGINE=InnoDB; Query OK, 0 rows affected (0.45 sec)
Inserting records into the table.
mysql> insert into SchemaDatabaseMethodDemo values(now(),'1001','version 5.6.12'); Query OK, 1 row affected (0.17 sec)
To display records.
mysql> select *from SchemaDatabaseMethodDemo;
The following is the output.
+---------------------+--------+----------------+ | WhenTime | TheKey | Version | +---------------------+--------+----------------+ | 2018-10-29 14:21:47 | 1001 | version 5.6.12 | +---------------------+--------+----------------+ 1 row in set (0.00 sec)
Note − Suppose we are executing a SQL script or migration then we need to add a row in the above table as well with the help of the INSERT statement at the beginning or end of the scripts.
- Related Questions & Answers
- Difference between Schema and Database in MySQL?
- What are some good tools to visualize MySQL database schema?
- Different schema types in SAP HANA database
- Checking schema creation in SAP HANA database
- Changing Ownership of schema in SAP HANA Database
- How do I show the schema of a table in a MySQL database?
- Checking tables in a schema in SAP HANA database
- How changes, made in the current transaction, can be permanently recorded in MySQL database?
- How changes, made in the current transaction, can be permanently eliminated from MySQL database?
- Know about device tracking for smart phones
- Satellite Tracking
- Error: "invalid schema name" even if schema is present in the database in SAP HANA
- Checking a table inside a schema in SAP HANA database
- Quickly search for a string in MySQL database?
- MySQL database field type for search query?
Advertisements