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/20111202011414_update_micropayment_to_sign_up_topic.rb | Ruby | mit | 191 | main | 235 | class UpdateMicropaymentToSignUpTopic < ActiveRecord::Migration[4.2]
def self.up
change_column :sign_up_topics, :micropayment, :integer, default: 0
# SignUpTopic.update_all ["micropayment", 0]
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/006_create_deadline_types.rb | Ruby | mit | 191 | main | 379 | class CreateDeadlineTypes < ActiveRecord::Migration[4.2]
def self.up
create_table 'deadline_types', force: true do |t|
t.column 'name', :string, limit: 32
end
execute "INSERT INTO `deadline_types` VALUES (1,'submission'),(2,'review'),(3,'resubmission'),(4,'rereview'),(5,'review of review');"
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/042_create_invitation_table.rb | Ruby | mit | 191 | main | 1,116 | class CreateInvitationTable < ActiveRecord::Migration[4.2]
def self.up
create_table :invitations do |t|
# Note: Table name pluralized by convention.
t.column :assignment_id, :integer
t.column :from_id, :integer
t.column :to_id, :integer
t.column :reply_status, :char
end
add_... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121116154318_create_bmappings.rb | Ruby | mit | 191 | main | 572 | class CreateBmappings < ActiveRecord::Migration[4.2]
def self.up
if table_exists?(:bmappings) == false
create_table :bmappings do |t|
t.column 'bookmark_id', :integer, null: false
t.column 'title', :string
t.column 'user_id', :integer, null: false
t.column 'description', :str... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/095_remove_additional_feedback.rb | Ruby | mit | 191 | main | 926 | class RemoveAdditionalFeedback < ActiveRecord::Migration[4.2]
# delete any duplicate feedback objects. Keep only the most current
def self.up
entries = ActiveRecord::Base.connection.select_all('SELECT * FROM review_feedbacks f1 WHERE review_id IN (SELECT review_id FROM `review_feedbacks` GROUP BY review_id HAVI... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/066_create_team_user_nodes.rb | Ruby | mit | 191 | main | 546 | class CreateTeamUserNodes < ActiveRecord::Migration[4.2]
def self.up
begin
remove_column :teams_users, :assignment_id
rescue StandardError
end
teamsusers = TeamsUser.all
teamsusers.each do |user|
parent = TeamNode.find_by_node_object_id(user.team_id)
if parent
TeamUserN... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/068_create_comments.rb | Ruby | mit | 191 | main | 1,349 | class CreateComments < ActiveRecord::Migration[4.2]
def self.up
create_table :comments do |t|
t.column :participant_id, :integer, null: false
t.column :private, :boolean, null: false
t.column :comment, :text, null: false
end
participants = Participant.all
participants.each do |parti... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/048_menu_update_grades.rb | Ruby | mit | 191 | main | 819 | class MenuUpdateGrades < ActiveRecord::Migration[4.2]
def self.up
permission1 = Permission.find_by_name('administer assignments')
site_controller = SiteController.find_or_create_by(name: 'grades')
site_controller.permission_id = permission1.id
site_controller.builtin = 0
site_controller.save
R... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20151228015657_remove_questionnaire_ids_from_assignments.rb | Ruby | mit | 191 | main | 743 | class RemoveQuestionnaireIdsFromAssignments < ActiveRecord::Migration[4.2]
def change
execute 'alter table assignments drop foreign key `fk_assignments_review_of_review_questionnaires`;'
execute 'alter table assignments drop foreign key `fk_assignments_review_questionnaires`;'
remove_column :assignments,... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20260220220433_create_instructor_review_scores.rb | Ruby | mit | 191 | main | 401 | class CreateInstructorReviewScores < ActiveRecord::Migration[5.1]
def change
create_table :instructor_review_scores do |t|
t.integer :response_id, null: false
t.float :score
t.text :feedback
t.timestamps
end
add_index :instructor_review_scores, :response_id, unique: true
add_f... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/046_menu_update_import_file.rb | Ruby | mit | 191 | main | 833 | class MenuUpdateImportFile < ActiveRecord::Migration[4.2]
def self.up
permission1 = Permission.find_by_name('administer assignments')
site_controller = SiteController.find_or_create_by(name: 'import_file')
site_controller.permission_id = permission1.id
site_controller.builtin = 0
site_controller.s... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121127013927_add_bookmarkrating_folder_nodes.rb | Ruby | mit | 191 | main | 799 | class AddBookmarkratingFolderNodes < ActiveRecord::Migration[4.2]
def self.up
Node.where(['type in ("QuestionnaireTypeNode","QuestionnaireNode")']).find_each(&:destroy)
parent = TreeFolder.find_by_name('Questionnaires')
pNode = FolderNode.find_by_node_object_id(parent.id)
fnode = TreeFolder.create(n... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/040_update_review_feedbacks.rb | Ruby | mit | 191 | main | 352 | class UpdateReviewFeedbacks < ActiveRecord::Migration[4.2]
def self.up
rename_column :review_feedbacks, :user_id, :author_id
rename_column :review_feedbacks, :txt, :additional_comment
end
def self.down
rename_column :review_feedbacks, :author_id, :user_id
rename_column :review_feedbacks, :add... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/125_add_flag_thre_to_due_dates.rb | Ruby | mit | 191 | main | 302 | class AddFlagThreToDueDates < ActiveRecord::Migration[4.2]
def self.up
add_column :due_dates, :flag, :boolean, default: false
add_column :due_dates, :threshold, :integer, default: 1
end
def self.down
remove_column :due_dates, :flag
remove_column :due_dates, :threshold
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/022_create_review_of_review_mappings.rb | Ruby | mit | 191 | main | 1,596 | class CreateReviewOfReviewMappings < ActiveRecord::Migration[4.2]
def self.up
create_table 'review_of_review_mappings', force: true do |t|
t.column 'review_mapping_id', :integer
t.column 'review_reviewer_id', :integer
t.column 'review_id', :integer
t.column 'assignment_id', :integer, limit... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20110324001445_permission_for_review_mapping.rb | Ruby | mit | 191 | main | 870 | class PermissionForReviewMapping < 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
%w[show_available_submissions assign_reviewer_dynamically].each do |action|
unless ControllerA... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/035_add_survey_deployment.rb | Ruby | mit | 191 | main | 233 | class AddSurveyDeployment < ActiveRecord::Migration[4.2]
def self.up
add_column 'survey_responses', 'survey_deployment_id', :integer
end
def self.down
remove_column 'survey_responses', 'survey_deployment_id'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121128235814_create_bookmark_tags.rb | Ruby | mit | 191 | main | 225 | class CreateBookmarkTags < ActiveRecord::Migration[4.2]
def self.up
create_table :bookmark_tags do |t|
t.string :tag_name
t.timestamps
end
end
def self.down
drop_table :bookmark_tags
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/078_rename_peer_review_questionnaire_id_to_teammate_questionnaire_id_in_assignments.rb | Ruby | mit | 191 | main | 436 | class RenamePeerReviewQuestionnaireIdToTeammateQuestionnaireIdInAssignments < ActiveRecord::Migration[4.2]
def self.up
execute 'ALTER TABLE `assignments` CHANGE `peer_review_questionnaire_id` `teammate_review_questionnaire_id` INT( 10 ) NULL DEFAULT NULL'
end
def self.down
execute 'ALTER TABLE `assignmen... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/128_create_leaderboards.rb | Ruby | mit | 191 | main | 916 | class CreateLeaderboards < ActiveRecord::Migration[4.2]
def self.up
create_table :leaderboards do |t|
t.column :questionnaire_type_id, :integer
t.column :name, :string
t.column :qtype, :string
end
Leaderboard.create(questionnaire_type_id: 0, name: 'Overall Grade', qtype: '0') # Overall g... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160510235034_remove_rereview_and_resubmission_deadlines.rb | Ruby | mit | 191 | main | 379 | class RemoveRereviewAndResubmissionDeadlines < ActiveRecord::Migration[4.2]
def change
execute 'alter table due_dates drop foreign key `fk_due_date_rereview_allowed`;'
execute 'alter table due_dates drop foreign key `fk_due_date_resubmission_allowed`;'
remove_column :due_dates, :resubmission_allowed_id
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131123213736_remove_quiz_question_type_from_questionnaires.rb | Ruby | mit | 191 | main | 239 | class RemoveQuizQuestionTypeFromQuestionnaires < ActiveRecord::Migration[4.2]
def self.up
remove_column :questionnaires, :quiz_question_type
end
def self.down
add_column :questionnaires, :quiz_question_type, :text
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131124180940_create_team_rolesets_maps.rb | Ruby | mit | 191 | main | 738 | class CreateTeamRolesetsMaps < ActiveRecord::Migration[4.2]
def self.up
create_table :team_rolesets_maps do |t|
t.integer :team_rolesets_id
t.integer :team_role_id
t.timestamps
end
execute "ALTER TABLE `team_rolesets_maps`
ADD CONSTRAINT fk_team_rolesets_id
FOREIGN KEY (team_role... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111122004447_add_comments_advertise_for_partners_to_team.rb | Ruby | mit | 191 | main | 301 | class AddCommentsAdvertiseForPartnersToTeam < ActiveRecord::Migration[4.2]
def self.up
add_column :teams, :comment, :text
add_column :teams, :advertise_for_partner, :boolean
end
def self.down
remove_column :teams, :advertise_for_partner
remove_column :teams, :comment
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20200421235620_create_sample_reviews.rb | Ruby | mit | 191 | main | 220 | class CreateSampleReviews < ActiveRecord::Migration[4.2]
def change
create_table :sample_reviews do |t|
t.integer :assignment_id
t.integer :response_id
t.timestamps null: false
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20180427030840_remove_duplicates_deadline_types.rb | Ruby | mit | 191 | main | 273 | class RemoveDuplicatesDeadlineTypes < ActiveRecord::Migration[4.2]
def up
execute <<-SQL
update due_dates set deadline_type_id=7 where deadline_type_id=9
SQL
execute <<-SQL
delete from deadline_types where id=9
SQL
end
def down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/060_menu_update_tree_display.rb | Ruby | mit | 191 | main | 2,758 | class MenuUpdateTreeDisplay < ActiveRecord::Migration[4.2]
def self.up
permission1 = Permission.find_by_name('administer assignments')
menu = MenuItem.find_by_label('Assignment Creation')
menu.delete if menu
menu = MenuItem.find_by_label('Participants')
menu.delete if menu
menu = MenuItem.find... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150526225814_rename_signed_up_users_to_signed_up_teams.rb | Ruby | mit | 191 | main | 223 | class RenameSignedUpUsersToSignedUpTeams < ActiveRecord::Migration[4.2]
def self.up
rename_table :signed_up_users, :signed_up_teams
end
def self.down
rename_table :signed_up_teams, :signed_up_users
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131029020318_create_score_views.rb | Ruby | mit | 191 | main | 1,055 | class CreateScoreViews < 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_q... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/057_create_questionnaire_nodes.rb | Ruby | mit | 191 | main | 429 | class CreateQuestionnaireNodes < ActiveRecord::Migration[4.2]
def self.up
questionnaires = Questionnaire.all
questionnaires.each do |questionnaire|
parent = QuestionnaireTypeNode.find_by_node_object_id(questionnaire.type_id)
QuestionnaireNode.create(node_object_id: questionnaire.id, parent_id: par... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/080_correct_questionnaire_type_in_review_scores.rb | Ruby | mit | 191 | main | 711 | class CorrectQuestionnaireTypeInReviewScores < ActiveRecord::Migration[4.2]
def self.up
review_rubric = ActiveRecord::Base.connection.select_one("select * from questionnaire_types where name = 'Review Rubric'")
if review_rubric
execute 'update `review_scores` set questionnaire_type_id = ' + review_rubr... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/077_repl0_vals_in_auth_fb.rb | Ruby | mit | 191 | main | 360 | class Repl0ValsInAuthFb < ActiveRecord::Migration[4.2]
def self.up
execute ' ALTER TABLE `assignments` CHANGE `author_feedback_questionnaire_id` `author_feedback_questionnaire_id` INT( 11 ) NULL'
execute 'UPDATE `assignments` SET `author_feedback_questionnaire_id` = NULL WHERE `author_feedback_questionnaire_i... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20110410232719_topic_review_threshold.rb | Ruby | mit | 191 | main | 236 | class TopicReviewThreshold < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :review_topic_threshold, :integer, default: 0
end
def self.down
remove_column :assignments, :review_topic_threshold
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121204121644_add_bookmark_rating_rubric_id_to_signup_topic.rb | Ruby | mit | 191 | main | 355 | class AddBookmarkRatingRubricIdToSignupTopic < ActiveRecord::Migration[4.2]
def self.up
# if(column_exists?(:sign_up_topics, :bookmark_rating_rubric_id)==false)
add_column :sign_up_topics, :bookmark_rating_rubric_id, :integer, default: nil
# end
end
def self.down
remove_column :sign_up_topics, :b... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/123_add_column_allow_suggestions_to_assignments.rb | Ruby | mit | 191 | main | 232 | class AddColumnAllowSuggestionsToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :allow_suggestions, :boolean
end
def self.down
remove_column :assignments, :allow_suggestions
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20151228012141_remove_wiki_type_from_assignment.rb | Ruby | mit | 191 | main | 248 | class RemoveWikiTypeFromAssignment < ActiveRecord::Migration[4.2]
def self.up
execute 'alter table assignments drop foreign key `fk_assignments_wiki_types`;'
remove_column :assignments, :wiki_type_id
drop_table 'wiki_types'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121116153522_create_bookmarks.rb | Ruby | mit | 191 | main | 404 | class CreateBookmarks < ActiveRecord::Migration[4.2]
def self.up
if table_exists?(:bookmarks) == false
create_table :bookmarks do |t|
t.column 'url', :string, null: false
t.column 'discoverer_user_id', :integer, null: false
t.column 'user_count', :integer, null: false
t.time... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20120829054506_add_delayed_job_id_to_duedates.rb | Ruby | mit | 191 | main | 209 | class AddDelayedJobIdToDuedates < ActiveRecord::Migration[4.2]
def self.up
add_column :due_dates, :delayed_job_id, :integer
end
def self.down
remove_column :due_dates, :delayed_job_id
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/132_update_fields_in_sign_up_topics.rb | Ruby | mit | 191 | main | 225 | class UpdateFieldsInSignUpTopics < ActiveRecord::Migration[4.2]
def self.up
remove_column :sign_up_topics, :start_date
remove_column :sign_up_topics, :due_date
rescue StandardError
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20200322210139_add_bookmark_questionnaire_to_menu.rb | Ruby | mit | 191 | main | 833 | class AddBookmarkQuestionnaireToMenu < ActiveRecord::Migration[4.2]
def self.up
site_controller = SiteController.find_by_name('tree_display')
bookmarkreview_rubrics_action = ControllerAction.find_or_create_by(name: 'goto_bookmark_reviews')
bookmarkreview_rubrics_action.site_controller_id = site_control... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/027_create_review_of_reviews.rb | Ruby | mit | 191 | main | 743 | class CreateReviewOfReviews < ActiveRecord::Migration[4.2]
def self.up
create_table 'review_of_reviews', force: true do |t|
t.column 'reviewed_at', :datetime
t.column 'review_of_review_mapping_id', :integer
t.column 'review_num_for_author', :integer
t.column 'review_num_for_reviewer', :int... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/001_initialize_goldberg.rb | Ruby | mit | 191 | main | 35,647 | class InitializeGoldberg < ActiveRecord::Migration[4.2]
def self.up
create_table 'goldberg_permissions', force: true do |t|
t.column 'name', :string, default: '', null: false
end
execute "INSERT INTO `goldberg_permissions` VALUES (1,'Administer site'),(2,'Public pages - edit'),(3,'Public pages - vie... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20141111010259_add_index_to_response_maps.rb | Ruby | mit | 191 | main | 650 | class AddIndexToResponseMaps < ActiveRecord::Migration[4.2]
def self.up
# add_index :response_maps, :reviewee_id
# add_index :response_maps, :reviewer_id
# add_index :response_maps, :reviewed_object_id
# add_index :teams_users, :user_id
# add_index :score_caches, :reviewee_id
# add_index :r... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/081_create_scores.rb | Ruby | mit | 191 | main | 1,110 | class CreateScores < ActiveRecord::Migration[4.2]
def self.up
create_table :scores do |t|
t.column :instance_id, :integer, null: false
t.column :question_id, :integer, null: false
t.column :questionnaire_type_id, :integer, null: false
t.column :score, :integer, null: true
t.column :c... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/100_update_controllers_student_task.rb | Ruby | mit | 191 | main | 809 | class UpdateControllersStudentTask < ActiveRecord::Migration[4.2]
def self.up
perm = Permission.find_by_name('do assignments')
controller = SiteController.find_by_name('student_assignment')
controller.name = 'student_task'
controller.save
item = MenuItem.find_by_name('student_assignment')
ite... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160326205445_convert_round_in_responses_table_from_nil_to_specific_round_num.rb | Ruby | mit | 191 | main | 5,382 | class ConvertRoundInResponsesTableFromNilToSpecificRoundNum < ActiveRecord::Migration[4.2]
def change
# 1st kind of assignment which has both 'review' and 'rereview' deadline type.
# this kind of assignment only has one round of 'review' deadline.
index = 0
assignments = Assignment.where(['id in (?)',... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111122004351_create_join_team_requests.rb | Ruby | mit | 191 | main | 350 | class CreateJoinTeamRequests < ActiveRecord::Migration[4.2]
def self.up
create_table :join_team_requests do |t|
t.column :participant_id, :integer
t.column :team_id, :integer
t.column :comments, :text
t.column :status, :char
t.timestamps
end
end
def self.down
drop_table ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20120619041353_create_delayed_jobs.rb | Ruby | mit | 191 | main | 1,162 | class CreateDelayedJobs < ActiveRecord::Migration[4.2]
def self.up
create_table :delayed_jobs, force: true do |table|
table.integer :priority, default: 0 # Allows some jobs to jump to the front of the queue
table.integer :attempts, default: 0 # Provides for retries, but still fail eventual... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/052_update_participants.rb | Ruby | mit | 191 | main | 440 | class UpdateParticipants < ActiveRecord::Migration[4.2]
def self.up
add_column 'participants', 'grade', :float
add_column 'participants', 'comments_to_student', :text
add_column 'participants', 'private_instructor_comments', :text
end
def self.down
remove_column 'participants', 'grade'
remove... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160510232957_change_rereview_and_resubmission_deadlines.rb | Ruby | mit | 191 | main | 610 | class ChangeRereviewAndResubmissionDeadlines < ActiveRecord::Migration[4.2]
def change
resubmission_deadlines = DueDate.where(deadline_type_id: 3)
resubmission_deadlines.each do |resubmission_deadline|
resubmission_deadline.deadline_type_id = 1
resubmission_deadline.submission_allowed_id = 3
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121208064006_create_new_deadline_types.rb | Ruby | mit | 191 | main | 297 | class CreateNewDeadlineTypes < ActiveRecord::Migration[4.2]
def self.up
DeadlineType.create name: 'signup'
DeadlineType.create name: 'team_formation'
end
def self.down
DeadlineType.find_by_name('signup').destroy
DeadlineType.find_by_name('team_formation').destroy
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121116074455_create_topics_bmappings.rb | Ruby | mit | 191 | main | 397 | class CreateTopicsBmappings< ActiveRecord::Migration[4.2]
def self.up
if table_exists?(:bmappings_sign_up_topics) == false
create_table :bmappings_sign_up_topics, id: false do |t|
t.column 'sign_up_topic_id', :integer, null: false
t.column 'bmapping_id', :integer, null: false
end
e... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170221202506_move_grades_comments_for_reviewer_and_review_time_from_participants_table_to_review_grades_table.rb | Ruby | mit | 191 | main | 528 | class MoveGradesCommentsForReviewerAndReviewTimeFromParticipantsTableToReviewGradesTable < ActiveRecord::Migration[4.2]
def change
Participant.all.each do |participant|
begin
review_grades = ReviewGrade.create(
participant_id: participant.id,
grade_for_reviewer: participant.grade... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/091_add_time_stamp_to_feedback.rb | Ruby | mit | 191 | main | 244 | class AddTimeStampToFeedback < ActiveRecord::Migration[4.2]
def self.up
add_column :review_feedbacks, :created_at, :datetime, null: true
add_column :review_feedbacks, :updated_at, :datetime, null: true
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/012_create_courses.rb | Ruby | mit | 191 | main | 531 | class CreateCourses < ActiveRecord::Migration[4.2]
def self.up
create_table 'courses', force: true do |t|
t.column 'title', :string
t.column 'instructor_id', :integer
t.column 'directory_path', :string
t.column 'info', :text
end
add_index 'courses', ['instructor_id'], name: 'fk_co... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20151228191257_add_hyperlinks_and_dir_num_to_teams.rb | Ruby | mit | 191 | main | 689 | class AddHyperlinksAndDirNumToTeams < ActiveRecord::Migration[4.2]
def change
add_column :teams, :submitted_hyperlinks, :text
add_column :teams, :directory_num, :integer
teams = AssignmentTeam.all
teams.each do |team|
participants = team.participants
next if participants.empty?
tea... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160927212558_change_team_id_in_bids_table_to_user_id.rb | Ruby | mit | 191 | main | 204 | class ChangeTeamIdInBidsTableToUserId < ActiveRecord::Migration[4.2]
def self.up
rename_column :bids, :team_id, :user_id
end
def self.down
rename_column :bids, :user_id, :team_id
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131205154647_remove_average_difficulty_rating_and_number_of_ratings_from_questions.rb | Ruby | mit | 191 | main | 369 | class RemoveAverageDifficultyRatingAndNumberOfRatingsFromQuestions < ActiveRecord::Migration[4.2]
def self.up
remove_column :questions, :average_difficulty_rating
remove_column :questions, :number_of_ratings
end
def self.down
add_column :questions, :number_of_ratings, :integer
add_column :questio... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/087_create_questionnaire_weights.rb | Ruby | mit | 191 | main | 2,244 | class CreateQuestionnaireWeights < ActiveRecord::Migration[4.2]
def self.up
create_table :questionnaire_weights do |t|
t.column :assignment_id, :integer, null: false
t.column :questionnaire_id, :integer, null: false
t.column :weight, :float, null: false, default: 0
t.column :type, :string
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121116154802_create_bookmark_rating_rubrics.rb | Ruby | mit | 191 | main | 466 | class CreateBookmarkRatingRubrics < ActiveRecord::Migration[4.2]
def self.up
if table_exists?(:bookmark_rating_rubrics) == false
create_table :bookmark_rating_rubrics do |t|
t.column 'display_text', :string, null: false
t.column 'minimum_rating', :integer, null: false
t.column 'maxim... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/083_relocate_to_scores_table.rb | Ruby | mit | 191 | main | 1,313 | class RelocateToScoresTable < ActiveRecord::Migration[4.2]
def self.up
begin
execute " insert into scores (instance_id, question_id, score, comments, questionnaire_type_id) select
review_id, question_id, score, comments, 1 from review_scores where questionnaire_type_id = 1"
rescue StandardError
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131112020506_add_rating_of_difficulty_to_questions.rb | Ruby | mit | 191 | main | 365 | class AddRatingOfDifficultyToQuestions < ActiveRecord::Migration[4.2]
def self.up
add_column :questions, :average_difficulty_rating, :float, default: 0
add_column :questions, :number_of_ratings, :integer, default: 0
end
def self.down
remove_column :questions, :number_of_ratings
remove_column :que... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/062_update_courses.rb | Ruby | mit | 191 | main | 464 | class UpdateCourses < ActiveRecord::Migration[4.2]
def self.up
rename_column :courses, :title, :name
add_column :courses, :created_at, :datetime
add_column :courses, :updated_at, :datetime
add_column :courses, :private, :boolean, default: 0, null: false
end
def self.down
rename_column :course... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/098_standardize_review_of_review.rb | Ruby | mit | 191 | main | 1,073 | class StandardizeReviewOfReview < ActiveRecord::Migration[4.2]
def self.up
remove_column :review_of_reviews, :reviewed_at
remove_column :review_of_reviews, :review_num_for_author
remove_column :review_of_reviews, :review_num_for_reviewer
add_column :review_of_reviews, :additional_comment, :string, nul... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150714162923_remove_require_signup_from_assignments.rb | Ruby | mit | 191 | main | 217 | class RemoveRequireSignupFromAssignments < ActiveRecord::Migration[4.2]
def change
remove_column 'assignments', 'require_signup'
add_column 'assignments', 'availability_flag', :integer, default: 1
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/028_create_review_of_review_scores.rb | Ruby | mit | 191 | main | 967 | class CreateReviewOfReviewScores < ActiveRecord::Migration[4.2]
def self.up
create_table 'review_of_review_scores', force: true do |t|
t.column 'review_of_review_id', :integer
t.column 'question_id', :integer
t.column 'score', :integer
t.column 'comments', :text
end
add_index 'rev... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/126_update_cache.rb | Ruby | mit | 191 | main | 412 | class UpdateCache < ActiveRecord::Migration[4.2]
def self.up
remove_column :score_caches, :assignment_id
rename_column :score_caches, :object_id, :reviewee_id
remove_column :score_caches, :course_id
end
def self.down
add_column :score_caches, :assignment_id, :integer
rename_column :score_ca... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/121_create_suggestions.rb | Ruby | mit | 191 | main | 448 | class CreateSuggestions < ActiveRecord::Migration[4.2]
def self.up
create_table :suggestions do |t|
t.column :assignment_id, :int
t.column :title, :string
t.column :description, :string, limit: 750
t.column :status, :string
t.column :unityID, ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150802171710_change_default_values_of_questions_table.rb | Ruby | mit | 191 | main | 281 | class ChangeDefaultValuesOfQuestionsTable < ActiveRecord::Migration[4.2]
def self.up
change_column :questions, :size, :string, default: ''
change_column :questions, :max_label, :string, default: ''
change_column :questions, :min_label, :string, default: ''
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/061_controller_update_courses_users.rb | Ruby | mit | 191 | main | 786 | class ControllerUpdateCoursesUsers < ActiveRecord::Migration[4.2]
def self.up
permission1 = Permission.find_or_create_by(name: 'administer courses')
site_controller = SiteController.find_or_create_by(name: 'courses_users')
site_controller.permission_id = permission1.id
site_controller.save
Role.re... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170221210920_remove_grades_comments_for_reviewer_and_review_time_from_participants_table.rb | Ruby | mit | 191 | main | 285 | class RemoveGradesCommentsForReviewerAndReviewTimeFromParticipantsTable < ActiveRecord::Migration[4.2]
def change
remove_column :participants, :grade_for_reviewer
remove_column :participants, :comment_for_reviewer
remove_column :participants, :review_graded_at
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/075_controller_update_passwords.rb | Ruby | mit | 191 | main | 856 | class ControllerUpdatePasswords < ActiveRecord::Migration[4.2]
def self.up
controller = SiteController.find_by_name('auth')
if controller
action = ControllerAction.where(name: 'forgotten', site_controller_id: controller.id).first
action.destroy if action
end
permission = Permission.find_b... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20161125190913_create_requested_users.rb | Ruby | mit | 191 | main | 332 | class CreateRequestedUsers < ActiveRecord::Migration[4.2]
def change
create_table :requested_users do |t|
t.string :name
t.integer :role_id
t.string :fullname
t.string :institution_id
t.string :email
t.string :status
t.string :reason
t.timestamps null: false
en... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/065_create_team_nodes.rb | Ruby | mit | 191 | main | 353 | class CreateTeamNodes < ActiveRecord::Migration[4.2]
def self.up
teams = Team.all
teams.each do |team|
parent = AssignmentNode.find_by_node_object_id(team.parent_id)
TeamNode.create(node_object_id: team.id, parent_id: parent.id) if parent
end
end
def self.down
nodes = TeamNode.all
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/010_create_mapping_strategies.rb | Ruby | mit | 191 | main | 325 | class CreateMappingStrategies < ActiveRecord::Migration[4.2]
def self.up
create_table 'mapping_strategies', force: true do |t|
t.column 'name', :string
end
execute "INSERT INTO `mapping_strategies` VALUES (1,'Static, pseudo-random');"
end
def self.down
drop_table 'mapping_strategies'
end... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170428231902_update_course_evaluation_to_course_survey.rb | Ruby | mit | 191 | main | 220 | class UpdateCourseEvaluationToCourseSurvey < ActiveRecord::Migration[4.2]
def change
execute "UPDATE questionnaires set type = 'CourseSurveyQuestionnaire' where type in ('CourseEvaluationQuestionnaire')"
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150729051150_change_team_review_response_map_to_review_response_map.rb | Ruby | mit | 191 | main | 226 | class ChangeTeamReviewResponseMapToReviewResponseMap < ActiveRecord::Migration[4.2]
def change
execute <<-SQL
update response_maps set type="ReviewResponseMap" where type="TeamReviewResponseMap";
SQL
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/024_create_review_feedbacks.rb | Ruby | mit | 191 | main | 901 | class CreateReviewFeedbacks < ActiveRecord::Migration[4.2]
def self.up
create_table 'review_feedbacks', force: true do |t|
t.column 'assignment_id', :integer
t.column 'review_id', :integer
t.column 'user_id', :integer
t.column 'feedback_at', :datetime
t.column 'txt', :text
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150714012523_add_institution_id_to_courses.rb | Ruby | mit | 191 | main | 225 | class AddInstitutionIdToCourses < ActiveRecord::Migration[4.2]
def self.up
add_column 'courses', 'institutions_id', :integer, default: nil
end
def self.down
remove_column 'courses', 'institutions_id'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20130827132007_remove_fk_aq_user_id.rb | Ruby | mit | 191 | main | 385 | class RemoveFkAqUserId < ActiveRecord::Migration[4.2]
def self.up
execute 'alter table assignment_questionnaires drop foreign key fk_aq_user_id;'
rescue StandardError
end
def self.down
execute "ALTER TABLE `assignment_questionnaires`
ADD CONSTRAINT `fk_aq_user_id`
FOREIGN KEY ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20140808212437_add_categories.rb | Ruby | mit | 191 | main | 395 | class AddCategories < ActiveRecord::Migration[4.2]
def self.up
# add_column :nodes, :name, :string
# add_column :nodes, :lft, :integer
# add_column :nodes, :rgt, :integer
# add_column :nodes, :depth, :integer
end
def self.down
# remove_column :nodes, :name
# remove_column :nodes, :lft
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160912034350_add_grade_for_reviewer_and_comment_for_reviewer_in_participants_table.rb | Ruby | mit | 191 | main | 400 | class AddGradeForReviewerAndCommentForReviewerInParticipantsTable < ActiveRecord::Migration[4.2]
def self.up
add_column :participants, :grade_for_reviewer, :integer, default: nil
add_column :participants, :comment_for_reviewer, :string, default: ''
end
def self.down
remove_column :participants, :comm... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20141204002000_add_index_to_bids.rb | Ruby | mit | 191 | main | 233 | class AddIndexToBids < ActiveRecord::Migration[4.2]
def self.up
add_index :bids, :team_id
add_index :bids, :topic_id
end
def self.down
remove_index :bids, :topic_id
remove_index :bids, :team_id
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150827170101_add_teammate_review_allowed_id_to_due_dates_table.rb | Ruby | mit | 191 | main | 258 | class AddTeammateReviewAllowedIdToDueDatesTable < ActiveRecord::Migration[4.2]
def self.up
add_column :due_dates, :teammate_review_allowed_id, :integer, default: 3
end
def self.down
drop_column :duedates, :teammate_review_allowed_id
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131112020403_permission_for_quiz_questionnaire.rb | Ruby | mit | 191 | main | 940 | class PermissionForQuizQuestionnaire < ActiveRecord::Migration[4.2]
def self.up
controller_id = SiteController.find_by_name('questionnaire').id
do_assignments_id = Permission.find_by_name('do assignments').id
actions = %w[new_quiz create_quiz_questionnaire update_quiz edit_quiz view_quiz]
actions.each... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101222143748_add_notification_accepted_to_response_map.rb | Ruby | mit | 191 | main | 258 | class AddNotificationAcceptedToResponseMap < ActiveRecord::Migration[4.2]
def self.up
add_column :response_maps, :notification_accepted, :boolean, default: false
end
def self.down
remove_column :response_maps, :notification_accepted
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131117022304_addiscodingassignmenttoassignments.rb | Ruby | mit | 191 | main | 240 | class Addiscodingassignmenttoassignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :is_coding_assignment, :boolean
end
def self.down
remove_column :assignments, :is_coding_assignment
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/117_create_signed_up_users.rb | Ruby | mit | 191 | main | 650 | class CreateSignedUpUsers < ActiveRecord::Migration[4.2]
def self.up
create_table :signed_up_users do |t|
t.column :topic_id, :integer, null: false
t.column :creator_id, :integer, null: false
t.column :is_waitlisted, :boolean, null: false
t.column :preference_priority_number, :integer
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20130730143615_remove_course_id_fk_constrain_on_assignment.rb | Ruby | mit | 191 | main | 400 | class RemoveCourseIdFkConstrainOnAssignment < ActiveRecord::Migration[4.2]
def self.up
execute 'alter table assignments drop foreign key fk_assignments_courses;'
rescue StandardError
end
def self.down
execute "ALTER TABLE `assignments`
ADD CONSTRAINT `fk_assignments_courses`
F... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/110_create_assignment_questionnaires.rb | Ruby | mit | 191 | main | 3,213 | class CreateAssignmentQuestionnaires < ActiveRecord::Migration[4.2]
def self.up
begin
drop_table :assignments_questionnaires
rescue StandardError
end
create_table :assignment_questionnaires do |t|
t.column :assignment_id, :integer, null: true
t.column :questionnaire_id, :i... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/049_menu_update_course_evaluation.rb | Ruby | mit | 191 | main | 843 | class MenuUpdateCourseEvaluation < ActiveRecord::Migration[4.2]
def self.up
permission1 = Permission.find_by_name('do assignments')
site_controller = SiteController.find_or_create_by(name: 'course_evaluation')
site_controller.permission_id = permission1.id
site_controller.builtin = 0
site_controll... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160321221146_add_columnselfreviewenabled.rb | Ruby | mit | 191 | main | 245 | #E1600
class AddColumnselfreviewenabled < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :is_selfreview_enabled, :boolean
end
def self.down
remove_column :assignments, :is_selfreview_enabled, :boolean
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/000_create_versions.rb | Ruby | mit | 191 | main | 468 | class CreateVersions < ActiveRecord::Migration[4.2]
def self.up
create_table :versions do |t|
t.string :item_type, null: false
t.integer :item_id, null: false
t.string :event, null: false
t.string :whodunnit
t.text :object
t.datetime :created_at
end
add... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20201011214909_add_preference_home_flag_to_users.rb | Ruby | mit | 191 | main | 233 | class AddPreferenceHomeFlagToUsers < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :etc_icons_on_homepage, :boolean, default: true
end
def self.down
remove_column :users, :etc_icons_on_homepage
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/201611251670_create_reset_password.rb | Ruby | mit | 191 | main | 263 | class CreateResetPassword < ActiveRecord::Migration[4.2]
def self.up
create_table :password_resets do |t|
t.string :user_email
t.string :token
t.datetime :updated_at
end
end
def self.down
drop_table :password_resets
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/101_standardize_reviews.rb | Ruby | mit | 191 | main | 472 | class StandardizeReviews < ActiveRecord::Migration[4.2]
def self.up
remove_column :reviews, :review_num_for_author
remove_column :reviews, :review_num_for_reviewer
remove_column :reviews, :ignore
execute "ALTER TABLE `reviews`
DROP FOREIGN KEY `fk_review_mappings`"
execute "ALTER TAB... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131112020248_add_student_quiz_controller.rb | Ruby | mit | 191 | main | 308 | class AddStudentQuizController < ActiveRecord::Migration[4.2]
def self.up
permission = Permission.find_by_name('do assignments')
controller = SiteController.where(name: 'student_quiz').first_or_create
controller.permission_id = permission.id
controller.save
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170428195326_replace_course_evaluation.rb | Ruby | mit | 191 | main | 662 | class ReplaceCourseEvaluation < ActiveRecord::Migration[4.2]
def up
Questionnaire.where(type: 'CourseEvaluationQuestionnaire') do |questionnaire|
Questionnaire.update(questionnaire.id, type: 'CourseSurveyQuestionnaire')
end
fnode = TreeFolder.find_by_name('Course Evaluation')
TreeFolder.update(f... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/084_add_new_mapping_strategy.rb | Ruby | mit | 191 | main | 351 | class AddNewMappingStrategy < ActiveRecord::Migration[4.2]
def self.up
execute "INSERT INTO mapping_strategies (`id`, `name`) VALUES
(2, 'Dynamic, fewest extant reviews');"
deadline_type = DeadlineType.find_by_name('review of review')
deadline_type.name = 'metareview'
deadline_type.save
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/074_update_assignments_for_invitations.rb | Ruby | mit | 191 | main | 433 | class UpdateAssignmentsForInvitations < ActiveRecord::Migration[4.2]
def self.up
begin
add_column :assignments, :team_count, :integer, null: false, default: 0
rescue StandardError
end
begin
remove_column :assignments, :max_team_count
rescue StandardError
end
end
def self.d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.