Docs(Partner SDK): Docs for Schema Migrations#116
Docs(Partner SDK): Docs for Schema Migrations#116rajat-kushwaha wants to merge 2 commits intomainfrom
Conversation
|
| > NOTE: To learn how to handle `earliest_start_files`, `replace_files`, `update_files` and `delete_files` in history mode, follow the [How to Handle History Mode Batch Files](how-to-handle-history-mode-batch-files.md) guide. | ||
|
|
||
| #### Migrate | ||
| The `Migrate` RPC call is used to perform schema migrations in the destination. Fivetran will make this call if needed. It will always happen at start of sync, ie before regular sync operations. It should contain the logic to perform the necessary schema changes in the customer's warehouse. |
There was a problem hiding this comment.
it is not necessary that it will happen at the start of the sync.
there are some selected migrations which are also triggered after load completion of a flush . Refer code of PipelineSchemaMigratorExecutor this inturn calls schemaMigrationService.migrate() which will call repective schemaMigrator
|
|
||
| ## How do they work? | ||
| Fivetran's prod DB contains the information as to whether a connection needs to perform a schema migration. This table can be filled by devs manually, or by logic in connector code written by devs. | ||
| At the start of each sync, Fivetran checks if the connection has any schema migrations to perform. If it does, it will call the appropriate methods in the writer code (see migrate method below) to perform the migration. |
There was a problem hiding this comment.
not sure if we should be mentioning the output.updateSchema() which is used by connector code which is used for calling these migrate methods from pipelineSchemaMigratorExecutor
| Below table represents what information is passed in the `MigrationDetails` object for each `MigrationType`: | ||
| | MigrationType | MigrationDetails Object | | ||
| |---------------|-------------------------| | ||
| | `ADD_COLUMN_WITH_DEFAULT_VALUE` | schema, table, column, column_type, value | | ||
| | `ADD_HISTORY_COLUMN` | schema, table, column_type, value, operation_timestamp | | ||
| | `UPDATE_COLUMN` | schema, table, column, column_type, value | | ||
| | `COPY_COLUMN` | schema, table, from_column, to_column | | ||
| | `DROP_HISTORY_COLUMN` | schema, table, column, operation_timestamp | | ||
| | `SET_COLUMN_TO_NULL` | schema, table, column | | ||
| | `MIGRATE_HISTORY_TO_LIVE_MODE` | schema, table, keep_inactive_rows | | ||
| | `MIGRATE_HISTORY_TO_LEGACY_MODE` | schema, table, deleted_column | | ||
| | `MIGRATE_LEGACY_TO_LIVE_MODE` | schema, table, deleted_column | | ||
| | `MIGRATE_LIVE_TO_HISTORY_MODE` | schema, table, deleted_column | | ||
| | `COPY_TABLE_TO_HISTORY_MODE` | schema, table, from_table, to_table, deleted_column | | ||
| | `RENAME_COLUMN` | schema, table, from_column, to_column | | ||
| | `COPY_TABLE` | schema, table, from_table, to_table | | ||
| | `RENAME_TABLE` | schema, table, from_table, to_table | |
No description provided.