php-activerecord / activerecord

PHP ActiveRecord Project
Other
33 stars 10 forks source link

Mixed-case column names causing trouble on postgresql #64

Closed shmax closed 1 year ago

shmax commented 1 year ago

This is partly my fault, as I accidentally broke the functionality of DatabaseTestCase during one of my recent cleanup blitzkriegs.

To fix the intended test behavior, go into DatabaseTestCase and make this change:

$connection_name ??= $config->get_default_connection();
$config->set_default_connection($connection_name); // <--add this line

and then in RelationTest.php, make this change:

    public function setUp(string $connection_name = null): void
    {
        parent::setUp("pgsql");
    }

Then run the tests on that class.

The result is that any tests involving mixedCaseField break, because once a column name is double-quoted in PostgresQl, you have to continue double-quoting it forever in your sql statements.

I'm going to assign this to @ipundit to figure out, but if I don't hear from him in a week or so I'm going to revert the mixed-case changes from a few weeks ago.

shmax commented 1 year ago

Note that I've since fixed the issue with DatabaseTestCase, so all you have to do now to repro is override setUp.

ipundit commented 1 year ago

Working on PR #69 first before starting this task.

shmax commented 1 year ago

Sounds good, thanks for updating.

shmax commented 1 year ago

Some issues fixed by @ipundit , and others fixed by me in https://github.com/php-activerecord/activerecord/pull/88

Thanks much.