简体   繁体   中英

Effective way to check table name when db schema change?

I have think this question few month for my .NET project (winform & webform) or PHP project.

I use Visual Studio 2010 Pro for .NET project and PDT for PHP Project.

Maybe the best way is convert the project to ORM (L2S,EF, PHP ActiveRecord etc) instead of classic SQL statement, however, SQL still quite worth to use, at less every new comer know that on my work place.

I Had to search in google to find any exist plugin or software to do a reflection, but it seem not existing.

So how do you find out which files have to make change when the database schema is change (table name, varchar length, datatype etc)?

Or just search & replace?

Search and Replace is one possibility.

Another would be to store the table name in constant values and work thim them, instead of putting the table name as plain text into the SQL file.

A third solution, and maybe the best is to use MyBatis (former Ibatis) which stores the SQLs in an external XML file where you can update it at one places, instead of sprankling the SQL code in various files.

http://www.mybatis.org/

Why just don't save the current schema somewhere and compare it with
http://dev.mysql.com/doc/refman/5.0/en/describe.html

DESCRIBE table;

?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM