Class: CreateComments

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

Instance Method Summary collapse

Instance Method Details

#callObject



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

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

  Rubee::SequelObject::DB.create_table(:comments) do
    primary_key(:id)
    String(:text)
    Integer(:user_id)
    # timestamps
    datetime(:created)
    datetime(:updated)

  end

  user = User.create(email: 'ok@ok.com', password: 'password')
  Comment.create(text: 'hello', user_id: user.id)
end