class CreateContabilidadeSubElementosVinculados < ActiveRecord::Migration[5.2]
  def change
    create_table :contabilidade_sub_elemento_vinculados do |t|
      t.references :sub_elemento, foreign_key: { to_table: :contabilidade_sub_elementos_de_despesa }, index: { name: 'index_sub_elemento_vinculados_on_sub_elemento_id' }
      t.references :orcamento, foreign_key: { to_table: :orcamentos }, index: { name: 'index_sub_elemento_vinculados_on_orcamento_id' }
      t.references :sub_elemento_vinculado, foreign_key: { to_table: :contabilidade_sub_elementos_de_despesa }, index: { name: 'index_sub_elemento_vinculados_on_sub_elemento_vinculado_id' }

      t.timestamps
    end
  end
end
