File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,58 @@ Phinx 使用迁移脚本来管理数据库。 每个迁移脚本都是一个 PHP
88
99让我们从创建一个新的 Phinx 迁移脚本开始。使用 ` create ` 命令:
1010
11+ ```
12+ $ php vendor/bin/phinx create MyNewMigration
13+ ```
14+
15+ 这将创建一个新的迁移脚本,格式是 ` YYYYMMDDHHMMSS_my_new_migration.php ` ,前14个字符是当前的timestamp,精确到秒。
16+
17+
18+
19+ 如果你指定了多个脚本路径,将会提示你选择哪一个。
20+
21+
22+
23+ Phinx 自动创建的迁移脚本框架有一个方法:
24+
25+
26+
27+ ```
28+ <?php
29+
30+ use Phinx\Migration\AbstractMigration;
31+
32+ class MyNewMigration extends AbstractMigration
33+ {
34+ /**
35+ * Change Method.
36+ *
37+ * Write your reversible migrations using this method.
38+ *
39+ * More information on writing migrations is available here:
40+ * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
41+ *
42+ * The following commands can be used in this method and Phinx will
43+ * automatically reverse them when rolling back:
44+ *
45+ * createTable
46+ * renameTable
47+ * addColumn
48+ * renameColumn
49+ * addIndex
50+ * addForeignKey
51+ *
52+ * Remember to call "create()" or "update()" and NOT "save()" when working
53+ * with the Table class.
54+ */
55+ public function change()
56+ {
57+
58+ }
59+ }
60+ ```
61+
62+
63+
64+
65+
You can’t perform that action at this time.
0 commit comments