开发者

Synchronize two databases with differing levels of normalization

I have two tables. Table A is brand new and relatively normalized. Table B is old and completely breaks all levels of normalization.

I'm creating a brand new system using table A, but table B is still in heavy use by our entire staff until the new system is up and running at which time we'll ma开发者_Python百科ke an assessment on whether or not we're ready to flip the switch.

We use a typical LAMP stack PHP/MySQL. My question is this: How can I customize/make a migration from Table B to Table A? Keep in mind I'm not necessarily worried if the data is diff'd and what not. My concern is the overall structure.

Thanks.


Perhaps you could consider using a VIEW so that you can present the data from Table B in the same structure as Table A. Then switchover would be as simple as:

CREATE TABLE new_table_a LIKE table_a;
INSERT INTO new_table_a SELECT * FROM table_a;
DROP VIEW table_a;
ALTER TABLE new_table_a RENAME table_a;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜