From 691f484271d2dca7360f1528a532759cf17b4e0d Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sun, 17 Dec 2023 11:30:10 -0700 Subject: [PATCH] fix: Add a target to generate test date from TM --- tm_admin/Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tm_admin/Makefile b/tm_admin/Makefile index 4d9858c9..58798b48 100644 --- a/tm_admin/Makefile +++ b/tm_admin/Makefile @@ -66,6 +66,25 @@ realclean: clean @$(RM) -f *~ */*~ rm -fr __pycache__/ */rm -fr __pycache__/ +# Developer only! This requires a Tasking Manager database running on your local machine. +# This is used to update the test data if any changes to the TM database schema are made. +tmtestdata: + @echo "Generating test data for users table..." + -@ogr2ogr ../tests/tmusers.sql PG:'dbname=tm4' -sql "SELECT * FROM users LIMIT 10" + -@sed -i -e '/ALTER/d' -e '/TABLE/d' -e '/BEGIN/d' tmusers.sql + @echo "Generating test data for projects table..." + -@ogr2ogr ../tests/tmprojects.sql PG:'dbname=tm4' -sql "SELECT * FROM projects LIMIT 10" + -@sed -i -e '/ALTER/d' -e '/TABLE/d' -e '/BEGIN/d' -e '/CREATE/d' ../tests/tmprojects.sql + @echo "Generating test data for organizations table..." + -@ogr2ogr ../tests/tmorganizations.sql PG:'dbname=tm4' -sql "SELECT * FROM organisations LIMIT 10" + -@sed -i -e '/ALTER/d' -e '/TABLE/d' -e '/BEGIN/d' -e '/CREATE/d' ../tests/tmorganizations.sql + @echo "Generating test data for tasks table..." + -@ogr2ogr ../tests/tmtasks.sql PG:'dbname=tm4' -sql "SELECT * FROM tasks LIMIT 10" + -@sed -i -e '/ALTER/d' -e '/TABLE/d' -e '/BEGIN/d' -e '/SELECT/d' -e '/CREATE/d' ../tests/tmtasks.sql + @echo "Generating test data for teams table..." + -@ogr2ogr ../tests/tmteams.sql PG:'dbname=tm4' -sql "SELECT * FROM teams LIMIT 10" + -@sed -i -e '/ALTER/d' -e '/TABLE/d' -e '/BEGIN/d' -e '/SELECT/d' -e '/CREATE/d' ../tests/tmteams.sql + .SUFFIXES: .py .sql .yaml .proto force: