Top work, Phalcon is a great framework, looking forward to trying out 1.2.0.
I have a question regarding the best way to increment a value in a model (currently using 1.1.0).
I have a table with a count column:
MyTable: | id | count | | 1 | 23 |
I was originally using MySQL as the database and had a custom UPSERT SQL query:
$sql = "INSERT INTO mytable
(id
, count
)
VALUES
($id,1)
ON DUPLICATE KEY
UPDATE count
= count
+ 1";
For a number of reasons I need to migrate to Postgres from MySQL and wondered what is considered to be the best approach now, (Postgres does not support "ON DUPLICATE KEY UPDATE").
Is there an elegant way to achieve this using the Phalcon Model and PDO that will work across databases or would it be more performant to use a Postgres Trigger of some sort?