preserve submitter preferences

This commit is contained in:
Pete Matsyburka
2023-11-23 20:03:52 +02:00
parent 514987138a
commit 01333e5b2e
19 changed files with 252 additions and 65 deletions
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class AddPreferencesToSubmitters < ActiveRecord::Migration[7.0]
class MigrationSubmitter < ApplicationRecord
self.table_name = 'submitters'
end
def change
add_column :submitters, :preferences, :text
MigrationSubmitter.where(preferences: nil).update_all(preferences: '{}')
change_column_null :submitters, :preferences, false
end
end
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class AddPreferencesToSubmissions < ActiveRecord::Migration[7.0]
class MigrationSubmission < ApplicationRecord
self.table_name = 'submissions'
end
def change
add_column :submissions, :preferences, :text
MigrationSubmission.where(preferences: nil).update_all(preferences: '{}')
change_column_null :submissions, :preferences, false
end
end
@@ -0,0 +1,16 @@
# frozen_string_literal: true
class CreateEmailMessages < ActiveRecord::Migration[7.0]
def change
create_table :email_messages do |t|
t.string :uuid, null: false, index: true
t.references :author, null: false, foreign_key: { to_table: :users }, index: false
t.references :account, null: false, foreign_key: true, index: true
t.text :subject, null: false
t.text :body, null: false
t.string :sha1, null: false, index: true
t.timestamps
end
end
end