Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test whether DB migration result are consistent with (ORM)? models

I am using migrate to create SQL database schema and populate it with initial data. Later SQLAlchemy is used to work with this DB.

How could I test that my SQLAlchemy models are relevant/correct for real DB schema generated by migrate?

like image 861
Roman Bodnarchuk Avatar asked Mar 27 '14 12:03

Roman Bodnarchuk


People also ask

What is a ORM migration?

Migrations are a type of version control for your database. They allow a team to modify the database schema and stay up to date on the current schema state. Migrations are typically paired with the Schema Builder to easily manage your database's schema. Note.

Can the database be migrated if yes explain the process?

The process of database migration can involve multiple phases and iterations, including assessing the current databases and future needs of the company, migrating the schema, and normalizing and moving the data. Plus, testing, testing, and more testing.


1 Answers

I didn't test it, but in the features list, this tool seems to do want you want:

http://metacpan.org/pod/SQL::Translator::Manual

*FINDING THE DIFFERENCES BETWEEN TWO SCHEMAS As mentioned above, the "sqlt-diff" schema examines two schemas and creates SQL schema modification statements that can be used to transform the first schema into the second. The flag syntax is somewhat quirky:

$ sqlt-diff foo-v1.sql=MySQL foo-v2.sql=Oracle > diff.sql*

main tool page: http://sqlfairy.sourceforge.net/

like image 143
Nelson Teixeira Avatar answered Oct 04 '22 13:10

Nelson Teixeira