Hi I have a question, we’re migrating from Rudders...
# support
a
Hi I have a question, we’re migrating from Rudderstack self-hosted to cloud version. We want to set up a new connection to Redshift. Will we be able to use the existing schema, and all new data will still be updated into the existing tables?
m
Hey There! 👋 Your message has been received by the RudderStack team. Our standard customer support hours are 9-6 PM EST, but we will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
q
Migration will not change any existing configurations. You will be able to use both existing and new destinations.
a
Thanks @quiet-wolf-72320, I have been using the existing destinations. However due to some new configuration, my data was not mapped as expected. For example, before: field
company_id
from the JS will be mapped with field company_id under Redshift. Now it is mapped to a new field
context_traits_company_id
Is there anyway I can map this field from JS back to the original field?
m
Can you share the sample event you are sending?
Also did you upgrade the server version and can you provide the workspace details?
a
Copy code
[
  {
    "anonymousId": "745563ea-743d-4206-8f46-768057d44715",
    "channel": "web",
    "context": {
      "app": {
        "name": "RudderLabs JavaScript SDK",
        "namespace": "com.rudderlabs.javascript",
        "version": "2.35.0"
      },
      "campaign": {},
      "library": {
        "name": "RudderLabs JavaScript SDK",
        "version": "2.35.0"
      },
      "locale": "en-US",
      "os": {
        "name": "",
        "version": ""
      },
      "page": {
        "initial_referrer": "$direct",
        "initial_referring_domain": "",
        "path": "/projects/228",
        "referrer": "$direct",
        "referring_domain": "",
        "search": "",
        "tab_url": "<https://app.gridly.com/projects/228>",
        "title": "Gridly Interactive | Gridly",
        "url": "<https://app.gridly.com/projects/228>"
      },
      "screen": {
        "density": 2,
        "height": 1050,
        "innerHeight": 920,
        "innerWidth": 1660,
        "width": 1680
      },
      "sessionId": 1693463291883,
      "traits": {
        "avatar": "<https://eu-central-1.api.gridly.com/organization/api/v1/media/avatars/qTOZA14Z72ODfo5CO2tXUlC8YNJ4Q.png>",
        "company": {
          "id": "1601969160001",
          "name": "Gridly Interactive",
          "plan": "UNLIMITED"
        },
        "createdAt": "2021-11-23T10:36:00Z",
        "email": "<mailto:tnn@localizedirect.com|tnn@localizedirect.com>",
        "firstName": "Thy",
        "lastName": "Nguyen",
        "projectId": 228
      },
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
    },
    "event": "[Gridly] Open Add Grid Option",
    "integrations": {
      "All": true
    },
    "messageId": "00a20a95-6799-46b1-801e-afa373bf9c21",
    "originalTimestamp": "2023-08-31T06:29:50.037Z",
    "properties": {},
    "rudderId": "76c48ec6-6d3c-4dc3-9b5b-fbea29f51d9f",
    "sentAt": "2023-08-31T06:29:50.040Z",
    "type": "track",
    "userId": "4051194393784320"
  }
]
My workspace is
gridly
I'm not the dev, so I'm not sure what you mean by upgrading the server version
m
Hi Thy Nguyen, you can use a user transformation to set the company details in the properties object. Say this is an issue with the track event (sample shared above is a track event), you can modify your existing user transformation to the following user_transformation.
Copy code
export function transformEvent(event, metadata) { 

    const session_id = event.context?.sessionId; 

    if (session_id) { 

        event.session_id = session_id; 

        delete event.context.sessionId; 

    } 

    if (event.type === 'track') { 

        const company = { ...event.context?.traits?.company}; 

        event.properties = {company, ...event.properties}; 

        delete event.context?.traits?.company; 

    } 

    return event;

}
s
Your payload should be transformed to below original payload:
Copy code
[
  {
    "anonymousId": "745563ea-743d-4206-8f46-768057d44715",
    "channel": "web",
    "context": {
      "app": {
        "name": "RudderLabs JavaScript SDK",
        "namespace": "com.rudderlabs.javascript",
        "version": "2.35.0"
      },
      "campaign": {},
      "library": {
        "name": "RudderLabs JavaScript SDK",
        "version": "2.35.0"
      },
      "locale": "en-US",
      "os": {
        "name": "",
        "version": ""
      },
      "page": {
        "initial_referrer": "$direct",
        "initial_referring_domain": "",
        "path": "/projects/228",
        "referrer": "$direct",
        "referring_domain": "",
        "search": "",
        "tab_url": "<https://app.gridly.com/projects/228>",
        "title": "Gridly Interactive | Gridly",
        "url": "<https://app.gridly.com/projects/228>"
      },
      "screen": {
        "density": 2,
        "height": 1050,
        "innerHeight": 920,
        "innerWidth": 1660,
        "width": 1680
      },
      "sessionId": 1693463291883,
      "traits": {
        "avatar": "<https://eu-central-1.api.gridly.com/organization/api/v1/media/avatars/qTOZA14Z72ODfo5CO2tXUlC8YNJ4Q.png>",
        "company": {
          "id": "1601969160001",
          "name": "Gridly Interactive",
          "plan": "UNLIMITED"
        },
        "createdAt": "2021-11-23T10:36:00Z",
        "email": "<mailto:tnn@localizedirect.com|tnn@localizedirect.com>",
        "firstName": "Thy",
        "lastName": "Nguyen",
        "projectId": 228
      },
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
    },
    "event": "[Gridly] Open Add Grid Option",
    "integrations": {
      "All": true
    },
    "messageId": "00a20a95-6799-46b1-801e-afa373bf9c21",
    "originalTimestamp": "2023-08-31T06:29:50.037Z",
    "properties": {},
    "rudderId": "76c48ec6-6d3c-4dc3-9b5b-fbea29f51d9f",
    "sentAt": "2023-08-31T06:29:50.040Z",
    "type": "track",
    "userId": "4051194393784320"
  }
]
Transformed payload:
Copy code
[
  {
    "anonymousId": "745563ea-743d-4206-8f46-768057d44715",
    "channel": "web",
    "context": {
      "app": {
        "name": "RudderLabs JavaScript SDK",
        "namespace": "com.rudderlabs.javascript",
        "version": "2.35.0"
      },
      "campaign": {},
      "library": {
        "name": "RudderLabs JavaScript SDK",
        "version": "2.35.0"
      },
      "locale": "en-US",
      "os": {
        "name": "",
        "version": ""
      },
      "page": {
        "initial_referrer": "$direct",
        "initial_referring_domain": "",
        "path": "/projects/228",
        "referrer": "$direct",
        "referring_domain": "",
        "search": "",
        "tab_url": "<https://app.gridly.com/projects/228>",
        "title": "Gridly Interactive | Gridly",
        "url": "<https://app.gridly.com/projects/228>"
      },
      "screen": {
        "density": 2,
        "height": 1050,
        "innerHeight": 920,
        "innerWidth": 1660,
        "width": 1680
      },
      "traits": {
        "avatar": "<https://eu-central-1.api.gridly.com/organization/api/v1/media/avatars/qTOZA14Z72ODfo5CO2tXUlC8YNJ4Q.png>",
        "createdAt": "2021-11-23T10:36:00Z",
        "email": "<mailto:tnn@localizedirect.com|tnn@localizedirect.com>",
        "firstName": "Thy",
        "lastName": "Nguyen",
        "projectId": 228
      },
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
    },
    "event": "[Gridly] Open Add Grid Option",
    "integrations": {
      "All": true
    },
    "messageId": "00a20a95-6799-46b1-801e-afa373bf9c21",
    "originalTimestamp": "2023-08-31T06:29:50.037Z",
    "properties": {
      "company": {
        "id": "1601969160001",
        "name": "Gridly Interactive",
        "plan": "UNLIMITED"
      }
    },
    "rudderId": "76c48ec6-6d3c-4dc3-9b5b-fbea29f51d9f",
    "sentAt": "2023-08-31T06:29:50.040Z",
    "type": "track",
    "userId": "4051194393784320",
    "session_id": 1693463291883
  }
]
Note:- This has only been tested on the payload you provided and needs to be tested on other sample payloads before being used in production.