Show More
Commit Description:
merge
Commit Description:
merge
References:
File last commit:
Show/Diff file:
Action:
db/migrate/20170911091143_create_groups.rb | 30 lines | 916 B | text/x-ruby | RubyLexer |
class CreateGroups < ActiveRecord::Migration
def change
create_table :groups do |t|
t.string :name
t.string :description
end
create_join_table :groups, :users do |t|
# t.index [:group_id, :user_id]
t.index [:user_id, :group_id]
end
create_join_table :problems, :groups do |t|
# 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