-
Notifications
You must be signed in to change notification settings - Fork 1
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
V2 Dev migration applications to the Prod V1 data dump #75
Comments
I have made some "ad hoc migrations" that solve some of these data issues. In particular the "Carto" rows being duplicated is one we have solved previously. |
I was able to resolve the following issues with a combination of the ad-hoc migrations and borrowing missing data from dev: macrostrat-core-v2ALTER TABLE macrostrat.cols
ADD CONSTRAINT cols_project_fk FOREIGN KEY (project_id) REFERENCES macrostrat.projects(id) ON DELETE CASCADE;
partition-cartoALTER TABLE carto.lines ATTACH PARTITION carto.lines_large FOR VALUES IN ('large');
insert or update on table "lines_large" violates foreign key constraint "lines_source_id_fkey"
ALTER TABLE carto.lines ATTACH PARTITION carto.lines_large FOR VALUES IN ('large');
insert or update on table "lines_large" violates foreign key constraint "lines_source_id_fkey"
partition-mapsALTER TABLE carto.polygons ADD CONSTRAINT polygons_pkey PRIMARY KEY (map_id, scale);
could not create unique index "polygons_tiny_pkey"
diff --git a/cli/macrostrat/cli/ad-hoc-migrations/carto-rebuild.sql b/cli/macrostrat/cli/ad-hoc-migrations/carto-rebuild.sql
index 9161264..8a74f69 100644
--- a/cli/macrostrat/cli/ad-hoc-migrations/carto-rebuild.sql
+++ b/cli/macrostrat/cli/ad-hoc-migrations/carto-rebuild.sql
@@ -6,6 +6,7 @@ do that until we've removed the duplicates.
*/
ALTER TABLE carto.polygons ADD COLUMN updated boolean NOT NULL DEFAULT false;
+ALTER TABLE carto.polygons_large ADD COLUMN updated boolean NOT NULL DEFAULT false;
INSERT INTO carto.polygons_tiny (map_id, source_id, geom_scale, geom, scale, updated)
@@ -69,4 +70,5 @@ DELETE FROM carto.polygons_large WHERE NOT updated AND map_id IN (SELECT map_id
/** Once we have reduced duplicate geometries, we can add a unique constraint */
ALTER TABLE carto.polygons ADD CONSTRAINT polygons_pkey PRIMARY KEY (map_id, scale);
-ALTER TABLE carto.polygons DROP COLUMN updated;
\ No newline at end of file
+ALTER TABLE carto.polygons_large DROP COLUMN updated;
+ALTER TABLE carto.polygons DROP COLUMN updated; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While the migration system now applies successfully to a schema-only dump of the prod db (#70), several new issues arise when applying to a data dump:
macrostrat-core-v2
partition-maps
partition-carto
The text was updated successfully, but these errors were encountered: