New migration command: Copy #77

Closed
opened 2022-03-10 02:46:06 +00:00 by jamie · 5 comments
jamie commented 2022-03-10 02:46:06 +00:00 (Migrated from git.hazaar.io)

I would like to implement a new migration command. Other commands such as create, update, delete, etc are for modifying the schema. I would like to implement a suit of commands for modifying the data. Normally this is done with the data sync scripts, which is great for creating records that need to exist, however if we need to modify existing data there is nothing that can handle this automatically.

Use case here is moving data from one table to another. An existing table has a new column added which currently has data that exists in a different table. Once this new column is created we need to copy the data from the one table into the new table column, then we can remove the old table completely.

I would like to implement a new migration command. Other commands such as create, update, delete, etc are for modifying the schema. I would like to implement a suit of commands for modifying the data. Normally this is done with the data sync scripts, which is great for creating records that need to exist, however if we need to modify existing data there is nothing that can handle this automatically. Use case here is moving data from one table to another. An existing table has a new column added which currently has data that exists in a different table. Once this new column is created we need to copy the data from the one table into the new table column, then we can remove the old table completely.
jamie commented 2022-03-10 02:46:07 +00:00 (Migrated from git.hazaar.io)

assigned to @jamie

assigned to @jamie
jamie commented 2022-03-10 02:48:01 +00:00 (Migrated from git.hazaar.io)

created branch 77-new-migration-command-copy to address this issue

created branch [`77-new-migration-command-copy`](/hazaar/hazaar-dbi/-/compare/master...77-new-migration-command-copy) to address this issue
jamie commented 2022-03-10 02:48:22 +00:00 (Migrated from git.hazaar.io)

mentioned in merge request !46

mentioned in merge request !46
jamie commented 2022-03-14 23:02:48 +00:00 (Migrated from git.hazaar.io)

Here is an explanation of what the client is trying to achieve:

  1. Create ADS subscription based on api_keys data as follows:
    Decrypt column key from api_keys table and insert in the api_key field in ads along with the items below.
    Query client_account_id based on the user_id in api_keys table and include here.
    use start_date from past, renewal and end date from future.
    ads_features column should have api->tmd enabled using the data
    {
    "api": {
    "tmd": "true",
    "all_tmd": "false",
    "mf_report": "false",
    "spin_report": "false",
    "validate_apir_code": "false",
    "product_count_by_type": "false"
    }
    }
  2. Copy data from api_keys table into ads_api_data
    Fields to copy: id, user_id, user_options, expires_on, created_on, scopes, is_active, webhook_url, webhook_failures, data
    Also include the ads_id from the above step 1.
Here is an explanation of what the client is trying to achieve: > 1. Create ADS subscription based on api_keys data as follows: Decrypt column key from api_keys table and insert in the api_key field in ads along with the items below. Query client_account_id based on the user_id in api_keys table and include here. use start_date from past, renewal and end date from future. ads_features column should have api->tmd enabled using the data { "api": { "tmd": "true", "all_tmd": "false", "mf_report": "false", "spin_report": "false", "validate_apir_code": "false", "product_count_by_type": "false" } } > 2. Copy data from api_keys table into ads_api_data Fields to copy: id, user_id, user_options, expires_on, created_on, scopes, is_active, webhook_url, webhook_failures, data Also include the ads_id from the above step 1.
jamie commented 2022-03-16 05:21:31 +00:00 (Migrated from git.hazaar.io)

mentioned in commit 3a384002e0

mentioned in commit 3a384002e06a0972d66151c61cada4d77f06a23f
jamie (Migrated from git.hazaar.io) closed this issue 2022-03-16 05:21:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hazaar/hazaar-dbi#77
No description provided.