Enabled conversion of existing db and tables to utf8_general_ci [M->N]
While upgrading from Mitaka to Newton, the db-collation-alter playbook attempts to convert the existing db and tables to utf8_general_ci but fails. The reason for this was because the FOREIGN_KEY_CHECKS variable in the playbook was being set/reset only for a particular session (i.e. a play) and once the play got over the variable was again reset to its default value(i.e. 1). This patch ensures that the foreign key checks are indeed disabled throughout the playbook by setting the global variable instead of the local one. Change-Id: Ifed6279fcb5f418c1e1a348739bcd50ade42464f Closes-Bug: #1621983
This commit is contained in:
parent
1083dc9a7f
commit
3978647e7e
@ -26,22 +26,22 @@
|
||||
WHERE CCSA.collation_name = T.table_collation AND CCSA.CHARACTER_SET_NAME = 'utf8'
|
||||
AND CCSA.COLLATION_NAME = 'utf8_unicode_ci';"
|
||||
register: utf8_unicode_ci_tables
|
||||
- name: Disable foreign key checks
|
||||
- name: Disable global foreign key checks
|
||||
command: >
|
||||
mysql -e
|
||||
"SET foreign_key_checks = 0;"
|
||||
"SET GLOBAL FOREIGN_KEY_CHECKS = 0;"
|
||||
when: utf8_unicode_ci_tables.stdout_lines | length > 0
|
||||
- name: Convert tables to utf8_general_ci collation
|
||||
command: >
|
||||
mysql -e
|
||||
mysql -e
|
||||
"ALTER TABLE {{ item.split()[1] }} CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;"
|
||||
{{ item.split()[0] }}
|
||||
with_items: "{{ utf8_unicode_ci_tables.stdout_lines }}"
|
||||
when: item | search("^(?!table_schema)\w+\t\w+$")
|
||||
- name: Enable foreign key checks
|
||||
- name: Enable global foreign key checks
|
||||
command: >
|
||||
mysql -e
|
||||
"SET foreign_key_checks = 1;"
|
||||
"SET GLOBAL FOREIGN_KEY_CHECKS = 1;"
|
||||
when: utf8_unicode_ci_tables.stdout_lines | length > 0
|
||||
- name: Find databases with utf8_unicode_ci collation
|
||||
command: >
|
||||
|
Loading…
x
Reference in New Issue
Block a user