10516: set finished_at to updated_at on pipeline_instances if the pipeline is finishe...
[arvados.git] / services / api / db / migrate / 20170105160302_set_finished_at_on_finished_pipeline_instances.rb
diff --git a/services/api/db/migrate/20170105160302_set_finished_at_on_finished_pipeline_instances.rb b/services/api/db/migrate/20170105160302_set_finished_at_on_finished_pipeline_instances.rb
new file mode 100644 (file)
index 0000000..758b86f
--- /dev/null
@@ -0,0 +1,5 @@
+class SetFinishedAtOnFinishedPipelineInstances < ActiveRecord::Migration
+  def change
+    ActiveRecord::Base.connection.execute("update pipeline_instances set finished_at=updated_at where finished_at is null and (state='Failed' or state='Complete')")
+  end
+end