Show More
Commit Description:
utf8mb4
Commit Description:
utf8mb4
References:
File last commit:
Show/Diff file:
Action:
db/migrate/20170911091143_create_groups.rb
| 30 lines
| 1.1 KiB
| text/x-ruby
| RubyLexer
|
r822 | class CreateGroups < ActiveRecord::Migration[4.2] | |||
r672 | ||||
def change | ||||
r822 | create_table :groups, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| | |||
r672 | t.string :name | |||
t.string :description | ||||
end | ||||
r822 | create_join_table :groups, :users, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| | |||
r672 | # t.index [:group_id, :user_id] | |||
t.index [:user_id, :group_id] | ||||
end | ||||
r822 | create_join_table :problems, :groups, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| | |||
r672 | # t.index [:problem_id, :group_id] | |||
t.index [:group_id, :problem_id] | ||||
end | ||||
reversible do |change| | ||||
change.up do | ||||
GraderConfiguration.where(key: 'system.use_problem_group').first_or_create(value_type: 'boolean', value: 'false', | ||||
description: 'If true, available problem to the user will be only ones associated with the group of the user'); | ||||
end | ||||
change.down do | ||||
GraderConfiguration.where(key: 'system.use_problem_group').destroy_all | ||||
end | ||||
end | ||||
end | ||||
end | ||||