Skip to content

Generic DB schema change writer PoC

What does this MR do and why?

This MR adds annotations to common schema statements that will need to be propagated to downstream database systems:

  • add column
  • remove column
  • swap column

Currently the generic migration is written to STDOUT:

{
  "table": "issues",
  "schema": "public",
  "operation": {
    "identifier": "add_column",
    "name": "my_col1",
    "type": "int64",
    "default": 1
  }
}


{
  "table": "issues",
  "schema": "public",
  "operation": {
    "identifier": "add_column",
    "name": "my_col1",
    "type": "int64",
    "default": 1
  }
}

{
  "table": "issues",
  "schema": "public",
  "operation": {
    "identifier": "swap_columns",
    "column1": "my_col1",
    "column2": "my_col2"
  }
}

TODO:

  • Record the changes within the migration file in a variable.
  • Generate a generic migration file (json?) per migration file: 1 file can contain multiple changes
  • Apply these changes automatically to CH
  • Tests

References

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Adam Hegyi

Merge request reports

Loading