Class: CreateAccounts

Inherits:
Object
  • Object
show all
Defined in:
lib/db/create_accounts.rb

Instance Method Summary collapse

Instance Method Details

#callObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/db/create_accounts.rb', line 2

def call
  return if Rubee::SequelObject::DB.tables.include?(:accounts)

  Rubee::SequelObject::DB.create_table(:accounts) do
    primary_key(:id)
    String(:addres)
    foreign_key(:user_id, :users)
    # timestamps
    datetime(:created)
    datetime(:updated)
  end

  Account.create(addres: '13th Ave, NY', user_id: User.all.first.id)
  Account.create(addres: '14th Ave, NY', user_id: User.all.last.id)
end