Skip to content
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

Syntax errors in file /com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql #8788

Merged
merged 2 commits into from
Dec 26, 2015

Conversation

wojsmol
Copy link
Contributor

@wojsmol wojsmol commented Dec 26, 2015

PR for issue #8786
Original issue description

IMHO file https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql contains MySQL syntax errors :
is

ALTER TABLE `#__redirect_links` ADD header smallint(3) NOT NULL DEFAULT 301;
ALTER TABLE `#__redirect_links` MODIFY new_url varchar(255);

should be

ALTER TABLE `#__redirect_links` ADD `header` smallint(3) NOT NULL DEFAULT 301;
ALTER TABLE `#__redirect_links` MODIFY `new_url` varchar(255);

related: #6333

PR fot issue  joomla#8786
Original issue description
>IMHO file https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql contains MySQL syntax errors :
>is
>````SQL
>ALTER TABLE `#__redirect_links` ADD header smallint(3) NOT NULL DEFAULT 301;
>ALTER TABLE `#__redirect_links` MODIFY new_url varchar(255);
>````
>should be
>````sql
>ALTER TABLE `#__redirect_links` ADD `header` smallint(3) NOT NULL DEFAULT 301;
>ALTER TABLE `#__redirect_links` MODIFY `new_url` varchar(255);
>````
>related: joomla#6333
@wojsmol
Copy link
Contributor Author

wojsmol commented Dec 26, 2015

Travis returns errors, but from what I see they are not related to this PR.

@wojsmol
Copy link
Contributor Author

wojsmol commented Dec 26, 2015

Additionaly see #6333 (comment)

@Bakual
Copy link
Contributor

Bakual commented Dec 26, 2015

Did you get a MySQL error while updating from a version before 3.4.0? To my knowledge, the SQL commands work fine and apparently nobody had a problem since we released 3.4.0.

@ggppdk
Copy link
Contributor

ggppdk commented Dec 26, 2015

I had to run the query manually in the past

ALTER TABLE `#__redirect_links` ADD header smallint(3) NOT NULL DEFAULT 301;

About this fix,

  • i tested it has the same effect as fixing JSchemaChangeitemMysql to detect "ADD columnname"
    After changing the SQL file, the Database view (extension manager) reported the missing column, and Fix button worked

I manually deleted the header column from the redirect_links

Without Fix:
without_fix

With change in the SQL file, missing column is detected
missing_column_detected

and notice that now the reported DB changes are 80 instead of 79:
fix_button_worked

wilsonge added a commit that referenced this pull request Dec 26, 2015
Syntax errors in file /com_admin/sql/updates/mysql/3.4.0-2014-09-16.sql
@wilsonge wilsonge merged commit 7848324 into joomla:staging Dec 26, 2015
@wilsonge
Copy link
Contributor

Merged on review. Whilst not everyone seemed to hit this - the syntax in here is definitely more correct in terms of escaping the column names. And the column thing definitely is required for the schema here https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/schema/changeitem/mysql.php#L66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants