cakephp / cakephp/phinx

Handle dates specifically

Open
#2,341 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
4.5k
Forks
884
PR merge metrics
No merged PRs in 30d

Description

Hi,

=== Context
Phinx :) for this work.

I'm writing an Adapter for PDO-OCI.

I'm getting blocked by some things that should be fixed in.

=== Observed behaviour
The PDOAdapter generates the query with date formatted as string. Oracle generates an ORA-01843 error (invalid month).
Setting NLS_DATE_FORMAT has no effect (it may be related to the Oracle version)

== Proposed behaviour
As done for boolean, use a "castDate" method. Which would, for others, use the string as is. And could be overriden in OCIAdapter to encapsulate the string in a "TO_DATE".

Another way to do it, probably better, would be used parametrized queries.

(For now, I have overriden the migrated method in OCI-Adapter, I will push a PR when I'll find some time)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PDOAdapter migrated method and compare the existing boolean handling with the proposed date-specific behavior; then inspect the OCIAdapter override point. Reproduce the Oracle invalid-month case and verify that date migrations work through PDO-OCI without breaking other adapters.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.