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_save/024_create_review_of_reviews.rb | Ruby | mit | 191 | main | 1,514 | class CreateReviewOfReviews < ActiveRecord::Migration[4.2]
# This table should have essentially the same format as (the table) reviews
def self.up
create_table :review_of_reviews do |t|
t.column :reviewed_at, :datetime # time that the review of review was saved
t.column :review_of_review_mapping_id,... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate_save/011_create_assignments.rb | Ruby | mit | 191 | main | 2,043 | class CreateAssignments < ActiveRecord::Migration[4.2]
def self.up
create_table :assignments do |t|
t.column :name, :string
t.column :directory_path, :string
t.column :submitter_count, :integer, default: 0 # number of people who have submitted to this assgt. so far; initialized to 0
t.colu... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate_save/020_teams_users.rb | Ruby | mit | 191 | main | 597 | class TeamsUsers < ActiveRecord::Migration[4.2]
def self.up
create_table :teams_users do |t| # maps users to teams; in rare cases, a single individual is on > 1 team for an assgt.
t.column :team_id, :integer
t.column :user_id, :integer
end
execute "alter table teams_users
add cons... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate_save/001_initial_setup.rb | Ruby | mit | 191 | main | 5,068 | class InitialSetup < ActiveRecord::Migration[4.2]
def self.up
create_table 'markup_styles', force: false do |t|
t.column 'name', :string, default: '', null: false
end
create_table 'permissions', force: false do |t|
t.column 'name', :string, default: '', null: false
end
create_table '... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate_save/021_create_resubmission_times.rb | Ruby | mit | 191 | main | 456 | class CreateResubmissionTimes < ActiveRecord::Migration[4.2]
def self.up
create_table :resubmission_times do |t|
t.column :participant_id, :integer
t.column :resubmitted_at, :datetime
end
execute "alter table resubmission_times
add constraint fk_resubmission_times_participants
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/data_migrations/user_mapping.rb | Ruby | mit | 191 | main | 413 | class UserMapping
def self.run!
file = File.open('user_mapping.csv', 'w')
File.write('user_mapping.csv', "UserID, ScrubbedUserID,\n", mode: 'a')
User.find_each do |user|
user_id = user.id
scrubbed_name = "#{user.role.name.downcase.gsub(/[- ]/, '_')}#{user.id}"
File.write('user_mapping.cs... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/data_migrations/alter_max_team_size.rb | Ruby | mit | 191 | main | 241 | class AlterMaxTeamSize
def self.run!
improper_assignments = Assignment.all(conditions: 'max_team_size = 0')
improper_assignments.map do |assignment|
assignment.max_team_size = 1
assignment.save(false)
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/data_migrations/scrub_database.rb | Ruby | mit | 191 | main | 516 | class ScrubDatabase
def self.run!
# Loop through each user
User.find_each do |user|
role = user.role.name.downcase.gsub(/[- ]/, '_')
user.name = "#{role}#{user.id}"
user.fullname = "#{role}#{user.id}"
user.email = 'expertiza@mailinator.com'
user.handle = 'handle'
user.passw... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/data_migrations/data_migrations.rb | Ruby | mit | 191 | main | 303 | class DataMigrations
def self.run!
files = Dir['./db/data_migrations/*.rb'].reject do |s|
s[/data_migrations.rb|scrub_database.rb/]
end
files.each do |file|
require file
end
files.each do |file|
file[/\w+.rb/][/\w+/].camelize.constantize.run!
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/data_migrations/alter_round_of_reviews.rb | Ruby | mit | 191 | main | 497 | class AlterRoundOfReviews
def self.run!
assignments = Assignment.all
i =0
while i < assignments.length
submissions = assignments[i].find_due_dates('submission') + assignments[i].find_due_dates('resubmission')
reviews = assignments[i].find_due_dates('review') + assignments[i].find_due_dates('re... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/data_migrations/unity_mapping.rb | Ruby | mit | 191 | main | 372 | class UnityMapping
def self.run!
file = File.open('unity_mapping.csv', 'w')
File.write('unity_mapping.csv', "UserID, Unity ID,\n", mode: 'a')
User.find_each do |user|
user_id = user.id
unity_id = user.email.split('@').first
File.write('unity_mapping.csv', user_id.to_s + ', ' + unity_id +... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131112015931_add_num_quiz_questions_to_assignments.rb | Ruby | mit | 191 | main | 253 | class AddNumQuizQuestionsToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :num_quiz_questions, :integer, default: 0, null: false
end
def self.down
remove_column :assignments, :num_quiz_questions
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/116_create_sign_up_topics.rb | Ruby | mit | 191 | main | 758 | class CreateSignUpTopics < ActiveRecord::Migration[4.2]
def self.up
create_table :sign_up_topics do |t|
t.column :topic_name, :text, null: false
t.column :assignment_id, :integer, null: false
t.column :max_choosers, :integer, null: false
t.column :category, :text
t.column :topic_iden... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121116154625_create_bmapping_tags.rb | Ruby | mit | 191 | main | 367 | class CreateBmappingTags < ActiveRecord::Migration[4.2]
def self.up
if table_exists?(:bmappings_tags) == false
create_table :bmappings_tags do |t|
t.column 'tag_id', :integer, null: false
t.column 'bmapping_id', :integer, null: false
t.timestamps
end
end
end
def self... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131124180730_create_team_role_questionnaire.rb | Ruby | mit | 191 | main | 792 | class CreateTeamRoleQuestionnaire < ActiveRecord::Migration[4.2]
def self.up
create_table 'team_role_questionnaire', force: true do |t|
t.integer :team_roles_id
t.integer :questionnaire_id
t.timestamps
end
execute "ALTER TABLE `team_role_questionnaire`
ADD CONSTRAINT fk_team_roles_id... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/056_create_questionnaire_type_nodes.rb | Ruby | mit | 191 | main | 555 | class CreateQuestionnaireTypeNodes < ActiveRecord::Migration[4.2]
def self.up
#Retrieve all questionnaire types
types = ActiveRecord::Base.connection.select_all("select * from questionnaire_types")
folder = TreeFolder.find_by_name('Questionnaires')
parent = FolderNode.find_by_node_ob... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/059_create_course_nodes.rb | Ruby | mit | 191 | main | 398 | class CreateCourseNodes < ActiveRecord::Migration[4.2]
def self.up
courses = Course.all
folder = TreeFolder.find_by_name('Courses')
parent = FolderNode.find_by_node_object_id(folder.id)
courses.each do |course|
CourseNode.create(node_object_id: course.id, parent_id: parent.id)
end
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20141204012100_add_index_to_sign_up_topics.rb | Ruby | mit | 191 | main | 206 | class AddIndexToSignUpTopics < ActiveRecord::Migration[4.2]
def self.up
add_index :sign_up_topics, :assignment_id
end
def self.down
remove_index :sign_up_topics, :assignment_id
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170322035252_create_notifications_table.rb | Ruby | mit | 191 | main | 272 | class CreateNotificationsTable < ActiveRecord::Migration[4.2]
def change
create_table :notifications do |t|
t.string :subject
t.text :description
t.date :expiration_date
t.boolean :active_flag
t.timestamps null: false
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101117031216_permission_for_add_dynamic_reviewer_action.rb | Ruby | mit | 191 | main | 640 | class PermissionForAddDynamicReviewerAction < 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[add_dynamic_reviewer release_reservation].each do |action|
ControllerAction.crea... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20251118044955_add_is_sent_to_llm_for_processing_to_assignments.rb | Ruby | mit | 191 | main | 260 | class AddIsSentToLlmForProcessingToAssignments < ActiveRecord::Migration[5.1]
def change
add_column :assignments,
:is_sent_to_llm_for_processing,
:boolean,
default: false,
null: false
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/106_update_controller_for_export.rb | Ruby | mit | 191 | main | 324 | class UpdateControllerForExport < ActiveRecord::Migration[4.2]
def self.up
perm = Permission.find_by_name('administer assignments')
controller = SiteController.find_or_create_by(name: 'export_file')
controller.permission_id = perm.id
controller.save
Role.rebuild_cache
end
def self.down; end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/072_add_unknown_controllers.rb | Ruby | mit | 191 | main | 636 | class AddUnknownControllers < ActiveRecord::Migration[4.2]
def self.up
permission = Permission.find_by_name('do assignments')
controller = SiteController.find_or_create_by(name: 'student_team')
controller.permission_id = permission.id
controller.save
controller = SiteController.find_or_create_by(... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/108_create_questionnaire_folder_nodes.rb | Ruby | mit | 191 | main | 2,769 | class CreateQuestionnaireFolderNodes < ActiveRecord::Migration[4.2]
def self.up
add_column :tree_folders, :parent_id, :integer, null: true
Node.where(['type in ("QuestionnaireTypeNode","QuestionnaireNode")']).find_each(&:destroy)
parent = TreeFolder.find_by_name('Questionnaires')
pNode = FolderNode.... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160422030133_add_algorithm_to_assignments.rb | Ruby | mit | 191 | main | 241 | class AddAlgorithmToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :reputation_algorithm, :string, default: 'Lauw'
end
def self.down
remove_column :assignments, :reputation_algorithm
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20110205220301_submit_multiple_hyperlinks.rb | Ruby | mit | 191 | main | 1,154 | require 'yaml'
class SubmitMultipleHyperlinks < ActiveRecord::Migration[4.2]
def self.up
rename_column :participants, :submitted_hyperlink, :submitted_hyperlinks
Participant.find_each do |p|
unless p.submitted_hyperlinks.nil?
one_hyperlink = p.submitted_hyperlinks.strip
if one_hyperlink... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/038_update_review_mappings.rb | Ruby | mit | 191 | main | 264 | class UpdateReviewMappings < ActiveRecord::Migration[4.2]
def self.up
add_column "review_mappings","round",:integer
execute "update review_mappings set round = -1"
end
def self.down
remove_column 'review_mappings', 'round'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/099_standardize_review_of_review_mappings.rb | Ruby | mit | 191 | main | 4,221 | class StandardizeReviewOfReviewMappings < ActiveRecord::Migration[4.2]
def self.up
begin
execute "ALTER TABLE `review_of_review_mappings`
DROP FOREIGN KEY `fk_review_of_review_mapping_review_mappings`"
rescue StandardError
end
begin
execute "ALTER TABLE `review_of_review_... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111101035638_update_assignment_add_rounds.rb | Ruby | mit | 191 | main | 231 | class UpdateAssignmentAddRounds < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :rounds_of_reviews, :integer, default: 1
end
def self.down
remove_column :assignments, :rounds_of_reviews
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101205034327_add_self_selected_review_fields.rb | Ruby | mit | 191 | main | 454 | class AddSelfSelectedReviewFields < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :user_selected_dynamic_reviewer_assignments_enabled, :boolean, default: 0
add_column :assignments, :max_dynamic_reviews_per_submission, :integer, default: 3
end
def self.down
remove_column :assignmen... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160929155706_change_comment_for_reviewer_in_particiant_table_to_text.rb | Ruby | mit | 191 | main | 285 | class ChangeCommentForReviewerInParticiantTableToText < ActiveRecord::Migration[4.2]
def self.up
change_column :participants, :comment_for_reviewer, :text, default: nil
end
def self.down
change_column :participants, :comment_for_reviewer, :string, default: ''
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20100920141223_update_menu_impersonate_revert.rb | Ruby | mit | 191 | main | 458 | class UpdateMenuImpersonateRevert < ActiveRecord::Migration[4.2]
def self.up
permission = Permission.find_by_name('do assignments')
site_controller = SiteController.find_by_name('impersonate')
action = ControllerAction.where('name = "restore" and site_controller_id = ?', site_controller.id).first
act... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170404122028_create_track_notifications_table.rb | Ruby | mit | 191 | main | 229 | class CreateTrackNotificationsTable < ActiveRecord::Migration[4.2]
def change
create_table :track_notifications do |t|
t.integer :notification
t.integer :user_id
t.timestamps null: false
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131124181007_create_participant_team_roles.rb | Ruby | mit | 191 | main | 790 | class CreateParticipantTeamRoles < ActiveRecord::Migration[4.2]
def self.up
create_table :participant_team_roles do |t|
t.integer :role_assignment_id
t.integer :participant_id
t.timestamps
end
execute "ALTER TABLE `participant_team_roles`
ADD CONSTRAINT fk_role_assignment_id
FORE... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20130418214537_update_site_controllers_for_versions.rb | Ruby | mit | 191 | main | 347 | class UpdateSiteControllersForVersions < ActiveRecord::Migration[4.2]
def self.up
@permission = Permission.find_by_name('public actions - execute')
@controller = SiteController.find_or_create_by(name: 'versions')
@controller.permission_id = @permission.id
@controller.save
Role.rebuild_cache
end... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150805220759_redesign_score_view_remove_default_choices.rb | Ruby | mit | 191 | main | 880 | class RedesignScoreViewRemoveDefaultChoices < ActiveRecord::Migration[4.2]
def change
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_sc... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131201172600_create_calculated_penalties.rb | Ruby | mit | 191 | main | 344 | class CreateCalculatedPenalties < ActiveRecord::Migration[4.2]
def self.up
create_table 'calculated_penalties', force: true do |t|
t.column 'participant_id', :integer
t.column 'deadline_type_id', :integer
t.column 'penalty_points', :integer
end
end
def self.down
drop_table 'calculat... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150717141742_remove_bookmark_related_tables.rb | Ruby | mit | 191 | main | 338 | class RemoveBookmarkRelatedTables < ActiveRecord::Migration[4.2]
def self.up
drop_table :books
drop_table :bmappings
drop_table :bmapping_ratings
drop_table :bookmarks
drop_table :bmappings_tags
drop_table :bookmark_rating_rubrics
drop_table :bookmark_tags
drop_table :bmappings_sign_up... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/029_create_participants.rb | Ruby | mit | 191 | main | 1,157 | class CreateParticipants < ActiveRecord::Migration[4.2]
def self.up
create_table 'participants', force: true do |t|
t.column 'submit_allowed', :boolean, default: true
t.column 'review_allowed', :boolean, default: true
t.column 'user_id', :integer
t.column 'assignment_id', :integer
t.... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160422025520_add_reputation_to_participants.rb | Ruby | mit | 191 | main | 304 | class AddReputationToParticipants < ActiveRecord::Migration[4.2]
def self.up
add_column :participants, :Hamer, :float, default: 1
add_column :participants, :Lauw, :float, default: 0
end
def self.down
remove_column :participants, :Lauw
remove_column :participants, :Hamer
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/104_update_rubric_types.rb | Ruby | mit | 191 | main | 1,050 | class UpdateRubricTypes < ActiveRecord::Migration[4.2]
def self.up
metareview_type = ActiveRecord::Base.connection.select_one("select * from `questionnaire_types` where name = 'Metareview'")
pnode = QuestionnaireTypeNode.find_by_node_object_id(metareview_type['id'])
questionnaires = Questionnaire.where(['... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111129232252_add_section_column_to_questionnaires.rb | Ruby | mit | 191 | main | 239 | class AddSectionColumnToQuestionnaires < ActiveRecord::Migration[4.2]
def self.up
add_column 'questionnaires', 'section', :string # custom rubric section
end
def self.down
remove_column 'questionnaires', 'section'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/089_add_handle_to_users.rb | Ruby | mit | 191 | main | 253 | class AddHandleToUsers < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :handle, :string, null: true
rescue StandardError
put $ERROR_INFO
end
def self.down
remove_column :users, :handle
rescue StandardError
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170427005000_create_plagiarism_checker_assignment_submissions.rb | Ruby | mit | 191 | main | 262 | class CreatePlagiarismCheckerAssignmentSubmissions < ActiveRecord::Migration[4.2]
def change
create_table :plagiarism_checker_assignment_submissions do |t|
t.string :name
t.string :simicheck_id
t.timestamps null: false
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121018001330_change_teams_users_to_teams_participants.rb | Ruby | mit | 191 | main | 200 | class ChangeTeamsUsersToTeamsParticipants < ActiveRecord::Migration[4.2]
def self.up
rename_table :teams_participants, :teams_participants
rescue StandardError
end
def self.down; end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160101211437_drop_table_team_role_assignment.rb | Ruby | mit | 191 | main | 324 | class DropTableTeamRoleAssignment < ActiveRecord::Migration[4.2]
def change
execute 'ALTER TABLE teamrole_assignment DROP FOREIGN KEY fk_teamrole_assignment_team_rolesets;'
execute 'ALTER TABLE teamrole_assignment DROP FOREIGN KEY fk_teamrole_assignment_assignments;'
drop_table :teamrole_assignment
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131112020440_permission_for_quiz_response_map.rb | Ruby | mit | 191 | main | 766 | class PermissionForQuizResponseMap < 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_quiz_dynamically'
unless ControllerAction.where(site_controller_id: controlle... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20151021142107_add_can_choose_topic_to_review.rb | Ruby | mit | 191 | main | 252 | class AddCanChooseTopicToReview < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :can_choose_topic_to_review, :boolean, default: true
end
def self.down
remove_colmun :assignments, :can_choose_topic_to_review
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/026_create_review_scores.rb | Ruby | mit | 191 | main | 819 | class CreateReviewScores < ActiveRecord::Migration[4.2]
def self.up
create_table 'review_scores', force: true do |t|
t.column 'review_id', :integer
t.column 'question_id', :integer
t.column 'score', :integer
t.column 'comments', :text
end
add_index 'review_scores', ['review_id'], ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170222161826_create_review_comment_paste_bins.rb | Ruby | mit | 191 | main | 327 | class CreateReviewCommentPasteBins < ActiveRecord::Migration[4.2]
def change
create_table :review_comment_paste_bins do |t|
t.integer :review_grade_id
t.string :title
t.text :review_comment
t.timestamps null: false
end
add_foreign_key :review_comment_paste_bins, :review_grades
e... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160817124924_delete_topic_deadlines_table.rb | Ruby | mit | 191 | main | 1,403 | class DeleteTopicDeadlinesTable < ActiveRecord::Migration[4.2]
def self.up
drop_table :topic_deadlines
end
def self.down
create_table :topic_deadlines do |t|
t.datetime :due_at
t.integer :deadline_type_id
t.integer :topic_id
t.integer :late_policy_id
t.integer :submission_al... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/111_add_action_grades_view_my_scores.rb | Ruby | mit | 191 | main | 354 | class AddActionGradesViewMyScores < ActiveRecord::Migration[4.2]
def self.up
perm = Permission.find_by_name('do assignments')
controller = SiteController.find_by_name('grades')
ControllerAction.create(site_controller_id: controller.id, name: 'view_my_scores', permission_id: perm.id)
Role.rebuild_cach... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111129215405_create_question_types.rb | Ruby | mit | 191 | main | 678 | class CreateQuestionTypes < ActiveRecord::Migration[4.2]
def self.up
create_table 'question_types', force: true do |t|
t.column 'q_type', :string, null: false # the type of custom question
t.column 'parameters', :string # parameters for a given question
t.column 'question_id', :integer, default:... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160817130411_add_type_column_to_due_dates_table.rb | Ruby | mit | 191 | main | 235 | class AddTypeColumnToDueDatesTable < ActiveRecord::Migration[4.2]
def self.up
add_column :due_dates, :type, :string, null: :false, default: 'AssignmentDueDate'
end
def self.down
remove_column :due_dates, :type
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150702170648_add_private_to_to_sign_up_topics.rb | Ruby | mit | 191 | main | 230 | class AddPrivateToToSignUpTopics < ActiveRecord::Migration[4.2]
def self.up
add_column 'sign_up_topics', 'private_to', :integer, default: nil
end
def self.down
remove_column 'sign_up_topics', 'private_to'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/136_add_copy_of_emails_flag_to_users.rb | Ruby | mit | 191 | main | 218 | class AddCopyOfEmailsFlagToUsers < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :copy_of_emails, :boolean, default: false
end
def self.down
remove_column :users, :copy_of_emails
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150526210708_rename_creator_id_to_team_id.rb | Ruby | mit | 191 | main | 224 | class RenameCreatorIdToTeamId < ActiveRecord::Migration[4.2]
def self.up
rename_column :signed_up_users, :creator_id, :team_id
end
def self.down
rename_column :signed_up_users, :team_id, :creator_id
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/034_create_survey_deployments.rb | Ruby | mit | 191 | main | 636 | class CreateSurveyDeployments < ActiveRecord::Migration[4.2]
def self.up
create_table :survey_deployments do |t|
# Note: Table name pluralized by convention.
t.column :course_evaluation_id, :integer # the course to which this survey pertains.
t.column :start_date, :datetime # the time when the s... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/047_menu_update_review_mapping.rb | Ruby | mit | 191 | main | 1,175 | class MenuUpdateReviewMapping < ActiveRecord::Migration[4.2]
def self.up
permission1 = Permission.find_by_name('administer assignments')
menuParent = MenuItem.find_by_label('Assignment Creation')
site_controller = SiteController.find_or_create_by(name: 'review_mapping')
site_controller.permission_id =... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131124173014_create_team_roles.rb | Ruby | mit | 191 | main | 518 | class CreateTeamRoles < ActiveRecord::Migration[4.2]
def self.up
create_table 'team_roles', force: true do |t|
t.string 'role_names'
t.integer 'questionnaire_id'
end
execute "ALTER TABLE `team_roles`
ADD CONSTRAINT `fk_team_roles_questionnaire`
FOREIGN KEY (questionna... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20161024230700_add_attributes_to_submissionrecords.rb | Ruby | mit | 191 | main | 410 | class AddAttributesToSubmissionrecords < ActiveRecord::Migration[4.2]
def change
add_column :submissionrecords, :type, :text
add_column :submissionrecords, :content, :string
add_column :submissionrecords, :createdat, :datetime
add_column :submissionrecords, :operation, :string
add_column :submissi... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101116184601_add_potential_response_deadline_to_response_maps.rb | Ruby | mit | 191 | main | 273 | class AddPotentialResponseDeadlineToResponseMaps < ActiveRecord::Migration[4.2]
def self.up
add_column :response_maps, :potential_response_deadline, :datetime, null: true
end
def self.down
remove_column :response_maps, :potential_response_deadline
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131112015730_add_require_quiz_to_assignments.rb | Ruby | mit | 191 | main | 211 | class AddRequireQuizToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :require_quiz, :boolean
end
def self.down
remove_column :assignments, :require_quiz
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/013_create_courses_users.rb | Ruby | mit | 191 | main | 739 | class CreateCoursesUsers < ActiveRecord::Migration[4.2]
def self.up
create_table 'courses_users', force: true do |t|
t.column 'user_id', :integer
t.column 'course_id', :integer
t.column 'active', :boolean
end
add_index 'courses_users', ['user_id'], name: 'fk_courses_users'
execute ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170925225438_alter_user_id_in_bids_table_to_team_id.rb | Ruby | mit | 191 | main | 491 | class AlterUserIdInBidsTableToTeamId < ActiveRecord::Migration[4.2]
def change
Bid.all.each do |bid|
begin
topic_id = bid.topic_id
user_id = bid.user_id
team_id = SignUpTopic.find_by(id: topic_id).assignment.teams
.select { |t| t.users.map(&:id).include?(... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170429164240_add_assignment_id_to_pcas.rb | Ruby | mit | 191 | main | 248 | class AddAssignmentIdToPcas < ActiveRecord::Migration[4.2]
def change
add_reference :plagiarism_checker_assignment_submissions, :assignment, index: { name: 'index_plagiarism_checker_assgt_subm_on_assignment_id' }, foreign_key: true
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/113_clean_up_questionnaires.rb | Ruby | mit | 191 | main | 680 | class CleanUpQuestionnaires < ActiveRecord::Migration[4.2]
def self.up
Questionnaire.find_by_sql("select q.*
from questionnaires q
LEFT JOIN assignment_questionnaires aq ON q.id = aq.questionnaire_id
LEFT JOIN assignments a ON a.id = aq.assignment_id
WHERE a.id is NULL and type not in... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20180104141248_delete_original_track_notifications_table_and_create_a_new_one_with_correct_fields.rb | Ruby | mit | 191 | main | 373 | class DeleteOriginalTrackNotificationsTableAndCreateANewOneWithCorrectFields < ActiveRecord::Migration[4.2]
def change
drop_table :track_notifications
create_table :track_notifications do |t|
t.references :notification, index: true, foreign_key: true
t.references :user, index: true, foreign_key: t... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/103_update_questionnaire_menus.rb | Ruby | mit | 191 | main | 1,561 | class UpdateQuestionnaireMenus < ActiveRecord::Migration[4.2]
def self.up
site_controller = SiteController.find_by_name('tree_display')
metareview_rubrics_action = ControllerAction.find_or_create_by(name: 'goto_metareview_rubrics')
metareview_rubrics_action.site_controller_id = site_controller.id
met... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/114_update_controllers_for_response.rb | Ruby | mit | 191 | main | 1,313 | class UpdateControllersForResponse < ActiveRecord::Migration[4.2]
def self.up
perm = Permission.find_by_name('do assignments')
controller = SiteController.find_or_create_by(name: 'response')
if controller
controller.permission_id = perm.id
controller.save
end
controller = SiteControl... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131124173146_create_team_rolesets.rb | Ruby | mit | 191 | main | 224 | class CreateTeamRolesets < ActiveRecord::Migration[4.2]
def self.up
create_table 'team_rolesets', force: true do |t|
t.string 'roleset_name'
end
end
def self.down
drop_table :team_rolesets
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111130230523_add_availability_flag_to_assignments.rb | Ruby | mit | 191 | main | 226 | class AddAvailabilityFlagToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :availability_flag, :boolean
end
def self.down
remove_column :assignments, :availability_flag
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20181205201208_add_allow_doing_subsequent_review_without_first_round_to_assignments.rb | Ruby | mit | 191 | main | 211 | class AddAllowDoingSubsequentReviewWithoutFirstRoundToAssignments < ActiveRecord::Migration[4.2]
def change
add_column :assignments, :allow_selecting_additional_reviews_after_1st_round, :boolean
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111129204549_add_micropayment_to_sign_up_topic.rb | Ruby | mit | 191 | main | 218 | class AddMicropaymentToSignUpTopic < ActiveRecord::Migration[4.2]
def self.up
add_column :sign_up_topics, :micropayment, :integer
end
def self.down
remove_column :sign_up_topics, :micropayment
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101018010541_digital_signature.rb | Ruby | mit | 191 | main | 405 | class DigitalSignature < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :digital_certificate, :text
add_column :participants, :time_stamp, :datetime
add_column :participants, :digital_signature, :text
end
def self.down
remove_column :users, :digital_certificate
remove_column :par... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/096_create_teammate_review_mappings.rb | Ruby | mit | 191 | main | 2,872 | class CreateTeammateReviewMappings < ActiveRecord::Migration[4.2]
def self.up
create_table :teammate_review_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
add_column :teamm... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170328014102_create_user_pastebins.rb | Ruby | mit | 191 | main | 236 | class CreateUserPastebins < ActiveRecord::Migration[4.2]
def change
create_table :user_pastebins do |t|
t.integer :user_id
t.string :short_form
t.text :long_form
t.timestamps null: false
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160116140353_change_is_submitted_to_boolean.rb | Ruby | mit | 191 | main | 248 | class ChangeIsSubmittedToBoolean < ActiveRecord::Migration[4.2]
def change
remove_column :responses, :isSubmitted
add_column :responses, :is_submitted, :boolean, default: false
execute 'update responses set is_submitted=1;'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131124173258_alter_assignments.rb | Ruby | mit | 191 | main | 510 | class AlterAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column 'assignments', 'selfreview_questionnaire_id', :integer
add_column 'assignments', 'managerreview_questionnaire_id', :integer
add_column 'assignments', 'readerreview_questionnaire_id', :integer
end
def self.down
remove_col... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/058_create_assignment_nodes.rb | Ruby | mit | 191 | main | 434 | class CreateAssignmentNodes < ActiveRecord::Migration[4.2]
def self.up
assignments = Assignment.all
folder = TreeFolder.find_by_name('Assignments')
parent = FolderNode.find_by_node_object_id(folder.id)
assignments.each do |assignment|
AssignmentNode.create(node_object_id: assignment.id, parent... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/071_create_peer_review_scores.rb | Ruby | mit | 191 | main | 939 | class CreatePeerReviewScores < ActiveRecord::Migration[4.2]
def self.up
create_table :peer_review_scores do |t|
# Note: Table name pluralized by convention.
t.column 'peer_review_id', :integer
t.column 'question_id', :integer
t.column 'score', :integer
t.column 'comments', :text
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20230415194444_add_participant_id_and_populate.rb | Ruby | mit | 191 | main | 1,756 | class AddParticipantIdAndPopulate < ActiveRecord::Migration[5.1]
def up
add_column :teams_users, :participant_id, :integer, limit: 4, index: true
add_foreign_key :teams_users, :participants
# firstly, fetch all TeamsUser rows
teams_participants = TeamsUser.all
# for each TeamsUser row
teams_p... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/051_menu_update_participant_choices.rb | Ruby | mit | 191 | main | 857 | class MenuUpdateParticipantChoices < ActiveRecord::Migration[4.2]
def self.up
permission1 = Permission.find_by_name('administer assignments')
site_controller = SiteController.find_or_create_by(name: 'participant_choices')
site_controller.permission_id = permission1.id
site_controller.builtin = 0
s... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160511000216_change_rereview_and_resubmission_topic_deadlines.rb | Ruby | mit | 191 | main | 627 | class ChangeRereviewAndResubmissionTopicDeadlines < ActiveRecord::Migration[4.2]
def change
resubmission_deadlines = TopicDeadline.where(deadline_type_id: 3)
resubmission_deadlines.each do |resubmission_deadline|
resubmission_deadline.deadline_type_id = 1
resubmission_deadline.submission_allowed_i... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/002_initialize_custom.rb | Ruby | mit | 191 | main | 28,794 | class InitializeCustom < ActiveRecord::Migration[4.2]
def self.up
create_table 'permissions', force: true do |t|
t.column 'name', :string, default: '', null: false
end
execute "INSERT INTO `permissions` VALUES (1,'Administer Goldberg')"
execute "INSERT INTO `permissions` VALUES (3,'Public pages ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20130418215246_update_controller_actions_for_versions_revert.rb | Ruby | mit | 191 | main | 449 | class UpdateControllerActionsForVersionsRevert < ActiveRecord::Migration[4.2]
def self.up
@permission = Permission.find_by_name('public actions - execute')
@controller = SiteController.find_by_name('versions')
@action = ControllerAction.find_or_create_by(name: 'revert')
@action.site_controller_id = @c... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101128192024_add_persistence_token_to_user.rb | Ruby | mit | 191 | main | 206 | class AddPersistenceTokenToUser < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :persistence_token, :string
end
def self.down
remove_column :users, :persistence_token
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131112020213_add_quiz_allowed_id_to_due_dates.rb | Ruby | mit | 191 | main | 212 | class AddQuizAllowedIdToDueDates < ActiveRecord::Migration[4.2]
def self.up
add_column :due_dates, :quiz_allowed_id, :integer
end
def self.down
delete_column :due_dates, :quiz_allowed_id
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20181101013729_change_due_date_schema_string_delayed_job_id.rb | Ruby | mit | 191 | main | 240 | class ChangeDueDateSchemaStringDelayedJobId < ActiveRecord::Migration[4.2]
def change
change_table :due_dates do |t|
# Sidekiq jobs have string job id, hence this change
t.change :delayed_job_id, :string
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20171110231812_create_badges.rb | Ruby | mit | 191 | main | 616 | class CreateBadges < ActiveRecord::Migration[4.2]
def change
create_table :badges do |t|
t.string :name
t.string :description
t.string :image_name
t.timestamps null: false
end
Badge.create name: 'Good Reviewer',
description: 'This badge is awarded to students who ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20141203001749_add_max_bids_to_assigments.rb | Ruby | mit | 191 | main | 208 | class AddMaxBidsToAssigments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :max_bids, :integer
end
def self.down
remove_column :assignments, :max_bids, :integer
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/120_set_permissions_for_sign_up_sheet.rb | Ruby | mit | 191 | main | 917 | class SetPermissionsForSignUpSheet < ActiveRecord::Migration[4.2]
def self.up
permission = Permission.find_by_name('administer assignments')
controller = SiteController.find_or_create_by(name: 'sign_up_sheet')
controller.permission_id = permission.id
controller.save
permission = Permission.find_b... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/094_remove_fields_from_feedback.rb | Ruby | mit | 191 | main | 559 | class RemoveFieldsFromFeedback < ActiveRecord::Migration[4.2]
def self.up
begin
remove_column :review_feedbacks, :feedback_at
rescue StandardError
end
begin
rename_column :review_feedbacks, :additional_comments, :additional_comment
rescue StandardError
end
begin
execute... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20110210160753_remove_dynamic_reviewer_assignments_enabled_from_assignments.rb | Ruby | mit | 191 | main | 298 | class RemoveDynamicReviewerAssignmentsEnabledFromAssignments < ActiveRecord::Migration[4.2]
def self.up
remove_column :assignments, :dynamic_reviewer_assignments_enabled
end
def self.down
add_column :assignments, :dynamic_reviewer_assignments_enabled, :boolean, default: 0
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/079_rename_peer_reviews.rb | Ruby | mit | 191 | main | 1,965 | class RenamePeerReviews < ActiveRecord::Migration[4.2]
def self.up
begin
rename_table :peer_reviews, :teammate_reviews
rescue StandardError
end
begin
rename_table :peer_review_scores, :teammate_review_scores
rescue StandardError
end
begin
execute 'alter table teammate_r... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150507030527_add_take_quiz_allowed_to_participants.rb | Ruby | mit | 191 | main | 247 | class AddTakeQuizAllowedToParticipants < ActiveRecord::Migration[4.2]
def self.up
add_column 'participants', 'take_quiz_allowed', :boolean, default: true
end
def self.down
remove_column 'participants', 'take_quiz_allowed'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160902201338_change_default_value_of_quiz_allowed_id_in_due_dates_table.rb | Ruby | mit | 191 | main | 251 | class ChangeDefaultValueOfQuizAllowedIdInDueDatesTable < ActiveRecord::Migration[4.2]
def self.up
change_column_default :due_dates, :quiz_allowed_id, 1
end
def self.down
change_column_default :due_dates, :quiz_allowed_id, nil
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20151229181732_remove_sumitted_hyperlink_and_dir_num_from_participants.rb | Ruby | mit | 191 | main | 212 | class RemoveSumittedHyperlinkAndDirNumFromParticipants < ActiveRecord::Migration[4.2]
def change
remove_column :participants, :submitted_hyperlinks
remove_column :participants, :directory_num
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/020_create_review_mappings.rb | Ruby | mit | 191 | main | 1,315 | class CreateReviewMappings < ActiveRecord::Migration[4.2]
def self.up
create_table 'review_mappings', force: true do |t|
t.column 'author_id', :integer
t.column 'team_id', :integer
t.column 'reviewer_id', :integer
t.column 'assignment_id', :integer
end
add_index 'review_mappings',... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/025_create_assignments_questionnaires.rb | Ruby | mit | 191 | main | 1,004 | class CreateAssignmentsQuestionnaires < ActiveRecord::Migration[4.2]
def self.up
create_table 'assignments_questionnaires', force: true do |t|
t.column 'questionnaire_id', :integer, default: 0, null: false
t.column 'assignment_id', :integer, default: 0, null: false
end
add_index 'assignments_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.