How to import a mysql dump while renaming some tables/columns and not importing others at all?

前端 未结 2 1152
执念已碎
执念已碎 2021-01-06 23:10

I\'m importing a legacy db to a new version of our program, and I\'m wondering if there\'s a way to not import some columns/tables from the dump, and rename other tables/col

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-06 23:41

    I'd say import it into a temporary database and do the changes live - possibly applying a pre-built script that does the necessary operations:

    DROP TABLE ....
    DROP TABLE ....
    DROP TABLE ....
    ALTER TABLE ..... DROP column ....
    

    Then copy the finished result into the production database.

    This can be very nicely automated as well.

    It's likely to work out faster and with less problems than finding a tool that edits dumps (or, as so often with these things, trying out five different tools and finding out none works well).

提交回复
热议问题