This commit was manufactured by cvs2svn to create branch
[plcapi.git] / migrations / 004-up-fix-site-nodes.sql
diff --git a/migrations/004-up-fix-site-nodes.sql b/migrations/004-up-fix-site-nodes.sql
new file mode 100644 (file)
index 0000000..8bc9c58
--- /dev/null
@@ -0,0 +1,16 @@
+-- 
+-- bugfix
+-- the site_nodes should restrict to nodes where deleted is false
+--
+
+CREATE OR REPLACE VIEW site_nodes AS
+SELECT site_id,
+array_accum(node_id) AS node_ids
+FROM nodes
+WHERE deleted is false
+GROUP BY site_id;
+
+-- Bump subversion
+UPDATE plc_db_version SET subversion = 4;
+SELECT subversion from plc_db_version;
+