Can I Import an updated structure into a MySQL table without losing its current content?

后端 未结 6 1571
南旧
南旧 2021-02-08 01:30

We use MySQL tables to which we add new fields from time to time as our product evolves. I\'m looking for a way to export the structure of the table from one copy of the db, to

6条回答
  •  孤独总比滥情好
    2021-02-08 01:56

    What I usually do is store each and every ALTER TABLE statement run on the development table(s), and apply them to the target table(s) whenever necessary.

    There are more sophisticated ways to do this (like structure comparison tools and such), but I find this practice works well. Doing this on a manual step by step basis also helps prevent accidental alteration or destruction of data by structural changes that change a field's type or maximum length.

提交回复
热议问题