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

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) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From a31ba6a8ee5df7a48075ea264ac03be6c03184ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Thu, 5 Sep 2019 17:14:55 -0400
Subject: [PATCH] lxd/db: Add type column to images source 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 78534e25b6..4d1ff36704 100644
--- a/lxd/db/cluster/schema.go
+++ b/lxd/db/cluster/schema.go
@@ -73,6 +73,7 @@ CREATE TABLE images_source (
     protocol INTEGER NOT NULL,
     certificate TEXT NOT NULL,
     alias TEXT NOT NULL,
+    type TEXT NOT NULL DEFAULT '',
     FOREIGN KEY (image_id) REFERENCES images (id) ON DELETE CASCADE
 );
 CREATE TABLE "instances" (
@@ -481,5 +482,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 (17, strftime("%s"))
+INSERT INTO schema (version, updated_at) VALUES (18, strftime("%s"))
 `
diff --git a/lxd/db/cluster/update.go b/lxd/db/cluster/update.go
index 67e9a1ca20..8b478f9f9a 100644
--- a/lxd/db/cluster/update.go
+++ b/lxd/db/cluster/update.go
@@ -52,6 +52,13 @@ var updates = map[int]schema.Update{
        15: updateFromV14,
        16: updateFromV15,
        17: updateFromV16,
+       18: updateFromV17,
+}
+
+// Add image source type column
+func updateFromV17(tx *sql.Tx) error {
+       _, err := tx.Exec("ALTER TABLE images_source ADD COLUMN type TEXT NOT 
NULL DEFAULT '';")
+       return err
 }
 
 // Add image type column
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to