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

fix(sql): PostgreSQL compatibility for executions and partitions #3812

Merged
merged 5 commits into from
Jul 16, 2020

Conversation

jcavanagh
Copy link
Contributor

@jcavanagh jcavanagh commented Jul 10, 2020

Includes the following changes:

  • Removing bigint display qualifiers - these are MySQL specific, and display-only
  • Avoid using forceIndex on PostgreSQL - it does not support that feature
  • Remove MySQL-specific column backticks for partition, and replace with DSL.name throughout
  • A number of queries used MySQL-specific upsert features. These have been expanded with PostgreSQL-compatible varieties.
  • Add new PostgreSQL module with runtimeOnly driver dependency
  • Add PostgreSQL tests for orca-sql

Depends on:
spinnaker/kork#716
spinnaker/keiko#176

@@ -14,6 +14,6 @@ databaseChangeLog:
nullable: false
- column:
name: expiry
type: bigint(13)
type: bigint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't validCheckSum be required here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it would be - I've added the original checksum to the migration.

Comment on lines -8 to +36
sql: CREATE TABLE `deleted_executions` (id INT AUTO_INCREMENT, execution_id char(26) NOT NULL, execution_type ENUM("pipeline", "orchestration") NOT NULL, deleted_at DATETIME NOT NULL, CONSTRAINT deleted_executions_pk PRIMARY KEY (id))
sql: ALTER TABLE `deleted_executions` MODIFY COLUMN `execution_type` ENUM("pipeline", "orchestration") NOT NULL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

.run {
when (jooq.dialect()) {
SQLDialect.POSTGRES -> {
onConflict(DSL.field("id"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be lock_name, not id which is not a field in this table. lock_name is the primary key.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed, thank you.

Includes the following changes:

- Removing bigint display qualifiers - these are MySQL specific, and display-only
- Avoid using `forceIndex` on PostgreSQL - it does not support that feature
- Remove MySQL-specific column backticks for `partition`, and replace with `DSL.name` throughout
- A number of queries used MySQL-specific upsert features. These have been expanded with PostgreSQL-compatible varieties.
- Add new PostgreSQL module with runtimeOnly driver dependency
- Add PostgreSQL tests for orca-sql
@jcavanagh jcavanagh force-pushed the pg-compat-upstream branch from 3e21970 to b5f5d12 Compare July 14, 2020 00:32
@jcavanagh
Copy link
Contributor Author

jcavanagh commented Jul 14, 2020

@robzienert Thanks for the review! This is still dependent on spinnaker/keiko#176 - would it be possible to get eyes on that sometime as well?

Copy link
Contributor

@marchello2000 marchello2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fixups! looking at keiko now

@marchello2000 marchello2000 added the ready to merge Approved and ready for merge label Jul 14, 2020
@marchello2000
Copy link
Contributor

merged keiko, it should produce a release https://github.com/spinnaker/keiko/releases/tag/v3.8.0

@jcavanagh
Copy link
Contributor Author

Thanks @marchello2000 ! I'll wait for the next Kork release, and then this PR should (hopefully) test correctly.

@mergify mergify bot added the auto merged Merged automatically by a bot label Jul 16, 2020
@mergify mergify bot merged commit 0bb15f3 into spinnaker:master Jul 16, 2020
KathrynLewis pushed a commit to KathrynLewis/orca that referenced this pull request Jan 31, 2021
…nnaker#3812)

* fix(sql): PostgreSQL compatibility for executions and partitions

Includes the following changes:

- Removing bigint display qualifiers - these are MySQL specific, and display-only
- Avoid using `forceIndex` on PostgreSQL - it does not support that feature
- Remove MySQL-specific column backticks for `partition`, and replace with `DSL.name` throughout
- A number of queries used MySQL-specific upsert features. These have been expanded with PostgreSQL-compatible varieties.
- Add new PostgreSQL module with runtimeOnly driver dependency
- Add PostgreSQL tests for orca-sql

* Update kork/keiko pins to include required dependency changes

Co-authored-by: Adam Jordens <adam@jordens.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for merge target-release/1.22
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants