Skip to content

01-add-foreign-keys.sql delete statements causing data loss after mariadb migration #228

@amyfromandi

Description

@amyfromandi

Overview

While reviewing production vs. staging vs. development row counts for strat_tree , we identified multiple row mismatches caused by delete statements embedded inside the 01-add-foreign-keys.sql migration. These deletes appear to remove data leading to inconsistencies across the macrostrat schema in development and the macrostratbak2 schema (the restored backup saved after the Mariadb migration was ran). We need to review the data being removed to determine whether removal is valid, or if we are losing needed data.

Tables with row count variations:

col_refs
unit_econs
unit_environs
unit_strat_names
strat_names
strat_names_places
timescales_intervals
units
units_sections
strat_tree

Row count discrepancies:

table_name macrostrat_count macrostratbak2_count diff
col_refs 5648 5716 -68
strat_names 51225 51229 -4
strat_names_places 50288 50321 -33
strat_tree 29467 29467 0
timescales_intervals 2194 2195 -1
unit_econs 3148 3157 -9
unit_environs 139193 140808 -1615
units 133417 133419 -2
units_sections 133675 133671 4
unit_strat_names 28319 28322 -3

strat_tree variance is 0 now after the macrostrat.strat_tree table was dropped and restored with CREATE TABLE macrostrat.strat_tree AS SELECT * FROM macrostratbak2.strat_tree

Next steps

  • Restore macrostrat tables from macrostratbak2
  • Review each DELETE statment to determine if the data deletions are necessary

Metadata

Metadata

Labels

data migrationdata migraton issue from MariaDB to Postgresql

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions