From 97c807cd33e28bb24ac621071ec7f3169eab82db Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Fri, 28 Jun 2024 16:49:24 +0200 Subject: [PATCH] Add migration for footprint --- .../migrations/sqlite3/08_add-footprint.down.sql | 0 .../migrations/sqlite3/08_add-footprint.up.sql | 12 ++++++++++++ 2 files changed, 12 insertions(+) create mode 100644 internal/repository/migrations/sqlite3/08_add-footprint.down.sql create mode 100644 internal/repository/migrations/sqlite3/08_add-footprint.up.sql diff --git a/internal/repository/migrations/sqlite3/08_add-footprint.down.sql b/internal/repository/migrations/sqlite3/08_add-footprint.down.sql new file mode 100644 index 0000000..e69de29 diff --git a/internal/repository/migrations/sqlite3/08_add-footprint.up.sql b/internal/repository/migrations/sqlite3/08_add-footprint.up.sql new file mode 100644 index 0000000..5db1d1b --- /dev/null +++ b/internal/repository/migrations/sqlite3/08_add-footprint.up.sql @@ -0,0 +1,12 @@ +ALTER TABLE job ADD COLUMN energy REAL NOT NULL DEFAULT 0.0; + +ALTER TABLE job ADD COLUMN footprint TEXT DEFAULT NULL; +UPDATE job SET footprint = '{"flops_any_avg": 0.0}'; +UPDATE job SET footprint = json_replace(footprint, '$.flops_any_avg', job.flops_any_avg); +UPDATE job SET footprint = json_insert(footprint, '$.mem_bw_avg', job.mem_bw_avg); +UPDATE job SET footprint = json_insert(footprint, '$.mem_used_max', job.mem_used_max); +UPDATE job SET footprint = json_insert(footprint, '$.load_avg', job.load_avg); +ALTER TABLE job DROP flops_any_avg; +ALTER TABLE job DROP mem_bw_avg; +ALTER TABLE job DROP mem_used_max; +ALTER TABLE job DROP load_avg;