Generating migration from existing database in Yii or Laravel

后端 未结 9 904
南方客
南方客 2021-01-31 05:39

I\'m working on a project that has a fairly complex database (150+ tables). In order to be able to maintain changes, I\'ve decided to add migrations, preferably using Yii or Lar

9条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 06:12

    'Doctrine Project' (aka Doctrine) has the ability to create DB migrations for existing DB structures, so you can recreate the existing structure. It can be easily implemented in Symfony, Laravel, also in Yii and many frameworks.

    Sample from:
    http://symfony.com/legacy/doc/doctrine/1_2/en/07-Migrations

    From Database

    If you have an existing database you can build a set of migration classes that will re-create your database by running the following command.

    $ ./symfony doctrine:generate-migrations-db
    

    From Models

    If you have an existing set of models you can build a set of migration classes that will create your database by running the following command.

    $ ./symfony doctrine:generate-migrations-models
    

提交回复
热议问题