From 15c8d483d7a57f266f2b1864ac908d907c80dbe8 Mon Sep 17 00:00:00 2001 From: Jimmy Christensen Date: Wed, 10 Jul 2024 20:37:58 +0200 Subject: [PATCH] Order layer outputs in the order they were added (#1399) Summarize your change. When adding multiple outputs to a layer, they are not returned in the same order as they were added. This adds a new SERIAL column which auto-increments to the layer_output table. With the correct order, it's possible to determine the "main" output of a layer by using the order. --- VERSION.in | 2 +- .../java/com/imageworks/spcue/dao/postgres/LayerDaoJdbc.java | 4 +++- .../postgres/migrations/V30__Add_order_column_to_outputs.sql | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 cuebot/src/main/resources/conf/ddl/postgres/migrations/V30__Add_order_column_to_outputs.sql diff --git a/VERSION.in b/VERSION.in index eec15f902..f7c6c31b6 100644 --- a/VERSION.in +++ b/VERSION.in @@ -1 +1 @@ -0.29 +0.30 diff --git a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/LayerDaoJdbc.java b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/LayerDaoJdbc.java index 15941a196..f555bef6e 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/LayerDaoJdbc.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/LayerDaoJdbc.java @@ -77,7 +77,9 @@ public void insertLayerOutput(LayerInterface layer, String filespec) { "FROM " + "layer_output " + "WHERE " + - "pk_layer = ?"; + "pk_layer = ?" + + "ORDER BY " + + "ser_order"; private static final RowMapper OUTPUT_MAPPER = new RowMapper() { diff --git a/cuebot/src/main/resources/conf/ddl/postgres/migrations/V30__Add_order_column_to_outputs.sql b/cuebot/src/main/resources/conf/ddl/postgres/migrations/V30__Add_order_column_to_outputs.sql new file mode 100644 index 000000000..cf6244bba --- /dev/null +++ b/cuebot/src/main/resources/conf/ddl/postgres/migrations/V30__Add_order_column_to_outputs.sql @@ -0,0 +1,3 @@ +-- Add a serial column to layer_output for getting correct order of outputs + +alter table layer_output add ser_order SERIAL not null;