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

[MIGRATION] pegasus.forms migrations #22644

Merged
merged 1 commit into from Jun 7, 2018
Merged

[MIGRATION] pegasus.forms migrations #22644

merged 1 commit into from Jun 7, 2018

Conversation

wjordan
Copy link
Contributor

@wjordan wjordan commented May 24, 2018

This PR contains 2 Pegasus migrations affecting the forms table:

  1. Add JSON generated column with secondary index for country-code attribute to improve query performance.
  2. Convert data JSON columns to native JSON data type for optimized performance and storage.
    Requires MySQL >= 5.7.13.

Since this PR depends on #22771, the diff will include those changes until the other PR is merged, so see c1cfab2d68350b75bc7594a3cce92e94014142b6 for the commit containing only this PR's changes. [done]

MySQL DDL generated by these migrations:

# 130.
ALTER TABLE `forms` ADD COLUMN `location_country_code_s` char(2) GENERATED ALWAYS AS (processed_data->>"$.location_country_code_s")
CREATE INDEX `forms_kind_location_country_code_s_index` ON `forms` (`kind`, `location_country_code_s`)

# 131.
ALTER TABLE `forms` CHANGE COLUMN `data` `data` JSON NOT NULL, CHANGE COLUMN `processed_data` `processed_data` JSON NULL

@wjordan wjordan changed the title [WIP] [MIGRATION] pegasus.forms migrations [MIGRATION] pegasus.forms migrations May 30, 2018
This was referenced May 30, 2018
@wjordan
Copy link
Contributor Author

wjordan commented Jun 6, 2018

Currently depends on #22771, which fixes the issue with generated columns being included in the update query in form_helper. [merged]

130. Add JSON generated column with secondary index for country-code attribute to improve query performance.
131. Convert data JSON columns to native JSON data type for optimized performance and storage.
Requires MySQL >= 5.7.13.
@wjordan wjordan merged commit d3309a4 into staging Jun 7, 2018
@wjordan wjordan deleted the forms_json_migration branch June 7, 2018 19:24
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.

None yet

1 participant