From 8a47b948eb88f1e0ff649880a70f9416306bac92 Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Tue, 5 Jul 2022 20:33:39 +0200
Subject: migrate code_bundles to bot_versions

---
 .../migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql    | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql

(limited to 'planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql')

diff --git a/planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql b/planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql
new file mode 100644
index 0000000..0b28df7
--- /dev/null
+++ b/planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql
@@ -0,0 +1,4 @@
+ALTER TABLE code_bundles RENAME TO bot_versions;
+ALTER TABLE bot_versions RENAME COLUMN path to code_bundle_path;
+ALTER TABLE bot_versions ALTER COLUMN code_bundle_path DROP NOT NULL;
+ALTER TABLE bot_versions ADD COLUMN container_digest TEXT;
-- 
cgit v1.2.3


From d7b7585dd70f9d41184cf88c2ecbd88341898c38 Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Wed, 6 Jul 2022 22:41:27 +0200
Subject: rename code_bundle to bot_version

---
 .../migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql      | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql')

diff --git a/planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql b/planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql
index 0b28df7..91afc0c 100644
--- a/planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql
+++ b/planetwars-server/migrations/2022-07-04-200149_code_bundle_to_bot_version/up.sql
@@ -2,3 +2,5 @@ ALTER TABLE code_bundles RENAME TO bot_versions;
 ALTER TABLE bot_versions RENAME COLUMN path to code_bundle_path;
 ALTER TABLE bot_versions ALTER COLUMN code_bundle_path DROP NOT NULL;
 ALTER TABLE bot_versions ADD COLUMN container_digest TEXT;
+
+ALTER TABLE match_players RENAME COLUMN code_bundle_id TO bot_version_id;
-- 
cgit v1.2.3

