Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20210811120204_create_customer_relations_contacts.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0c26ee0ef59f9c91db991e734689286f5c24bcb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

class CreateCustomerRelationsContacts < ActiveRecord::Migration[6.1]
  include Gitlab::Database::MigrationHelpers

  def up
    create_table_with_constraints :customer_relations_contacts do |t|
      t.bigint :group_id, null: false
      t.references :organization, index: true, null: true, foreign_key: { to_table: :customer_relations_organizations, on_delete: :cascade }
      t.timestamps_with_timezone null: false
      t.integer :state, limit: 1, default: 1, null: false
      t.text :phone
      t.text :first_name, null: false
      t.text :last_name, null: false
      t.text :email
      t.text :description

      t.text_limit :phone, 32
      t.text_limit :first_name, 255
      t.text_limit :last_name, 255
      t.text_limit :email, 255
      t.text_limit :description, 1024
    end
  end

  def down
    with_lock_retries do
      drop_table :customer_relations_contacts
    end
  end
end