From f8a24aa2668198cfe1e7c08bf2f0781bb7bb91ea Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Fri, 11 Apr 2025 22:43:14 +0000 Subject: [PATCH] Add after_* targets for completing the conversion after a given step --- conversion/Makefile | 63 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/conversion/Makefile b/conversion/Makefile index 52e8bcd..cce4fc6 100644 --- a/conversion/Makefile +++ b/conversion/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 2023 The Meme Factory, Inc. www.karlpinc.com +# Copyright (C) 2023, 2025 The Meme Factory, Inc. www.karlpinc.com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -95,9 +95,11 @@ PSQL_CLEAN_SETUP := $(PSQL_SETUP) \ ## convert Load the DATA_FILE MS Access dump into the ## CONVERSION_SCHEMA and convert the data, storing ## the converted data in the TARGET_DB. +# For the record, the full set of steps is: +# create-schema restore grant_permissions copy_tidy make_tidy \ +# copy_easy make_easy copy_clean make_clean load_data .PHONY: convert -convert: create-schema restore grant_permissions copy_tidy make_tidy \ - copy_easy make_easy copy_clean make_clean load_data +convert: create-schema after_create-schema ## clean Delete all user-generated files .PHONY: clean @@ -114,6 +116,12 @@ create-schema: $(PSQL_DEPENDS) cat createschemas.sql ; ) \ | psql $(PSQL_ARGS) $(PSQL_SINGLE_TRANS) --set=ON_ERROR_STOP=y +## after_create-schema +## Complete the conversion steps that follow the +## create-schema step +.PHONY: after_create-schema +after_create-schema: restore after_restore + ## restore Load the DATA_FILE MS Access dump into the ## CONVERSION_SCHEMA. The DATA_FILE is expected ## to drop all tables (and other db objects) before @@ -129,6 +137,12 @@ restore: $(PSQL_DEPENDS) ./mung_dump.sh $(DATA_FILE) ; ) \ | psql $(PSQL_ARGS) --set=ON_ERROR_STOP=y +## after_restore +## Complete the conversion steps that follow the restore +## step +.PHONY: after_restore +after_restore: grant_permissions after_grant_permissions + ## grant_permissions Give readers and writers read permission to all tables. # This only needs to be done to the raw schema because of the way raw is # copied into the other schemas. @@ -138,6 +152,13 @@ grant_permissions: $(PSQL_DEPENDS) grant_permissions.sql cat grant_permissions.sql ; ) \ | psql $(PSQL_ARGS) $(PSQL_SINGLE_TRANS) --set=ON_ERROR_STOP=y +## after_grant_permissions +## Complete the conversion steps that follow the +## grant_permissions step +.PHONY: after_grant_permissions +after_grant_permissions: copy_tidy make_tidy \ + copy_easy make_easy copy_clean make_clean load_data + ## libconv Load the libconv schema with utility code .PHONY: libconv libconv: $(PSQL_DEPENDS) @@ -157,6 +178,12 @@ copy_tidy: $(PSQL_DEPENDS) PSQL_SINGLE_TRANS="$(PSQL_SINGLE_TRANS)" \ ./copy_schema.sh raw tidy +## after_copy_tidy +## Complete the conversion steps that follow the +## copy_tidy step +.PHONY: after_copy_tidy +after_copy_tidy: make_tidy after_make_tidy + ## make_tidy Clean up the tidy schema .PHONY: make_tidy make_tidy: $(PSQL_DEPENDS) libconv @@ -165,6 +192,12 @@ make_tidy: $(PSQL_DEPENDS) libconv PSQL_SINGLE_TRANS="$(PSQL_SINGLE_TRANS)" \ ./make_tidy.sh +## after_make_tidy +## Complete the conversion steps that follow the +## make_tidy step +.PHONY: after_make_tidy +after_make_tidy: copy_easy after_copy_easy + ## copy_easy Copy the tidy schema into the easy schema .PHONY: copy_easy copy_easy: $(PSQL_DEPENDS) @@ -175,6 +208,12 @@ copy_easy: $(PSQL_DEPENDS) PSQL_SINGLE_TRANS="$(PSQL_SINGLE_TRANS)" \ ./copy_schema.sh tidy easy +## after_copy_easy +## Complete the conversion steps that follow the +## copy_easy step +.PHONY: after_copy_easy +after_copy_easy: make_easy after_make_easy + ## make_easy Convert all the table names of the easy schema to ## lower case and remove all spaces, to keep us sane. .PHONY: make_easy @@ -183,6 +222,12 @@ make_easy: $(PSQL_DEPENDS) clean_names.sql cat clean_names.sql ; ) \ | psql $(PSQL_ARGS) $(PSQL_SINGLE_TRANS) --set=ON_ERROR_STOP=y +## after_make_easy +## Complete the conversion steps that follow the +## make_easy step +.PHONY: after_make_easy +after_make_easy: copy_clean after_copy_clean + ## copy_clean Copy the easy schema into the clean schema .PHONY: copy_clean copy_clean: $(PSQL_DEPENDS) @@ -193,6 +238,12 @@ copy_clean: $(PSQL_DEPENDS) PSQL_SINGLE_TRANS="$(PSQL_SINGLE_TRANS)" \ ./copy_schema.sh easy clean +## after_copy_clean +## Complete the conversion steps that follow the +## copy_clean step +.PHONY: after_copy_clean +after_copy_clean: make_clean load_data + ## make_clean Do some data cleanup in the clean schema .PHONY: make_clean make_clean: $(PSQL_DEPENDS) clean.sql @@ -200,6 +251,12 @@ make_clean: $(PSQL_DEPENDS) clean.sql cat clean.sql ; ) \ | psql $(PSQL_ARGS) $(PSQL_SINGLE_TRANS) --set=ON_ERROR_STOP=y +## after_make_clean +## Complete the conversion steps that follow the +## make_clean step +.PHONY: after_make_clean +after_make_clean: load_data + ## load_data Copy the data from the clean schema into the ## production schemas. .PHONY: load_data -- 2.34.1