CreateCompanyContacts (migrate/20260716120001_create_company_contacts.rb)

woofed-crm · db/migrate/20260716120001_create_company_contacts.rb · ruby · MIT
database, tag:embed-classified

Adds company_contacts table to link companies and contacts

# Source: https://github.com/douglara/woofed-crm | License: MIT | Copyright 2026 WOOFED DESENVOLVIMENTO DE SOFTWARES LTDA - ME - CNPJ 60.076.777/0001-61
# Provided via justclaw.it.com; keep this notice with the code.
class CreateCompanyContacts < ActiveRecord::Migration[7.1]
  def change
    create_table :company_contacts do |t|
      t.references :company, null: false, foreign_key: true
      t.references :contact, null: false, foreign_key: true

      t.timestamps
    end

    add_index :company_contacts, %i[company_id contact_id], unique: true
  end
end

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key