File tree Expand file tree Collapse file tree 6 files changed +9
-5
lines changed
lib/slack-ruby-bot-server
sample_apps/sample_app_activerecord/db
spec/database_adapters/activerecord Expand file tree Collapse file tree 6 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ module Config
5
5
attr_accessor :server_class
6
6
attr_accessor :ping
7
7
attr_accessor :database_adapter
8
+ attr_accessor :teams_table
8
9
9
10
def reset!
10
11
self . ping = nil
@@ -16,6 +17,7 @@ def reset!
16
17
else
17
18
raise 'One of "mongoid" or "activerecord" is required.'
18
19
end
20
+ self . teams_table = :teams
19
21
end
20
22
21
23
def activerecord?
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ def self.check!
11
11
end
12
12
13
13
def self . init!
14
- return if ActiveRecord ::Base . connection . tables . include? ( 'teams' )
15
- ActiveRecord ::Base . connection . create_table :teams do |t |
14
+ return if ActiveRecord ::Base . connection . tables . include? ( SlackRubyBotServer :: Config . teams_table )
15
+ ActiveRecord ::Base . connection . create_table SlackRubyBotServer :: Config . teams_table do |t |
16
16
t . string :team_id
17
17
t . string :name
18
18
t . string :domain
Original file line number Diff line number Diff line change 2
2
3
3
module SlackRubyBotServer
4
4
class Team < ActiveRecord ::Base
5
+ self . table_name = SlackRubyBotServer ::Config . teams_table
6
+
5
7
include Methods
6
8
7
9
def self . purge!
Original file line number Diff line number Diff line change 1
1
class CreateTeamsTable < ActiveRecord ::Migration [ 5.0 ]
2
2
def change
3
- create_table :teams , force : true do |t |
3
+ create_table SlackRubyBotServer :: Config . teams_table , force : true do |t |
4
4
t . string :team_id
5
5
t . string :name
6
6
t . boolean :active , default : true
Original file line number Diff line number Diff line change 14
14
# These are extensions that must be enabled in order to support this database
15
15
enable_extension 'plpgsql'
16
16
17
- create_table 'teams' , force : :cascade do |t |
17
+ create_table SlackRubyBotServer :: Config . teams_table , force : :cascade do |t |
18
18
t . string 'team_id'
19
19
t . string 'name'
20
20
t . boolean 'active' , default : true
Original file line number Diff line number Diff line change 3
3
ActiveRecord ::Schema . define do
4
4
self . verbose = false
5
5
6
- create_table :teams , force : true do |t |
6
+ create_table SlackRubyBotServer :: Config . teams_table , force : true do |t |
7
7
t . string :team_id
8
8
t . string :name
9
9
t . boolean :active , default : true
You can’t perform that action at this time.
0 commit comments