-
Notifications
You must be signed in to change notification settings - Fork 28
/
migration.rb
53 lines (42 loc) · 1.22 KB
/
migration.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# encoding: utf-8
require 'rubygems'
require 'bundler/setup'
require 'benchmark'
require 'active_support/core_ext/class/attribute_accessors'
require 'active_record'
require 'yaml'
config = YAML::load_file("config/summer.yml")
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || config["database"])
ActiveRecord::Schema.define do
create_table :channels, :force => true do |t|
t.string :name
t.boolean :hidden, :default => false
end
create_table :constants, :force => true do |t|
t.string :name, :url
t.integer :api_id
end
add_index :constants, :api_id
create_table :entries, :force => true do |t|
t.string :name, :url
t.integer :constant_id
end
add_index :entries, :constant_id
create_table :messages, :force => true do |t|
t.string :text
t.string :type
t.integer :channel_id
t.integer :person_id
t.boolean :hidden, :default => false
t.timestamps :null => false
end
create_table :people, :force => true do |t|
t.string :nick, :hostname
t.boolean :authorized, :default => false
end
create_table :tips, :force => true do |t|
t.string :command
t.text :text
end
end
Dir["lib/models/*.rb"].each { |f| require_relative f }