0

I have 2 DB instances running on dev and prod.

In dev I have created a table students with the following schema

create table students (name varchar(20), age int, place varchar(100));

I created the same DB in prod using the above dev schema.

Now I have changed dev schema 3 times

alter table students modify name varchar(50);

alter table students modify name varchar(100);

alter table students modify name varchar(150);

once the dev DB is stable, I want to apply these changes to prod.
since all the changes I made in dev is only on one field, there is no need to apply 3 alter commands in prod. Instead, I need to apply only the 3rd alter command in prod.

Is there any tool available to apply only required changes?

din_oops
  • 698
  • 1
  • 9
  • 27
  • Please provide more information like "Which tools you are using to apply the schema changes"? – Sandesh Jain May 06 '19 at 10:31
  • i am not using any tools yet. i am searching for the best tool for these kind of database schema changes. @SandeshJain – din_oops May 06 '19 at 10:34
  • You can use SQL Yog or MySql workbench to connect multiple database and transfer/migrate database. My favorite is SQLYog....supports most of DBs – Mangesh Sathe May 06 '19 at 11:46
  • actually, my requirement is to find the schema changes and apply them in another db. @MangeshSathe – din_oops May 06 '19 at 11:49
  • Create DDL trigger to track all model changes with login names, dates, object name, modification statement and all other things you could need – Mangesh Sathe May 06 '19 at 11:52
  • If you were to use Liquibase, Liquibase would not be able to do this automatically. You would need to add more information to the changelog. In general, any tool that uses 'migrations' will be similar. Any tool that uses 'diffs' to create migrations scripts "on the fly" will be able to do this, but diff-based database migrations have their own issues. Here are some articles discussing the tradeoffs: https://dotnetvibes.com/2018/04/16/database-delivery-state-based-vs-migration-based/ https://dev.to/pesse/one-does-not-simply-update-a-database--migration-based-database-development-527d – SteveDonie May 06 '19 at 16:32

0 Answers0