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

Drop constraint quota_definitions_name_key #3952

Merged

Conversation

kathap
Copy link
Contributor

@kathap kathap commented Sep 4, 2024

This PR waits for issue #3949, if support for Mysql5.7 will be stopped. -> MySQL 5.7 might be removed in Q1/Q2 2025. Adjusted this PR to support the old version.

On the name column in quota_defintions there were two unique constraints/indexes. One unique index with name qd_name_index, which is similar in postgres and mysql, and then an unique constraint on column name with name in postgres=quota_definitions_name_key and name in mysql=name. These index/constraint are created during table creation:

    create_table :quota_definitions do
      VCAP::Migration.common(self, :qd)

      String :name, null: false, unique: true, case_insensitive: true
      Boolean :non_basic_services_allowed, null: false
      Integer :total_services, null: false
      Integer :memory_limit, null: false

      index :name, unique: true
    end

The unique: true in line String :name, null: false, unique: true, case_insensitive: true creates the unique constraint.
Since there is an unique index created on column name index :name, unique: true (later renamed to qd_name_index), we don't need the unique constraint. Dropping it with this migration.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

stephanme added a commit that referenced this pull request Oct 11, 2024
On the name column in quota_defintions there were two unique
constraints/indexes. One unique index with name qd_name_index, which is
similar in postgres and mysql, and then an unique constraint on column
name with name in postgres=quota_definitions_name_key and name in
mysql=name.
Since the unique index already exists, we don't need the unique
constraint. Dropping it with this migration.
@svkrieger svkrieger force-pushed the remove-unnecessary-unique-constraint-from-quota-definitions branch 2 times, most recently from e8c08a7 to c2d3132 Compare October 15, 2024 13:27
@svkrieger svkrieger force-pushed the remove-unnecessary-unique-constraint-from-quota-definitions branch from c2d3132 to 580a8f1 Compare October 15, 2024 14:07
@svkrieger svkrieger merged commit dc6edb0 into main Oct 16, 2024
14 checks passed
@svkrieger svkrieger deleted the remove-unnecessary-unique-constraint-from-quota-definitions branch October 16, 2024 12:20
@svkrieger svkrieger mentioned this pull request Oct 16, 2024
5 tasks
ari-wg-gitbot added a commit to cloudfoundry/capi-release that referenced this pull request Oct 16, 2024
Changes in cloud_controller_ng:

- Drop constraint quota_definitions_name_key
    PR: cloudfoundry/cloud_controller_ng#3952
    Author: kathap <[email protected]>
    Author: Sven Krieger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants