cakephp / cakephp/phinx

Fatal error when checking if log table exists, after renamed it in the configuration file

Open
#1,142 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

After renamed the log table name in the configuration file, I get a fatal error while applying migrations:

Fatal error: Uncaught InvalidArgumentException: There was a problem creating the schema table: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'phinxlog' already exist

I solved this issue modifying the hasTable() method in the MysqlAdapter. I attach a patch of what I have changed... The logic is different, but it is useful to workaround the bug. It would be great if you agree to apply to the main codebase.

MysqlAdapter_patch.txt

Thank you,
Flavio

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 MysqlAdapter hasTable() method and the attached MysqlAdapter_patch.txt, then reproduce migrations after renaming the log table in the configuration. Done means the adapter checks the configured table correctly without reporting that the old phinxlog table already exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.