Sha256: 27c9783048566717ef807871e017ef21c04da633999f19a13c04fefb480c0af3

Contents?: true

Size: 1.37 KB

Versions: 12

Compression:

Stored size: 1.37 KB

Contents

class AddAdditionalFields < ActiveRecord::Migration[7.1]
  def change
    add_column :comee_core_client_addresses, :name, :string, null: false, default: "Default"
    add_column :comee_core_products, :customs_description, :string, null: true
    add_column :comee_core_suppliers, :payment_terms, :string, null: false, default: "30 Days Net"
    add_column :comee_core_suppliers, :vat_number, :string, null: true
    add_column :comee_core_suppliers, :tax_code, :string, null: true
    add_column :comee_core_clients, :tax_code, :string, null: true
    add_column :comee_core_clients, :vat_number, :string, null: true
    add_column :comee_core_master_prices, :state_of_origin, :string, null: true
    add_reference :comee_core_master_prices,
                  :country_of_origin,
                  null: true,
                  index: {name: "coo_on_ccmp_indx"},
                  foreign_key: {to_table: :comee_core_lookups}
    add_reference :comee_core_clients,
                  :country,
                  null: true,
                  index: {name: "country_on_ccc_indx"},
                  foreign_key: {to_table: :comee_core_lookups}
    reversible do |dir|
      dir.up do
        execute <<-SQL
          UPDATE comee_core_products
          SET customs_description = description
        SQL
      end
    end

    change_column_null :comee_core_products, :customs_description, false
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
comee_core-0.2.88 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.87 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.86 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.85 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.84 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.83 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.82 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.81 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.80 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.78 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.77 db/migrate/20240601094028_add_additional_fields.rb
comee_core-0.2.76 db/migrate/20240601094028_add_additional_fields.rb