Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add temporal tables and rework insert statements #391

Merged
merged 20 commits into from
Mar 6, 2025

Conversation

marcellmueller
Copy link
Contributor

@marcellmueller marcellmueller commented Feb 25, 2025

#308

  • Added RDS compatible version of temportal tables for history tracking
  • Added upsert_timestamp_columns util function to streamline adding metadata columns ie created_at, created_by, updated_at, updated_by columns to a table
  • Added setup_temporal_table util function which adds a _history version of the table and updated_if_changed trigger function on a table
  • _code tables only have update_timestamp in the FTA database, no updated_userid or created metadata so I've kept it the same. I'm split on if adding history tracking to these tables is useful, I've added history tables to them for now.

Tested with flyway clean disabled for the RST migrations. No new records are added on a redeploy to a steady database, and if we make some changes to the FTA data then that was updated, with history being tracked in the history table.

@marcellmueller marcellmueller force-pushed the spike/postgres-update-versioning branch 8 times, most recently from 0abe397 to 7a04c0f Compare February 28, 2025 22:28
@marcellmueller marcellmueller force-pushed the spike/postgres-update-versioning branch from ef454d9 to 44e46e1 Compare February 28, 2025 23:29
@marcellmueller marcellmueller changed the title spike/postgres update versioning Add temporal tables and rework insert statements Mar 3, 2025
@marcellmueller marcellmueller force-pushed the spike/postgres-update-versioning branch from d766465 to 68c32c4 Compare March 3, 2025 16:34
@marcellmueller marcellmueller force-pushed the spike/postgres-update-versioning branch from 2f9850f to 6acd9e7 Compare March 3, 2025 18:49
@marcellmueller marcellmueller force-pushed the spike/postgres-update-versioning branch from 6acd9e7 to 6432939 Compare March 3, 2025 19:29
@marcellmueller marcellmueller force-pushed the spike/postgres-update-versioning branch 5 times, most recently from caa90c9 to daacabf Compare March 3, 2025 22:58
@marcellmueller marcellmueller force-pushed the spike/postgres-update-versioning branch from 4bf8212 to c63c4f7 Compare March 3, 2025 23:36
@marcellmueller marcellmueller marked this pull request as ready for review March 3, 2025 23:36
@marcellmueller marcellmueller force-pushed the spike/postgres-update-versioning branch 3 times, most recently from b932706 to e2bb445 Compare March 5, 2025 20:03
@marcellmueller marcellmueller force-pushed the spike/postgres-update-versioning branch from 4738e62 to d94bd08 Compare March 6, 2025 19:38
@marcellmueller marcellmueller merged commit d8d6ead into main Mar 6, 2025
32 checks passed
@marcellmueller marcellmueller deleted the spike/postgres-update-versioning branch March 6, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants