Empty a relational database schema

前端 未结 2 768
后悔当初
后悔当初 2021-01-12 15:14

I have a database which I have backed up . Now i am trying to delete all the content from the original db and restore it to it\'s empty state. since it\'s a relational db it

2条回答
  •  孤城傲影
    2021-01-12 15:56

    You could temporarily drop or disable all constraints, truncate all tables, and then restore the constraints. I've taken this approach for SQL Server and it works fine.

    http://lists.mysql.com/mysql/194954

    Perhaps an even better approach would be to reverse out the schema into scripts (which you put under version control) and then recreate the database from scratch.

提交回复
热议问题