phinx icon indicating copy to clipboard operation
phinx copied to clipboard

New feature : Make Phinx work with Oracle

Open Yopai opened this issue 10 months ago • 0 comments

Context: I'm working on a project (moreover in PHP7, and if you ask : migration to PHP8 is planned) with an Oracle database. I found phinx as an interesting migration library.

But it doesn't handle PDO Oci.

Feature requested: Phinx should be able to use a PDO OCI connection to address Oracle specificities.

As I need it, I wrote a simplified wrapper for it (only handles the "migration table" part for now), and will push it in a PR.

I thought it would be pretty straightforward, however I encountered unexpected issues. To deal with certain Oracle specificities, I've been forced to override and rewrite entire methods (migrated, getVersionLog), that is not very DRY.

Objective: This issue is here to list Oracle's specificities, and discuss on how improvements of Phinx could reduce this code-copying.

As far as I am concerned :

  • Oracle is not able to deal with a simple string, even ISO-formatted, as date. So, use of dates (notably, migrated method) should be able to be overriden to use TO_DATE as SQL. see #2341
  • Oracle handle case of table columns with a "all-in-caps by default" rule. so SELECT version will lead, when fetched, to an array whose keys are VERSION (in uppercase). see #2345

This list is not exhaustive; the further I go into implementing the OCI Adapter, the more specificities I will probably find.

Yopai avatar Mar 10 '25 08:03 Yopai