Class: UserMigration

Inherits:
Object
  • Object
show all
Defined in:
lib/chatgpt_assistant/migrations.rb

Overview

User model

Instance Method Summary collapse

Instance Method Details

#changeObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/chatgpt_assistant/migrations.rb', line 24

def change
  return if ActiveRecord::Base.connection.table_exists? :users

  create_table :users do |t|
    t.string :telegram_id, foreign_key: true, class_name: "Visitor"
    t.string :discord_id, foreign_key: true, class_name: "Visitor"
    t.string :name, limit: 100
    t.string :email, null: false, limit: 100
    t.string :phone, limit: 100
    t.string :password_hash, null: false, limit: 100
    t.string :password_salt, null: false, limit: 100
    t.string :token, null: false, limit: 100, default: ""
    t.string :openai_token, null: false, limit: 100, default: ""
    t.integer :current_chat_id, null: false, default: 0
    t.integer :role, null: false, default: 0
    t.integer :open_chats, null: false, default: 0
    t.integer :closed_chats, null: false, default: 0
    t.integer :total_chats, null: false, default: 0
    t.integer :total_messages, null: false, default: 0
    t.boolean :active, null: false, default: false
    t.timestamps
  end
end