在 Phinx 迁移中使用 "Point"-Datatype(在 CakePhp 中)

Using "Point"-Datatype in Phinx-Migration (in CakePhp)

我正在为 POI 创建 API 并使用 POINT-Type 来存储坐标。

由于我的公司使用 CakePHP,我必须使用 Phinx 编写一个迁移脚本。

但我不知道如何正确地创建具有 POINT 类型的列。

当然,我可以在手写查询中做一个 "ALTER TABLE ...",但也许有更好的方法?


版本:

Phinx 还没有为 POINT 提供适配器。

您应该手动创建查询。

另见 Unable to seed data with POINT datatype #999

只需使用 "point",就像使用任何其他数据类型作为 addColumn() 的第二个参数一样。 只是还没有记录。


此解决方案的功劳归于@ndm; 我只是认为值得将其作为答案而不是评论。

Looks like Phinx supports point types for quite some time now (the docs are not up to date)... try to use \Phinx\Db\Adapter\AdapterInterface::PHINX_TYPE_POINT as the type