The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6150

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===

From bc37110e3e72a0ec6ed0f55537f471918f2fdf90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Wed, 4 Sep 2019 14:38:19 -0400
Subject: [PATCH 1/2] Makefile: Fix update-schema target
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index fe8e419f00..0b268c65ba 100644
--- a/Makefile
+++ b/Makefile
@@ -109,7 +109,7 @@ update-protobuf:
        protoc --go_out=. ./lxd/migration/migrate.proto
 
 .PHONY: update-schema
-generate:
+update-schema:
        cd shared/generate && go build -o lxd-generate -tags "$(TAG_SQLITE3)" 
$(DEBUG) && cd -
        mv shared/generate/lxd-generate $(GOPATH)/bin
        go generate ./...

From 30777fe8e660e53840037803ac8137ba01b6c1b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Wed, 4 Sep 2019 14:52:44 -0400
Subject: [PATCH 2/2] lxd/db: Add type column to images table
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/db/cluster/schema.go | 3 ++-
 lxd/db/cluster/update.go | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lxd/db/cluster/schema.go b/lxd/db/cluster/schema.go
index 3a3ee8979d..78534e25b6 100644
--- a/lxd/db/cluster/schema.go
+++ b/lxd/db/cluster/schema.go
@@ -34,6 +34,7 @@ CREATE TABLE "images" (
     last_use_date DATETIME,
     auto_update INTEGER NOT NULL DEFAULT 0,
     project_id INTEGER NOT NULL,
+    type INTEGER NOT NULL DEFAULT 0,
     UNIQUE (project_id, fingerprint),
     FOREIGN KEY (project_id) REFERENCES projects (id) ON DELETE CASCADE
 );
@@ -480,5 +481,5 @@ CREATE TABLE storage_volumes_config (
     FOREIGN KEY (storage_volume_id) REFERENCES storage_volumes (id) ON DELETE 
CASCADE
 );
 
-INSERT INTO schema (version, updated_at) VALUES (16, strftime("%s"))
+INSERT INTO schema (version, updated_at) VALUES (17, strftime("%s"))
 `
diff --git a/lxd/db/cluster/update.go b/lxd/db/cluster/update.go
index 93925a6f94..67e9a1ca20 100644
--- a/lxd/db/cluster/update.go
+++ b/lxd/db/cluster/update.go
@@ -51,6 +51,13 @@ var updates = map[int]schema.Update{
        14: updateFromV13,
        15: updateFromV14,
        16: updateFromV15,
+       17: updateFromV16,
+}
+
+// Add image type column
+func updateFromV16(tx *sql.Tx) error {
+       _, err := tx.Exec("ALTER TABLE images ADD COLUMN type INTEGER NOT NULL 
DEFAULT 0;")
+       return err
 }
 
 // Create new snapshot tables and migrate data to them.
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to