{"version":"1.0","type":"rich","title":"Create a table to store changes from any of your tables in a log table.","description":"This example demonstrates a SQL-based version-control system for geospatial data in a CartoDB database. It shows how to create a log table that stores changes from any tracked table, capturing insertions, updates, and deletions with full row data as JSON. The code uses PostgreSQL PL/pgSQL triggers and functions, along with the `row_to_json` and `json_populate_record` functions to serialize and reconstruct records. A trigger on a user-specified table invokes the logging function, storing the geometry, operation type, source ID, and table name in the `version_control` table.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-0645add72c093f2f4908?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}