link to submission preview page in completed emails
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddSlugToSubmissions < ActiveRecord::Migration[7.0]
|
||||
class MigrationSubmission < ApplicationRecord
|
||||
self.table_name = 'submissions'
|
||||
end
|
||||
|
||||
def up
|
||||
add_column :submissions, :slug, :string
|
||||
|
||||
MigrationSubmission.where(slug: nil).find_each do |submission|
|
||||
submission.update_columns(slug: SecureRandom.base58(14))
|
||||
end
|
||||
|
||||
change_column_null :submissions, :slug, false
|
||||
|
||||
add_index :submissions, :slug, unique: true
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :submissions, :slug
|
||||
end
|
||||
end
|
||||
+3
-1
@@ -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_11_12_224432) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_11_19_222105) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@@ -124,7 +124,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_11_12_224432) do
|
||||
t.text "template_submitters"
|
||||
t.text "source", null: false
|
||||
t.string "submitters_order", null: false
|
||||
t.string "slug", null: false
|
||||
t.index ["created_by_user_id"], name: "index_submissions_on_created_by_user_id"
|
||||
t.index ["slug"], name: "index_submissions_on_slug", unique: true
|
||||
t.index ["template_id"], name: "index_submissions_on_template_id"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user