質問編集履歴

3

fix

2020/05/12 03:06

投稿

Chi_Hiro_
Chi_Hiro_

スコア1

test CHANGED
File without changes
test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  rake.task
48
48
 
49
- rake tenant:rename_tenant[huga,hoge]
49
+ rake tenant:rename_tenant[huga,hoge] # この場合current_nameにhuga、target_nameにhoge
50
50
 
51
51
 
52
52
 

2

shousai

2020/05/12 03:06

投稿

Chi_Hiro_
Chi_Hiro_

スコア1

test CHANGED
File without changes
test CHANGED
@@ -44,11 +44,25 @@
44
44
 
45
45
  ```Ruby
46
46
 
47
+ rake.task
48
+
49
+ rake tenant:rename_tenant[huga,hoge]
50
+
51
+
52
+
53
+ def self.rename_tenant(current_name, target_name)
54
+
55
+ ...
56
+
57
+ ...
58
+
47
- sql = ActiveRecord::Base.sanitize_sql_array(['ALTER SCHEMA ? RENAME TO ?', current_name, target_name])
59
+ sql = ActiveRecord::Base.sanitize_sql_array(['ALTER SCHEMA ? RENAME TO ?', current_name, target_name])
48
60
 
49
61
  sanitized_sql = ActiveRecord::Base.send(:sanitize_sql_array, sql)
50
62
 
51
63
  ActiveRecord::Base.connection.execute(sanitized_sql)
64
+
65
+ end
52
66
 
53
67
  ```
54
68
 

1

shuusei

2020/05/12 02:47

投稿

Chi_Hiro_
Chi_Hiro_

スコア1

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  ```Ruby
46
46
 
47
- sql = ActiveRecord::Base.sanitize_sql_array(['ALTER SCHEMA ? RENAME TO ?', current_name: current_name, target_name: target_name])
47
+ sql = ActiveRecord::Base.sanitize_sql_array(['ALTER SCHEMA ? RENAME TO ?', current_name, target_name])
48
48
 
49
49
  sanitized_sql = ActiveRecord::Base.send(:sanitize_sql_array, sql)
50
50