Class: CreateBaseModels

Inherits:
Object
  • Object
show all
Defined in:
lib/kanal/plugins/user_system/migrations/20221124150000_create_base_models.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kanal/plugins/user_system/migrations/20221124150000_create_base_models.rb', line 6

def change
  create_table :kanal_users do |t|
    t.string :username, null: false, index: { unique: true, name: "kanal_unique_usernames" }
    t.string :phone, null: true
    t.string :email, null: true

    t.timestamps
  end

  create_table :kanal_user_properties do |t|
    t.string :name, null: false
    t.string :raw_value, null: false
    # t.string :type, null: false

    t.timestamps
  end

  add_belongs_to :kanal_user_properties, :kanal_user, null: false, foreign_key: true

  add_index :kanal_user_properties, [:name, :kanal_user_id], unique: true
end