Skip to content

chore: ship the KMS trigger SQL with the gem and stamp its version - #218

Merged
aaron-congo merged 2 commits into
mainfrom
chore/kms-trigger-sql-location
Oct 21, 2026
Merged

aaron-congo merged 2 commits into
mainfrom
chore/kms-trigger-sql-location

Conversation

@aaron-congo

@aaron-congo aaron-congo commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Ship the KMS Encryption Plugin's trigger SQL with the gem and record its version in the database

Description

  • Moved the PostgreSQL and MySQL trigger SQL from spec/integration/host/src/test/resources/sql/ to lib/aws_advanced_ruby_driver_wrapper/plugins/kms_encryption/sql/ (trigger_pg.sql, trigger_mysql.sql).
    • The docs can link to these files instead of keeping their own copy, so the SQL has one source.
    • The files now ship with the gem, since the gemspec includes everything under lib/.
  • Each file now records its version in a database comment, so users can check which version a database has and whether to re-run the file:
    • PostgreSQL: COMMENT ON FUNCTION enforce_encrypted_column(), version v2.
    • MySQL: a COMMENT on validate_encrypted_data_hmac_before_insert, version v1 (the MySQL SQL is otherwise unchanged).
    • The query to check the version is in a comment in each file.
  • kms_encryption_triggers_spec.rb now reads the SQL from the new location. lib/ is already mounted into the integration container, so no container changes were needed.

Companion docs PR: docs/kms-trigger-sql-source in aws-advanced-wrapper-docs links to these files. Merge this PR first, or the doc links won't resolve.

Testing:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Move the KMS Encryption Plugin's PostgreSQL and MySQL trigger SQL from the
integration test resources to lib/aws_advanced_ruby_driver_wrapper/plugins/
kms_encryption/sql/, so the published SQL has one source the docs can link
to and users get it with the gem. The integration triggers spec now reads
the files from there.

Each file now records its version in a database comment (PostgreSQL v2 on
enforce_encrypted_column, MySQL v1 on
validate_encrypted_data_hmac_before_insert), so users can check which
version is installed and whether to re-run it.
@aaron-congo
aaron-congo merged commit 63cca4a into main Oct 21, 2026
14 checks passed
@aaron-congo
aaron-congo deleted the chore/kms-trigger-sql-location branch October 21, 2026 15:13
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.

2 participants