# == Schema Information # # Table name: mini_environments # # id :integer not null, primary key # name :string # created_at :datetime not null # updated_at :datetime not null # info :jsonb # govuk_guix_revision_id :string # backend_type :string # backend_id :integer # backend_data :jsonb # class MiniEnvironment < ApplicationRecord has_many :finished_terraform_jobs, dependent: :destroy has_many :terraform_states, dependent: :destroy belongs_to :govuk_guix_revision, class_name: 'GovukGuix::Revision' belongs_to :backend, polymorphic: true def enqueued_terraform_jobs Que.execute("SELECT * FROM que_jobs WHERE args->>0 = '#{id}'") end end