我正在考虑创建一个phalcon迁移,该迁移将从数据库中的表中删除一些列,但是我正在努力了解我们如何删除这些列,而文档似乎并未引用如何执行此操作?
这是在以前的迁移中如何将列添加到数据库中。
new Column(
'automatic_adjust_status',
[
'type' => Column::TYPE_VARCHAR,
'size' => 255,
'after' => 'manual_price'
]
),
new Column(
'automatic_adjust_amount',
[
'type' => Column::TYPE_VARCHAR,
'size' => 255,
'after' => 'automatic_adjust_status'
]
),
new Column(
'automatic_adjust_type',
[
'type' => Column::TYPE_VARCHAR,
'size' => 255,
'after' => 'automatic_adjust_amount'
]
),
new Column(
'automatic_adjust_after',
[
'type' => Column::TYPE_VARCHAR,
'size' => 255,
'after' => 'automatic_adjust_type'
]
),
如果有人可以建议我如何删除这些列,那就太好了:)
答案 0 :(得分:1)
设法对它进行排序:)这是代码:
https://docs.phalcon.io/3.4/en/db-layer#altering-tables
$this->getConnection()->dropColumn(
'lists',
$this->db,
'automatic_adjust_status'
);
$this->getConnection()->dropColumn(
'lists',
$this->db,
'automatic_adjust_amount'
);
$this->getConnection()->dropColumn(
'lists',
$this->db,
'automatic_adjust_type'
);
$this->getConnection()->dropColumn(
'lists',
$this->db,
'automatic_adjust_after'
);