更新时间:2023-12-01 09:22:22
在 Yii 中完成此操作的说明:
Instructions for accomplishing this in Yii:
将您的数据库连接设置添加到 protected/config/console.php
.
运行 yiic migrate create initial
以创建迁移的存根代码.
Run yiic migrate create initial
to create the stub code for the migration.
将本要点的内容复制到protected/commands/InitialDbMigrationCommand.php
.
运行 yiic initialdbmigration 'name_of_your_database' >initial_migration.php
生成用于初始数据库迁移的 up()
和 down()
方法.
Run yiic initialdbmigration 'name_of_your_database' > initial_migration.php
to generate up()
and down()
methods for initial database migration.
将 up()
和 down()
方法从 initial_migration.php
复制并粘贴到 中创建的文件中>protected/migrations
文件夹在第 2 步中.
Copy and paste up()
and down()
methods from initial_migration.php
to the file created in the protected/migrations
folder in step 2.