summaryrefslogtreecommitdiff
path: root/db/migrate/20200422213749_create_operations_strategies_user_lists.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200422213749_create_operations_strategies_user_lists.rb')
-rw-r--r--db/migrate/20200422213749_create_operations_strategies_user_lists.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/db/migrate/20200422213749_create_operations_strategies_user_lists.rb b/db/migrate/20200422213749_create_operations_strategies_user_lists.rb
new file mode 100644
index 00000000000..113f2f2f54a
--- /dev/null
+++ b/db/migrate/20200422213749_create_operations_strategies_user_lists.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class CreateOperationsStrategiesUserLists < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :operations_strategies_user_lists do |t|
+ t.references :strategy, index: false, foreign_key: { on_delete: :cascade, to_table: :operations_strategies }, null: false
+ t.references :user_list, index: true, foreign_key: { on_delete: :cascade, to_table: :operations_user_lists }, null: false
+
+ t.index [:strategy_id, :user_list_id], unique: true, name: :index_ops_strategies_user_lists_on_strategy_id_and_user_list_id
+ end
+ end
+end