1

I am trying to install the Craft CMS (Version 4.4.1) on a VM in the Azure Cloud with PostgreSQL 13.9 as managed Azure Service.

The error i'm running into is the following:

*** failed to install Craft: An error occurred while executing the "craft\migrations\Install migration: SQLSTATE[23502]: Not null violation: 7 
ERROR:  null value in column "dateCreated" of relation "info" violates not-null constraint
DETAIL:  Failing row contains (1, 4.4.1, 4.4.0.4, f, jlynfdbhxzhh, junzvyhomsyt, null, null, 0).
The SQL being executed was: 
INSERT INTO "info" ("version", "schemaVersion", "maintenance", "configVersion", "fieldVersion", "id") VALUES ('4.4.1', '4.4.0.4', FALSE, 'jlynfdbhxzhh', 'junzvyhomsyt', 1)

Creation of tables, indexes and foreign keys just works fine. But as soon as the info table is being populated, the installation crashes with the error above.

The local docker setup installs just fine (configured with PostgreSQL too).

Any kind of help is highly appreciated!

2
  • Hrm... locally, were you using PostgreSQL 13.9 as well? The install migration calls Application::saveInfo, which ultimately calls Command::insert, which inserts the dateCreated, dateUpdated and uid column values if they don't exist: github.com/craftcms/cms/blob/develop/src/db/Command.php#L32-L43
    – Brad Bell
    Commented Mar 14, 2023 at 22:48
  • Thank you @BradBell for your insights. When debugging the Commend::insert method, it turns out that the dateCreated checking condition evaluates to false. This is because $this->db->columnExists($table, 'dateCreated') itself evaluates to false. How can that be?
    – Boris
    Commented Mar 15, 2023 at 6:24

1 Answer 1

3

Finally I was able to debug and fix the problem.

The use of a specific schema in the PosgreSQL DB (instead of public) caused the problem. But not the fact itself was problematic, instead the schema was missing in the Postgres search_path.

Fixing the search_path also fixed the problem.

1
  • Ahh... nice debugging and thanks for the follow-up!
    – Brad Bell
    Commented Mar 15, 2023 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.