From 4ac3d22c0eec52b65c9e009dfcfb372015826179 Mon Sep 17 00:00:00 2001 From: Guillaume Fouillet Date: Thu, 4 Jul 2024 10:44:23 +0200 Subject: [PATCH] feat(domain): add machine_requires_reboot table in dqlite Before this commit, the machine_requires_reboot table was not present in dqlite schema. After this commit, a new table machine_requires_reboot has been added to the dqlite schema, thus extending the capability to track and manage machines that require a reboot operation. This change is also reflected in the schema test.go file where the new table is included in the list. It is the first step of migration between mongodb and dqlite for handling Machine reboot. Signed-off-by: Guillaume Fouillet --- domain/schema/model/sql/0017-machine.sql | 8 ++++++++ domain/schema/schema_test.go | 1 + 2 files changed, 9 insertions(+) diff --git a/domain/schema/model/sql/0017-machine.sql b/domain/schema/model/sql/0017-machine.sql index 7dcff65ce17..c8383dfa939 100644 --- a/domain/schema/model/sql/0017-machine.sql +++ b/domain/schema/model/sql/0017-machine.sql @@ -73,3 +73,11 @@ CREATE TABLE machine_filesystem ( REFERENCES storage_filesystem (uuid), PRIMARY KEY (machine_uuid, filesystem_uuid) ); + +CREATE TABLE machine_requires_reboot ( + machine_uuid TEXT NOT NULL PRIMARY KEY, + created_at DATETIME NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW', 'utc')), + CONSTRAINT fk_machine_requires_reboot_machine + FOREIGN KEY (machine_uuid) + REFERENCES machine (uuid) +); diff --git a/domain/schema/schema_test.go b/domain/schema/schema_test.go index 807f61c4190..6242409e9e7 100644 --- a/domain/schema/schema_test.go +++ b/domain/schema/schema_test.go @@ -313,6 +313,7 @@ func (s *schemaSuite) TestModelTables(c *gc.C) { "machine_tool", "machine_volume", "machine_filesystem", + "machine_requires_reboot", // Charm "charm",