add template preferences

This commit is contained in:
Pete Matsyburka
2024-04-17 16:08:58 +03:00
parent fefd138dfd
commit 1e57c1ace7
18 changed files with 317 additions and 9 deletions
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class AddPreferencesToTemplates < ActiveRecord::Migration[7.1]
class MigrationTemplate < ApplicationRecord
self.table_name = 'templates'
end
def change
add_column :templates, :preferences, :text
MigrationTemplate.where(preferences: nil).update_all(preferences: '{}')
change_column_null :templates, :preferences, 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.1].define(version: 2024_04_05_165329) do
ActiveRecord::Schema[7.1].define(version: 2024_04_16_170023) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -222,6 +222,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_05_165329) do
t.text "source", null: false
t.bigint "folder_id", null: false
t.string "external_id"
t.text "preferences", null: false
t.index ["account_id"], name: "index_templates_on_account_id"
t.index ["author_id"], name: "index_templates_on_author_id"
t.index ["folder_id"], name: "index_templates_on_folder_id"