Top Level Namespace
Defined Under Namespace
Modules: Kernel, QQQ
Classes: App, Message
Instance Method Summary
collapse
Instance Method Details
#create_db ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/app.rb', line 16
def create_db
ActiveRecord::Migration.create_table :messages do |t|
t.string :uuid
t.string :message
t.datetime :recorded_at
t.datetime :created_at
t.index :uuid
t.index :message
t.index :recorded_at
t.index :created_at
end
end
|
#destroy_db ⇒ Object
30
31
32
|
# File 'lib/app.rb', line 30
def destroy_db
ActiveRecord::Migration.drop_table :messages
end
|
#init_db ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/app.rb', line 5
def init_db
puts 'init_db'
ActiveRecord::Base.establish_connection(
:adapter => "mysql2",
:host => "localhost",
:username => "root",
:password => "",
:database => "qqq"
)
end
|