mirror of
https://github.com/discourse/discourse.git
synced 2025-10-03 17:21:20 +08:00
Previously, all script tags in a theme field would be combined into a single `.js` bundle along with the `text/discourse-plugin` modules. This led to some unexpected run order, and also makes it hard to implement the `type=module` change being developed in #33103. This commit refactors things so that each raw script gets extracted into its own `.js` bundle, which is then placed in exactly the same place in the HTML.
15 lines
529 B
Ruby
15 lines
529 B
Ruby
# frozen_string_literal: true
|
|
class UpdateJavascriptCache < ActiveRecord::Migration[7.2]
|
|
def change
|
|
remove_index :javascript_caches,
|
|
column: :theme_field_id,
|
|
name: :index_javascript_caches_on_theme_field_id,
|
|
unique: true
|
|
add_column :javascript_caches, :name, :string
|
|
add_index :javascript_caches,
|
|
%i[theme_field_id name],
|
|
unique: true,
|
|
nulls_not_distinct: true,
|
|
where: "theme_field_id IS NOT NULL"
|
|
end
|
|
end
|