add preserve submitters order option

This commit is contained in:
Alex Turchyn
2023-09-10 02:10:01 +03:00
parent 07e49f9f07
commit 62cea05084
15 changed files with 118 additions and 28 deletions
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class AddSubmittersOrderToSubmissions < ActiveRecord::Migration[7.0]
class MigrationSubmission < ApplicationRecord
self.table_name = 'submissions'
end
def change
add_column :submissions, :submitters_order, :string
MigrationSubmission.where(submitters_order: nil).update_all(submitters_order: 'random')
change_column_null :submissions, :submitters_order, false
end
end
+2 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_09_02_171216) do
ActiveRecord::Schema[7.0].define(version: 2023_09_09_213212) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -101,6 +101,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_02_171216) do
t.text "template_schema"
t.text "template_submitters"
t.text "source", null: false
t.string "submitters_order", null: false
t.index ["created_by_user_id"], name: "index_submissions_on_created_by_user_id"
t.index ["template_id"], name: "index_submissions_on_template_id"
end