From cc85930e696a88de609bdcb2f58c6b9187075c69 Mon Sep 17 00:00:00 2001 From: Stefan Pranger Date: Mon, 28 Jun 2021 18:24:35 +0200 Subject: [PATCH] create_migrations now adds migration to Schema.cpp --- create_migration.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/create_migration.sh b/create_migration.sh index 911a630..b30b1eb 100755 --- a/create_migration.sh +++ b/create_migration.sh @@ -25,7 +25,7 @@ namespace db { EOF ) -include="#include \"migrations/$migration.h\"" -map_entry="migrations.emplace($epoch, new db::migrations::m$migration());" -echo $include -echo $map_entry +include="#include \\\"migrations/$migration.h\\\"" +map_entry=" migrations.emplace($epoch, new db::migrations::m$migration());" +gawk -i inplace "FNR==NR{ if (/migrations.emplace/) p=NR; next} 1; FNR==p{ print \"$map_entry\" }" db/Schema.cpp db/Schema.cpp +gawk -i inplace "FNR==NR{ if (/#include \"migrations/) p=NR; next} 1; FNR==p{ print \"$include\" }" db/Schema.cpp db/Schema.cpp