-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changeColumnSQL not handling new vs changed columns correctly #1010
Comments
Can you please
|
XML before running in db Resulting SQL Added more columns in xml Resulting SQL AFTER adding column in XML MYSQL Table not modified to ADD new columns In Summary, i expect this not this |
Thanks for the details. I'll have a look as time allows. Note: For next time, better paste text (XML, SQL, PHP...) instead of images so I can copy-paste instead of re-type.
I suppose this is the version that has the problem ? You did not indicate which was the older ADOdb version that was working fine. |
First XML
SQL
Updated XML
SQL
|
It looks like a problem with the way that ADODB_DataDict::changeTableSQL() is structured, when it iterates over the columns of an existing table, it doesn't distinguish between columns that already exist and those that don't. This looks like a problem caused by This commit |
Thanks for the analysis @mnewnham, that was on my to-do list for this week-end. Are you planning to work on a fix ? |
@dregad I won't be able to get to it in the next 7 days |
Hi, just a follow up on this issue. Is a there a possible fix being worked on ? |
Hi @ekariz this fell off the radar, I have not looked at it since November last year. I'm definitely not working on it at all, and won't have time to do so in the short term, sorry. |
Indeed 😄 That should have been committed in hotfix/5.22 branch though... I'll back-port it. While retesting, I noticed that I forgot to initialize the $fields_to_add and $fields_to_alter arrays, resultsing in PHP warnings:
Also, I believe there is something wrong with the logic to drop columns when $dropOldFlds is true at the end of the changeTableSQL() method, as the loop refers to an undefined $lines array. Change was introduced by b5732c5. I'll open a separate issue to track this. |
Description
AddColumnSQL function missing for mysql. I cannot add a new column / alter mysql table
Environment
Steps to reproduce
Detailed, step-by-step instructions to reproduce the behavior, including:
$schema = new adoSchema($this->dbconn);
// Post Execution (default)
$schema->executeInline(false);
$schema->parseSchemaFile('schema.xml');
$schema->executeSchema();
if you add a new field in schema.xml , if you execute the datadictionary again , the new column is not added in the db table.
Expected behavior
Adding new column in xml to mysql table
Additional context
This was working with older ADOdb versions
The text was updated successfully, but these errors were encountered: