File tree Expand file tree Collapse file tree
lib/slack-ruby-bot-server
sample_apps/sample_app_activerecord/db
spec/database_adapters/activerecord Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ module Config
55 attr_accessor :server_class
66 attr_accessor :ping
77 attr_accessor :database_adapter
8+ attr_accessor :teams_table
89
910 def reset!
1011 self . ping = nil
@@ -16,6 +17,7 @@ def reset!
1617 else
1718 raise 'One of "mongoid" or "activerecord" is required.'
1819 end
20+ self . teams_table = :teams
1921 end
2022
2123 def activerecord?
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ def self.check!
1111 end
1212
1313 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 |
1616 t . string :team_id
1717 t . string :name
1818 t . string :domain
Original file line number Diff line number Diff line change 22
33module SlackRubyBotServer
44 class Team < ActiveRecord ::Base
5+ self . table_name = SlackRubyBotServer ::Config . teams_table
6+
57 include Methods
68
79 def self . purge!
Original file line number Diff line number Diff line change 11class CreateTeamsTable < ActiveRecord ::Migration [ 5.0 ]
22 def change
3- create_table :teams , force : true do |t |
3+ create_table SlackRubyBotServer :: Config . teams_table , force : true do |t |
44 t . string :team_id
55 t . string :name
66 t . boolean :active , default : true
Original file line number Diff line number Diff line change 1414 # These are extensions that must be enabled in order to support this database
1515 enable_extension 'plpgsql'
1616
17- create_table 'teams' , force : :cascade do |t |
17+ create_table SlackRubyBotServer :: Config . teams_table , force : :cascade do |t |
1818 t . string 'team_id'
1919 t . string 'name'
2020 t . boolean 'active' , default : true
Original file line number Diff line number Diff line change 33ActiveRecord ::Schema . define do
44 self . verbose = false
55
6- create_table :teams , force : true do |t |
6+ create_table SlackRubyBotServer :: Config . teams_table , force : true do |t |
77 t . string :team_id
88 t . string :name
99 t . boolean :active , default : true
You can’t perform that action at this time.
0 commit comments