source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20110407154154_permission_for_metareview_assignment.rb | Ruby | mit | 191 | main | 787 | class PermissionForMetareviewAssignment < ActiveRecord::Migration[4.2]
def self.up
controller_id = SiteController.find_by_name('review_mapping').id
do_assignments_id = Permission.find_by_name('do assignments').id
action = 'assign_metareviewer_dynamically'
unless ControllerAction.where(site_controller_... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20201107203204_create_review_bids.rb | Ruby | mit | 191 | main | 1,015 | class CreateReviewBids < ActiveRecord::Migration[4.2]
def change
create_table :review_bids do |t|
t.integer 'priority', limit: 4
t.integer 'signuptopic_id', limit: 4
t.integer 'participant_id', limit: 4
t.datetime 'created_at'
t.datetime 'updated_at'
t.integer 'user_i... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121116081903_create_tags.rb | Ruby | mit | 191 | main | 252 | class CreateTags < ActiveRecord::Migration[4.2]
def self.up
if table_exists?(:tags) == false
create_table :tags do |t|
t.column 'tagname', :string, null: false
end
end
end
def self.down
drop_table :tags
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150515220601_alter_permissions_and_special_roles_in_participants.rb | Ruby | mit | 191 | main | 570 | class AlterPermissionsAndSpecialRolesInParticipants < ActiveRecord::Migration[4.2]
def self.up
change_table :participants do |t|
t.rename :submit_allowed, :can_submit
t.rename :review_allowed, :can_review
t.rename :take_quiz_allowed, :can_take_quiz
t.rename :special_role, :duty
end
e... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/093_add_reviewer_id_to_review_of_review_mappings.rb | Ruby | mit | 191 | main | 222 | class AddReviewerIdToReviewOfReviewMappings < ActiveRecord::Migration[4.2]
def self.up
add_column :review_of_review_mappings, :reviewer_id, :integer, null: true
rescue StandardError
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/014_create_questionnaires.rb | Ruby | mit | 191 | main | 1,329 | class CreateQuestionnaires < ActiveRecord::Migration[4.2]
def self.up
create_table 'questionnaires', force: true do |t|
t.column 'name', :string, limit: 64 # the name of the questionnaire
t.column 'instructor_id', :integer, default: 0, null: false # the id of the instructor (as user) who created the q... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/112_create_response_maps.rb | Ruby | mit | 191 | main | 6,709 | class CreateResponseMaps < ActiveRecord::Migration[4.2]
def self.up
create_table :response_maps do |t|
t.column :reviewed_object_id, :integer, :null => false
t.column :reviewer_id, :integer, :null => false
t.column :reviewee_id, :integer, :null => false
t.column :type, ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/092_add_change_handle_action.rb | Ruby | mit | 191 | main | 422 | class AddChangeHandleAction < ActiveRecord::Migration[4.2]
def self.up
controller = SiteController.find_by_name('participants')
permission = Permission.find_by_name('do assignments')
ControllerAction.create(site_controller_id: controller.id,
name: 'change_handle',
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131201175200_create_quiz_question_choices.rb | Ruby | mit | 191 | main | 574 | class CreateQuizQuestionChoices < ActiveRecord::Migration[4.2]
def self.up
create_table 'quiz_question_choices', force: true do |t|
t.column 'question_id', :integer # the question to which this advice belongs
t.column 'txt', :text # the choice to be given to the user
t.column 'iscorrect', :boole... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/135_create_sessions.rb | Ruby | mit | 191 | main | 319 | class CreateSessions < ActiveRecord::Migration[4.2]
def self.up
create_table :sessions do |t|
t.string :session_id, null: false
t.text :data
t.timestamps
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
end
def self.down
drop_table :sessions
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/032_author_feedback.rb | Ruby | mit | 191 | main | 654 | class AuthorFeedback < ActiveRecord::Migration[4.2]
def self.up
add_column 'assignments', 'author_feedback_questionnaire_id', :integer
execute 'ALTER TABLE assignments ADD CONSTRAINT `fk_assignments_author_feedback` FOREIGN KEY (author_feedback_questionnaire_id) REFERENCES questionnaire_types(id);'
# Qu... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170221162737_create_review_grades_table.rb | Ruby | mit | 191 | main | 320 | class CreateReviewGradesTable < ActiveRecord::Migration[4.2]
def change
create_table :review_grades do |t|
t.integer :participant_id
t.integer :grade_for_reviewer
t.text :comment_for_reviewer
t.datetime :review_graded_at
end
add_foreign_key :review_grades, :participants
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/009_create_questionnaire_types.rb | Ruby | mit | 191 | main | 565 | class CreateQuestionnaireTypes < ActiveRecord::Migration[4.2]
def self.up
create_table 'questionnaire_types', force: true do |t|
t.column 'name', :string, default: '', null: false
end
execute "INSERT INTO `questionnaire_types` VALUES (1,'Rubric');"
execute "INSERT INTO `questionnaire_types` VAL... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/131_rename_fields_in_assignments.rb | Ruby | mit | 191 | main | 263 | class RenameFieldsInAssignments < ActiveRecord::Migration[4.2]
def self.up
begin
remove_column :assignments, :start_date
rescue StandardError
end
add_column :assignments, :days_between_submissions, :integer
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/134_create_topic_deadlines.rb | Ruby | mit | 191 | main | 1,639 | class CreateTopicDeadlines < ActiveRecord::Migration[4.2]
def self.up
create_table :topic_deadlines do |t|
t.column 'due_at', :datetime
t.column 'deadline_type_id', :integer
t.column 'topic_id', :integer
t.column 'late_policy_id', :integer
t.column 'submission_allowed_id', :integer
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/105_update_controllers_publishing.rb | Ruby | mit | 191 | main | 318 | class UpdateControllersPublishing < ActiveRecord::Migration[4.2]
def self.up
perm = Permission.find_by_name('do assignments')
controller = SiteController.find_or_create_by(name: 'publishing')
controller.permission_id = perm.id
controller.save
Role.rebuild_cache
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131117022508_add_initial_and_final_line_number_to_review_comments.rb | Ruby | mit | 191 | main | 365 | class AddInitialAndFinalLineNumberToReviewComments < ActiveRecord::Migration[4.2]
def self.up
add_column :review_comments, :initial_line_number, :integer
add_column :review_comments, :last_line_number, :integer
end
def self.down
remove_column :review_comments, :initial_line_number
remove_column :... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/030_create_resubmission_times.rb | Ruby | mit | 191 | main | 578 | class CreateResubmissionTimes < ActiveRecord::Migration[4.2]
def self.up
create_table 'resubmission_times', force: true do |t|
t.column 'participant_id', :integer
t.column 'resubmitted_at', :datetime
end
add_index 'resubmission_times', ['participant_id'], name: 'fk_resubmission_times_particip... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/127_add_leaderboard_privacy_to_user.rb | Ruby | mit | 191 | main | 229 | class AddLeaderboardPrivacyToUser < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :leaderboard_privacy, :boolean, default: false
end
def self.down
remove_column :users, :leaderboard_privacy
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170427005520_create_plagiarism_checker_comparisons.rb | Ruby | mit | 191 | main | 548 | class CreatePlagiarismCheckerComparisons < ActiveRecord::Migration[4.2]
def change
create_table :plagiarism_checker_comparisons do |t|
t.references :plagiarism_checker_assignment_submission, index: { name: 'assignment_submission_index' }, foreign_key: true
t.string :similarity_link
t.decimal :si... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131120032234_add_is_lottery_to_assignments.rb | Ruby | mit | 191 | main | 205 | class AddIsLotteryToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :is_lottery, :boolean
end
def self.down
remove_column :assignments, :is_lottery
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131205203433_create_bids.rb | Ruby | mit | 191 | main | 224 | class CreateBids < ActiveRecord::Migration[4.2]
def self.up
create_table :bids do |t|
t.belongs_to :topic
t.belongs_to :team
t.timestamps
end
end
def self.down
drop_table :bids
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150722161550_add_question_type_to_questions.rb | Ruby | mit | 191 | main | 354 | class AddQuestionTypeToQuestions < ActiveRecord::Migration[4.2]
def self.up
add_column 'questions', 'seq', :float, default: nil
add_column 'questions', 'q_type', :string
add_column 'questions', 'size', :string
add_column 'questions', 'alternatives', :string
add_column 'questions', 'break_before', ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/050_menu_update_team_list.rb | Ruby | mit | 191 | main | 484 | class MenuUpdateTeamList < ActiveRecord::Migration[4.2]
def self.up
item = MenuItem.find_by_label('Create team')
unless item.nil?
item.name = 'List teams'
item.label = 'Add teams to assignment'
item.save
end
Role.rebuild_cache
end
def self.down
item = Menu.find_by_label('Add... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/011_create_review_strategies.rb | Ruby | mit | 191 | main | 313 | class CreateReviewStrategies < ActiveRecord::Migration[4.2]
def self.up
create_table 'review_strategies', force: true do |t|
t.column 'name', :string
end
execute "INSERT INTO `review_strategies` VALUES (1,'questionnaire');"
end
def self.down
drop_table 'review_strategies'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150527105416_convert_all_individual_assignments_to_one_member_team_assignments.rb | Ruby | mit | 191 | main | 3,246 | class ConvertAllIndividualAssignmentsToOneMemberTeamAssignments < ActiveRecord::Migration[4.2]
def self.up
# case 1 (team_num == participants_num and has no topic):
# change ParticipantReviewResponseMap -> TeamReviewResponseMap in response_maps table
# assignment_ids = [2, 13, 15, 17, 22, 24, 25, 29, ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101116184602_add_dynamic_review_fields_to_assignments.rb | Ruby | mit | 191 | main | 429 | class AddDynamicReviewFieldsToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :dynamic_reviewer_assignments_enabled, :boolean, default: 0
add_column :assignments, :dynamic_reviewer_response_time_limit_hours, :integer
end
def self.down
remove_column :assignments, :poten... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/067_update_participant_types.rb | Ruby | mit | 191 | main | 1,273 | class UpdateParticipantTypes < ActiveRecord::Migration[4.2]
def self.up
add_column :participants, :type, :string
begin
execute "ALTER TABLE `participants`
DROP FOREIGN KEY `fk_participant_assignments`"
rescue StandardError
end
begin
execute "ALTER TABLE `participants... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150730141035_rename_q_type_to_type_in_questions_table.rb | Ruby | mit | 191 | main | 208 | class RenameQTypeToTypeInQuestionsTable < ActiveRecord::Migration[4.2]
def self.up
rename_column :questions, :q_type, :type
end
def self.down
rename_column :questions, :type, :q_type
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/063_create_ta_role.rb | Ruby | mit | 191 | main | 371 | class CreateTaRole < ActiveRecord::Migration[4.2]
def self.up
parent = Role.find_by_name('Student')
child = Role.find_by_name('Instructor')
ta_role = Role.find_or_create_by(name: 'Teaching Assistant')
ta_role.parent_id = parent.id
ta_role.save
child.parent_id = ta_role.id
child.save
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20151106041226_add_is_submitted_to_response_maps.rb | Ruby | mit | 191 | main | 291 | class AddIsSubmittedToResponseMaps < ActiveRecord::Migration[4.2]
def self.up
add_column :response_maps, :isSubmitted, :string, null: true
rescue StandardError
put $ERROR_INFO
end
def self.down
remove_column :response_maps, :isSubmitted
rescue StandardError
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/044_menu_update_users.rb | Ruby | mit | 191 | main | 1,166 | class MenuUpdateUsers < ActiveRecord::Migration[4.2]
def self.up
permission = Permission.find_by_name('administer assignments')
unless permission.nil?
site_controller = SiteController.find_by_name('users')
unless site_controller.nil?
action = ControllerAction.where(['site_controller_id = ?... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/037_create_ta_mappings.rb | Ruby | mit | 191 | main | 876 | class CreateTaMappings < ActiveRecord::Migration[4.2]
def self.up
create_table :ta_mappings do |t|
t.column :ta_id, :integer
t.column :course_id, :integer
end
add_index 'ta_mappings', ['ta_id'], name: 'fk_ta_mappings_ta_id'
execute "alter table ta_mappings
add constraint f... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/082_add_new_questionnaire_types.rb | Ruby | mit | 191 | main | 522 | class AddNewQuestionnaireTypes < ActiveRecord::Migration[4.2]
def self.up
execute "UPDATE `questionnaire_types` set name = 'Review' where name in ('Review Rubric', 'Rubric')"
execute "INSERT INTO `questionnaire_types` (`id`, `name`) VALUES
(6, 'Metareview'),
(7, 'Teammate Review');"
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20140321025833_update_response_maps.rb | Ruby | mit | 191 | main | 291 | class UpdateResponseMaps < ActiveRecord::Migration[4.2]
def self.up
add_column :response_maps, :created_at, :datetime
add_column :response_maps, :updated_at, :datetime
end
def self.down
remove_column :courses, :created_at
remove_column :courses, :updated_at
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131122223434_rename_is_lottery.rb | Ruby | mit | 191 | main | 222 | class RenameIsLottery < ActiveRecord::Migration[4.2]
def self.up
rename_column :assignments, :is_lottery, :is_intelligent
end
def self.down
rename_column :assignments, :is_intelligent, :is_lottery
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/124_set_permission_for_suggestion.rb | Ruby | mit | 191 | main | 728 | class SetPermissionForSuggestion < ActiveRecord::Migration[4.2]
def self.up
permission = Permission.find_by_name('administer assignments')
controller = SiteController.find_or_create_by(name: 'suggestion')
controller.permission_id = permission.id
controller.save
permission = Permission.find_by_nam... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/130_add_popup_permission.rb | Ruby | mit | 191 | main | 239 | class AddPopupPermission < ActiveRecord::Migration[4.2]
def self.up
sc = SiteController.new
sc.name = 'popup'
sc.permission_id = 10
end
def self.down
sc = SiteController.find_by_name('popup')
sc.delete
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20171110231827_create_assignment_badges.rb | Ruby | mit | 191 | main | 313 | class CreateAssignmentBadges < ActiveRecord::Migration[4.2]
def change
create_table :assignment_badges do |t|
t.references :badge, index: true, foreign_key: true
t.references :assignment, index: true, foreign_key: true
t.integer :threshold
t.timestamps null: false
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/107_merge_questionnaire_and_type.rb | Ruby | mit | 191 | main | 1,580 | class MergeQuestionnaireAndType < ActiveRecord::Migration[4.2]
def self.up
begin
execute "ALTER TABLE `scores`
DROP FOREIGN KEY `fk_score_questionnaire_types`"
rescue StandardError
end
begin
execute "ALTER TABLE `scores`
DROP INDEX `fk_score_questionnaire_typ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111217162506_permission_for_advertise_for_partners.rb | Ruby | mit | 191 | main | 1,053 | class PermissionForAdvertiseForPartners < ActiveRecord::Migration[4.2]
def self.up
do_assignments_id = Permission.find_by_name('do assignments').id
SiteController.create name: 'advertise_for_partners', permission_id: do_assignments_id
SiteController.create name: 'join_team_requests', permission_id: do_ass... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150812150214_add_dropdown_to_assignment_questionnaires_table.rb | Ruby | mit | 191 | main | 261 | class AddDropdownToAssignmentQuestionnairesTable < ActiveRecord::Migration[4.2]
def self.up
add_column :assignment_questionnaires, :dropdown, :boolean, default: true
end
def self.down
remove_colmun :assignment_questionnaires, :dropdown
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101018010542_set_permission_for_user_keys.rb | Ruby | mit | 191 | main | 487 | class SetPermissionForUserKeys < ActiveRecord::Migration[4.2]
def self.up
permission = Permission.find_by_name('do assignments')
controller = SiteController.find_or_create_by(name: 'users')
controller.permission_id = permission.id
controller.save
action = ControllerAction.find_or_create_by(name: ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131201172300_assignments_add_columns.rb | Ruby | mit | 191 | main | 716 | class AssignmentsAddColumns < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :calculate_penalty, :boolean, null: false, default: FALSE
add_column :assignments, :late_policy_id, :integer, null: true
add_column :assignments, :is_penalty_calculated, :boolean, null: false, default: FALSE
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111023025047_add_copy_flag_to_assignments.rb | Ruby | mit | 191 | main | 218 | class AddCopyFlagToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :copy_flag, :boolean, default: false
end
def self.down
remove_column :assignments, :copy_flag
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111127035200_create_review_comments.rb | Ruby | mit | 191 | main | 338 | class CreateReviewComments < ActiveRecord::Migration[4.2]
def self.up
create_table :review_comments do |t|
t.integer :review_file_id
t.text :comment_content
t.integer :reviewer_participant_id
t.integer :file_offset
t.timestamps
end
end
def self.down
drop_table :review_c... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/064_update_teams_for_course.rb | Ruby | mit | 191 | main | 724 | class UpdateTeamsForCourse < ActiveRecord::Migration[4.2]
def self.up
begin
execute 'ALTER TABLE `teams` DROP FOREIGN KEY `fk_teams_assignments`'
rescue StandardError
end
begin
execute 'ALTER TABLE `teams` DROP INDEX `fk_teams_assignments`'
rescue StandardError
end
rename_col... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131112020128_create_quiz_display_type.rb | Ruby | mit | 191 | main | 218 | class CreateQuizDisplayType < ActiveRecord::Migration[4.2]
def self.up
TreeFolder.create name: 'Quiz', child_type: 'QuestionnaireNode'
end
def self.down
TreeFolder.find_by_name('Quiz').destroy
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150424014221_add_show_teammate_reviews_to_assignments.rb | Ruby | mit | 191 | main | 247 | class AddShowTeammateReviewsToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :show_teammate_reviews, :boolean
end
def self.down
remove_column :assignments, :show_teammate_reviews, :boolean
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/019_create_teams_users.rb | Ruby | mit | 191 | main | 675 | class CreateTeamsUsers < ActiveRecord::Migration[4.2]
def self.up
create_table 'teams_users', force: true do |t|
t.column 'team_id', :integer
t.column 'user_id', :integer
end
add_index 'teams_users', ['team_id'], name: 'fk_users_teams'
execute "alter table teams_users
add ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131124181037_alter_participants_for_special_roles.rb | Ruby | mit | 191 | main | 221 | class AlterParticipantsForSpecialRoles < ActiveRecord::Migration[4.2]
def self.up
add_column 'participants', 'special_role', :string
end
def self.down
remove_column 'participants', 'special_role'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/045_menu_update_impersonate.rb | Ruby | mit | 191 | main | 1,600 | class MenuUpdateImpersonate < ActiveRecord::Migration[4.2]
def self.up
permission1 = Permission.find_by_name('administer assignments')
permission2 = Permission.find_by_name('do assignments')
site_controller = SiteController.find_by_name('impersonate')
if site_controller.nil?
site_controller = Si... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/053_create_nodes.rb | Ruby | mit | 191 | main | 264 | class CreateNodes < ActiveRecord::Migration[4.2]
def self.up
create_table :nodes do |t|
t.column :parent_id, :integer
t.column :node_object_id, :integer
t.column :type, :string
end
end
def self.down
drop_table :nodes
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20110323134426_drop_review_and_mapping_strategies.rb | Ruby | mit | 191 | main | 1,131 | class DropReviewAndMappingStrategies < ActiveRecord::Migration[4.2]
def self.up
execute "ALTER TABLE `assignments`
DROP FOREIGN KEY fk_assignments_mapping_strategies"
execute "ALTER TABLE `assignments`
DROP FOREIGN KEY fk_assignments_review_strategies"
remove_column :assignments,... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/016_create_question_advices.rb | Ruby | mit | 191 | main | 686 | class CreateQuestionAdvices < ActiveRecord::Migration[4.2]
def self.up
create_table 'question_advices', force: true do |t|
t.column 'question_id', :integer # the question to which this advice belongs
t.column 'score', :integer # the score associated with this advice
t.column 'advice', :text # th... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111127035024_create_review_files.rb | Ruby | mit | 191 | main | 1,734 | class CreateReviewFiles < ActiveRecord::Migration[4.2]
def self.up
create_table :review_files do |t|
t.string :filepath
t.integer :author_participant_id
t.integer :version_number
t.timestamps
end
permission = Permission.find_by_name('do assignments')
site_controller = SiteCo... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/070_create_peer_reviews.rb | Ruby | mit | 191 | main | 1,251 | class CreatePeerReviews < ActiveRecord::Migration[4.2]
def self.up
create_table :peer_reviews do |t|
# Note: Table name pluralized by convention.
t.column 'reviewer_id', :integer
t.column 'reviewee_id', :integer
t.column 'assignment_id', :integer
# t.column "team_id", :integer
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131103014327_create_participant_score_views.rb | Ruby | mit | 191 | main | 683 | class CreateParticipantScoreViews < ActiveRecord::Migration[4.2]
def self.up
execute <<-SQL
CREATE VIEW participant_score_views AS SELECT r.id response_id,s.answer,q.weight,qs.name questionaire_type,qs.max_question_score,t.id as team_id,user_id as participant_id , t.parent_id as assignment_id
FROM answers ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/118_update_assignments.rb | Ruby | mit | 191 | main | 274 | class UpdateAssignments < ActiveRecord::Migration[4.2]
def self.up
execute "ALTER TABLE assignments
ADD COLUMN staggered_deadline BOOLEAN"
execute "ALTER TABLE assignments
ADD COLUMN start_date DATETIME"
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111201222103_add_instruction_loc_to_questionnaire.rb | Ruby | mit | 191 | main | 225 | class AddInstructionLocToQuestionnaire < ActiveRecord::Migration[4.2]
def self.up
add_column :questionnaires, :instruction_loc, :text
end
def self.down
remove_column :questionnaires, :instruction_loc
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/041_downcase_permissions.rb | Ruby | mit | 191 | main | 427 | class DowncasePermissions < ActiveRecord::Migration[4.2]
def self.up
permissions = Permission.all
permissions.each do |permission|
permission.name = permission.name.downcase
permission.save
end
Role.rebuild_cache
end
def self.down
permissions = Permission.all
permissions.each... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150106104625_add_round_to_response_maps.rb | Ruby | mit | 191 | main | 210 | class AddRoundToResponseMaps < ActiveRecord::Migration[4.2]
def self.up
add_column 'response_maps', 'round', :integer
end
def self.down
remove_column 'response_maps', 'round', :integer
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20191124025300_add_lock_to_responses.rb | Ruby | mit | 191 | main | 275 | class AddLockToResponses < ActiveRecord::Migration[4.2]
def change
create_table :locks do |t|
t.integer :timeout_period
t.timestamps
end
add_reference :locks, :user, foreign_key: true
add_reference :locks, :lockable, polymorphic: true
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/021_create_reviews.rb | Ruby | mit | 191 | main | 728 | class CreateReviews < ActiveRecord::Migration[4.2]
def self.up
create_table 'reviews', force: true do |t|
t.column 'review_mapping_id', :integer
t.column 'review_num_for_author', :integer
t.column 'review_num_for_reviewer', :integer
t.column 'ignore', :boolean, default: 0
t.column 'a... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20151107195943_add_is_submitted_to_responses.rb | Ruby | mit | 191 | main | 280 | class AddIsSubmittedToResponses < ActiveRecord::Migration[4.2]
def self.up
add_column :responses, :isSubmitted, :string, null: true
rescue StandardError
put $ERROR_INFO
end
def self.down
remove_column :responses, :isSubmitted
rescue StandardError
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170426030947_update_survey_deployments.rb | Ruby | mit | 191 | main | 356 | class UpdateSurveyDeployments < ActiveRecord::Migration[4.2]
change_table :survey_deployments do |t|
t.rename :course_id, :parent_id
t.rename :course_evaluation_id, :questionnaire_id
end
def change
add_column :survey_deployments, :global_survey_id, :integer, null: true
add_foreign_key :survey_dep... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170428233048_update_survey_questionnaire_to_assignment_survey_questionnaire.rb | Ruby | mit | 191 | main | 234 | class UpdateSurveyQuestionnaireToAssignmentSurveyQuestionnaire < ActiveRecord::Migration[4.2]
def change
execute "UPDATE questionnaires set type = 'AssignmentSurveyQuestionnaire' where type in ('SurveyQuestionnaire')"
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131205185858_add_participant_id_to_quiz_response.rb | Ruby | mit | 191 | main | 224 | class AddParticipantIdToQuizResponse < ActiveRecord::Migration[4.2]
def self.up
add_column :quiz_responses, :participant_id, :integer
end
def self.down
remove_column :quiz_responses, :participant_id
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/115_create_score_caches.rb | Ruby | mit | 191 | main | 517 | class CreateScoreCaches < ActiveRecord::Migration[4.2]
def self.up
create_table :score_caches do |t|
t.column 'object_id', :integer, default: 0, null: false
t.column 'assignment_id', :integer, default: 0, null: true
t.column 'course_id', :integer, default: 0, null: true
t.column 'score', :... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101001183244_update_menu_delete_object.rb | Ruby | mit | 191 | main | 295 | class UpdateMenuDeleteObject < ActiveRecord::Migration[4.2]
def self.up
permission = Permission.find_by_name('administer assignments')
site_controller = SiteController.create(name: 'delete_object', permission_id: permission.id)
Role.rebuild_cache
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/004_create_users.rb | Ruby | mit | 191 | main | 1,038 | class CreateUsers < ActiveRecord::Migration[4.2]
def self.up
create_table 'users', force: true do |t|
t.column 'name', :string, default: '', null: false
t.column 'password', :string, limit: 40, default: '', null: false
t.column 'role_id', :integer, default: 0, null: false
t.column 'passwor... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20201105175651_add_review_choosing_algorthm_to_assignments.rb | Ruby | mit | 191 | main | 268 | class AddReviewChoosingAlgorthmToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :bidding_for_reviews_enabled, :boolean, default: false
end
def self.down
remove_column :assignments, :bidding_for_reviews_enabled
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150809200412_change_seq_field_in_questions_table_from_float_to_decimal.rb | Ruby | mit | 191 | main | 245 | class ChangeSeqFieldInQuestionsTableFromFloatToDecimal < ActiveRecord::Migration[4.2]
def self.up
change_column :questions, :seq, :decimal, precision: 6, scale: 2
end
def self.down
change_column :questions, :seq, :float
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/017_create_assignments.rb | Ruby | mit | 191 | main | 2,278 | class CreateAssignments < ActiveRecord::Migration[4.2]
def self.up
create_table 'assignments', force: true do |t|
t.column 'created_at', :datetime
t.column 'updated_at', :datetime
t.column 'name', :string
t.column 'directory_path', :string
t.column 'submitter_count', :integer, limit:... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/129_menu_update_leaderboard.rb | Ruby | mit | 191 | main | 2,073 | class MenuUpdateLeaderboard < ActiveRecord::Migration[4.2]
def self.up
# get Permission entry
permission1 = Permission.find_by_name('public actions - execute')
# is there already a leaderboard?
site_controller = SiteController.find_by_name('leaderboard')
# if not, create a leaderboard
if site... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/102_standardize_review_mappings.rb | Ruby | mit | 191 | main | 6,769 | class StandardizeReviewMappings < ActiveRecord::Migration[4.2]
def self.up
begin
execute "ALTER TABLE `review_mappings`
DROP FOREIGN KEY `fk_review_mapping_assignments`"
rescue StandardError
end
begin
execute "ALTER TABLE `review_mappings`
DROP INDEX `fk_revi... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170110193407_remove_leaderboards_table.rb | Ruby | mit | 191 | main | 274 | class RemoveLeaderboardsTable < ActiveRecord::Migration[4.2]
def self.up
drop_table :leaderboards
end
def self.down
create_table :leaderboards, force: true do |t|
t.integer :questionnaire_type_id
t.text :name
t.text :qtype
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/039_update_review_scores.rb | Ruby | mit | 191 | main | 530 | class UpdateReviewScores < ActiveRecord::Migration[4.2]
def self.up
add_column 'review_scores', 'questionnaire_type_id', :integer
execute "ALTER TABLE review_scores
ADD CONSTRAINT fk_review_scores_questionnaire_type_id
FOREIGN KEY (questionnaire_type_id) references questionnaire_typ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160511000316_remove_rereview_and_resubmission_deadline_types.rb | Ruby | mit | 191 | main | 207 | class RemoveRereviewAndResubmissionDeadlineTypes < ActiveRecord::Migration[4.2]
def change
DeadlineType.find_by(name: 'resubmission').delete
DeadlineType.find_by(name: 'rereview').delete
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131203051315_create_quiz_responses.rb | Ruby | mit | 191 | main | 320 | class CreateQuizResponses < ActiveRecord::Migration[4.2]
def self.up
create_table :quiz_responses do |t|
t.text :response
t.references :assignment
t.references :questionnaire
t.references :question
t.timestamps
end
end
def self.down
drop_table :quiz_responses
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121116154051_create_bmapping_ratings.rb | Ruby | mit | 191 | main | 424 | class CreateBmappingRatings < ActiveRecord::Migration[4.2]
def self.up
if table_exists?(:bmapping_ratings) == false
create_table :bmapping_ratings do |t|
t.column 'bmapping_id', :integer, null: false
t.column 'user_id', :integer, null: false
t.column 'rating', :integer, null: false
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20180926160031_update_tree_folder_table.rb | Ruby | mit | 191 | main | 307 | class UpdateTreeFolderTable < ActiveRecord::Migration[4.2]
def up
tree_folder = TreeFolder.find_by_id(11)
tree_folder.name = 'Bookmark Rating'
tree_folder.save
end
def down
tree_folder = TreeFolder.find_by_id(11)
tree_folder.name = 'Bookmarkrating'
tree_folder.save
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20110512155258_rename_drop_topic.rb | Ruby | mit | 191 | main | 324 | class RenameDropTopic < ActiveRecord::Migration[4.2]
def self.up
drop_topic = DeadlineType.find_by_name('drop topic')
drop_topic.name = 'drop_topic'
drop_topic.save
end
def self.down
drop_topic = DeadlineType.find_by_name('drop_topic')
drop_topic.name = 'drop topic'
drop_topic.save
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/097_create_feedback_mappings.rb | Ruby | mit | 191 | main | 4,540 | class CreateFeedbackMappings < ActiveRecord::Migration[4.2]
def self.up
create_table :feedback_mappings do |t|
t.column :reviewer_id, :integer, null: false
t.column :reviewee_id, :integer, null: false
t.column :reviewed_object_id, :integer, null: false
end
execute "ALTER TABLE `feed... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150105172921_add_used_in_round_to_assignment_questionnaires.rb | Ruby | mit | 191 | main | 258 | class AddUsedInRoundToAssignmentQuestionnaires < ActiveRecord::Migration[4.2]
def self.up
add_column 'assignment_questionnaires', 'used_in_round', :integer
end
def self.down
remove_column 'assignment_questionnaires', 'used_in_round'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131201172400_late_policies_add_columns.rb | Ruby | mit | 191 | main | 1,399 | class LatePoliciesAddColumns < ActiveRecord::Migration[4.2]
def self.up
change_column :late_policies, :penalty_per_unit, :float
add_column :late_policies, :times_used, :integer, null: false, default: 0
add_column :late_policies, :instructor_id, :integer, null: false
add_column :late_policies, :polic... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150726191229_rename_scores_table_to_answers.rb | Ruby | mit | 191 | main | 269 | class RenameScoresTableToAnswers < ActiveRecord::Migration[4.2]
def self.up
rename_table :scores, :answers
rename_column :answers, :score, :answer
end
def self.down
rename_column :answers, :answer, :score
rename_table :answers, :scores
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131124173225_create_teamrole_assignment.rb | Ruby | mit | 191 | main | 878 | class CreateTeamroleAssignment < ActiveRecord::Migration[4.2]
def self.up
create_table 'teamrole_assignment', force: true do |t|
t.integer 'team_roleset_id'
t.integer 'assignment_id'
end
execute "ALTER TABLE `teamrole_assignment`
ADD CONSTRAINT `fk_teamrole_assignment_team_roleset... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20151011201717_add_can_review_same_topic_to_assignments.rb | Ruby | mit | 191 | main | 251 | class AddCanReviewSameTopicToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :can_review_same_topic, :boolean, default: true
end
def self.down
remove_colmun :assignments, :can_review_same_topic
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20161008030832_add_grade_for_submission_and_comment_for_submission_in_teams_table.rb | Ruby | mit | 191 | main | 376 | class AddGradeForSubmissionAndCommentForSubmissionInTeamsTable < ActiveRecord::Migration[4.2]
def self.up
add_column :teams, :grade_for_submission, :integer, default: nil
add_column :teams, :comment_for_submission, :text, default: nil
end
def self.down
remove_column :teams, :comment_for_submission
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/086_create_notifications.rb | Ruby | mit | 191 | main | 651 | class CreateNotifications < ActiveRecord::Migration[4.2]
def self.up
create_table :notification_limits do |t|
t.column :user_id, :integer, null: false
t.column :assignment_id, :integer, null: true
t.column :questionnaire_id, :integer, null: true
t.column :limit, :integer, null: false, defa... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/031_create_due_dates.rb | Ruby | mit | 191 | main | 1,765 | class CreateDueDates < ActiveRecord::Migration[4.2]
def self.up
create_table 'due_dates', force: true do |t|
t.column 'due_at', :datetime
t.column 'deadline_type_id', :integer
t.column 'assignment_id', :integer
t.column 'late_policy_id', :integer
t.column 'submission_allowed_id', :in... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20171019210144_create_answer_tags.rb | Ruby | mit | 191 | main | 366 | class CreateAnswerTags < ActiveRecord::Migration[4.2]
def change
create_table :answer_tags do |t|
t.references :answer, index: true, foreign_key: true
t.references :tag_prompt_deployment, index: true, foreign_key: true
t.references :user, index: true, foreign_key: true
t.string :value
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/073_remove_missing_controllers.rb | Ruby | mit | 191 | main | 1,028 | class RemoveMissingControllers < ActiveRecord::Migration[4.2]
def self.up
controller = SiteController.find_by_name('courses_users')
if controller
ControllerAction.where(site_controller_id: controller.id).find_each do |action|
MenuItem.where(controller_action_id: action.id).find_each(&:destroy)
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160817151255_change_assignment_id_in_due_dates_table_to_parent_id.rb | Ruby | mit | 191 | main | 344 | class ChangeAssignmentIdInDueDatesTableToParentId < ActiveRecord::Migration[4.2]
def self.up
remove_foreign_key :due_dates, column: :assignment_id
rename_column :due_dates, :assignment_id, :parent_id
end
def self.down
rename_column :due_dates, :parent_id, :assignment_id
add_foreign_key :due_dates... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150804041459_redesign_score_view.rb | Ruby | mit | 191 | main | 951 | class RedesignScoreView < ActiveRecord::Migration[4.2]
def self.up
execute <<-SQL
CREATE VIEW score_views AS SELECT ques.weight question_weight,ques.type AS type,
q1.id "q1_id",q1.NAME AS q1_name,q1.instructor_id AS q1_instructor_id,q1.private AS q1_private,
q1.min_question_score AS q1_min_quest... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/090_add_handle_to_participants.rb | Ruby | mit | 191 | main | 642 | class AddHandleToParticipants < ActiveRecord::Migration[4.2]
def self.up
add_column :participants, :handle, :string, null: true
AssignmentParticipant.find_each do |participant|
if participant.handle.nil?
user = User.find(participant.user_id)
participant.handle = if user.handle.nil?
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/076_update_menus.rb | Ruby | mit | 191 | main | 4,887 | class UpdateMenus < ActiveRecord::Migration[4.2]
def self.up
site_controller = SiteController.find_by_name('tree_display')
drill_action = ControllerAction.find_or_create_by(name: 'drill')
drill_action.site_controller_id = site_controller.id
drill_action.save
questionnaires_action = ControllerAct... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/015_create_questions.rb | Ruby | mit | 191 | main | 711 | class CreateQuestions < ActiveRecord::Migration[4.2]
def self.up
create_table 'questions', force: true do |t|
t.column 'txt', :text # the question content
t.column 'true_false', :boolean # is this a true/false question?
t.column 'weight', :integer # the scoring weight
t.column 'questionnai... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/008_create_wiki_types.rb | Ruby | mit | 191 | main | 331 | class CreateWikiTypes < ActiveRecord::Migration[4.2]
def self.up
create_table 'wiki_types', force: true do |t|
t.column 'name', :string, default: '', null: false
end
execute "INSERT INTO `wiki_types` VALUES (1,'No'),(2,'MediaWiki'),(3,'DokuWiki');"
end
def self.down
drop_table 'wiki_types'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.