0

I'm creating an API for POIs and use the POINT-Type to store the coordinates.

As my company uses CakePHP I have to write a migration-script with Phinx.

But I don't have any Idea how to correctly create a column with the POINT-Type.

Sure, I just could make an "ALTER TABLE ..." in a handwritten Query, but maybe there is a better way?


Versions:

  • Cake: 3.4.7
  • Phinx: 0.6.5
  • MySQL: 5.7.18
Dennis Richter
  • 522
  • 6
  • 16

2 Answers2

0

Phinx Does not provide an adapter for POINT yet.

You should create your query manually.

See also Unable to seed data with POINT datatype #999

Rayann Nayran
  • 1,135
  • 7
  • 15
  • I've already seen this question, but thought it is somewhat unrelated because its inserting data into an already existing database. ||| Thanks for your quick reply. – Dennis Richter May 26 '17 at 12:55
  • Yeah, I saw this point, but I attached the link just to complement. – Rayann Nayran May 26 '17 at 13:10
  • 3
    @DennisRichter 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. – ndm May 26 '17 at 13:15
0

Just use "point" as you would use any other datatype as the second parameter of addColumn(). It's just not documented yet.


Credits for this solution are going to @ndm; I just think it's worth putting this as answer instead as a comment.

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

Dennis Richter
  • 522
  • 6
  • 16