@@ -37,6 +38,7 @@ class Environment < ActiveRecord::Base
scope:available,->{with_state(:available)}
scope:stopped,->{with_state(:stopped)}
scope:order_by_last_deployed_at,->{order(Gitlab::Database.nulls_first_order('(SELECT MAX(id) FROM deployments WHERE deployments.environment_id = environments.id)','ASC'))}
state_machine:state,initial: :availabledo
event:startdo
...
...
@@ -51,14 +53,6 @@ class Environment < ActiveRecord::Base