CMS Development

dvalle
Membro | Parceiro Diamante
Membro | Parceiro Diamante

Migrate tables hubdb to other hubdb

Hi, I have 2 environment (dev and prod) in hubspot, I need migrate my tables of dev to prod, but this tables has foreign keys, how I can keep the relationship between tables

0 Avaliação positiva
1 Resposta 1
lscanlan
Alunos da HubSpot
Alunos da HubSpot

Migrate tables hubdb to other hubdb

Hi @dvalle,

 

If you're migrating the tables from one account to another, is exporting/importing CSVs an option? When you click into a table you'll find Import and Export actions under the Actions button in the top-right. You can export to CSV in your dev account and then import the CSV in your prod account.

 

But if you're looking for an API solution, could you still use the HubDB API, but just update the keys for whichever account you're making your requests to? So for reference, here's a link to our HubDB API overview documentation: https://developers.hubspot.com/docs/methods/hubdb/hubdb_overview. You could get all tables in your dev account using the endpoint documented here: https://developers.hubspot.com/docs/methods/hubdb/v2/get_tables, and just make sure to use the key from your dev account. Then for each table listed there, you'd get its details (https://developers.hubspot.com/docs/methods/hubdb/v2/get_table) and rows (https://developers.hubspot.com/docs/methods/hubdb/v2/get_table_rows). And then you should have what you need to create the table in the new account. So making sure to switch your key to the one for your prod account, you'd use the endpoint documented here: https://developers.hubspot.com/docs/methods/hubdb/v2/create_table to create the table, and then the endpoint documented here: https://developers.hubspot.com/docs/methods/hubdb/v2/create_row for creating rows in the table.

 

Let me know if you have any questions about it.

 

Leland Scanlan

HubSpot Developer Support
0 Avaliação positiva