diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
| commit | 9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch) | |
| tree | 8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /db | |
| parent | 85a01e35274b8d4d4165a7b26bd7986e211246bb (diff) | |
| parent | 1853082fcd8c067390c246f9daa01a9b47387497 (diff) | |
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'db')
38 files changed, 214 insertions, 29 deletions
diff --git a/db/migrate/20090129204750_create_nodes.rb b/db/migrate/20090129204750_create_nodes.rb index e7cd562..e26dd39 100644 --- a/db/migrate/20090129204750_create_nodes.rb +++ b/db/migrate/20090129204750_create_nodes.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class CreateNodes < ActiveRecord::Migration | 1 | class CreateNodes < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :nodes do |t| | 3 | create_table :nodes do |t| |
| 4 | t.string :slug | 4 | t.string :slug |
diff --git a/db/migrate/20090129205013_add_missing_columns_for_nested_set_for_node.rb b/db/migrate/20090129205013_add_missing_columns_for_nested_set_for_node.rb index f8f8404..2aa4241 100644 --- a/db/migrate/20090129205013_add_missing_columns_for_nested_set_for_node.rb +++ b/db/migrate/20090129205013_add_missing_columns_for_nested_set_for_node.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddMissingColumnsForNestedSetForNode < ActiveRecord::Migration | 1 | class AddMissingColumnsForNestedSetForNode < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :nodes, :lft, :integer | 3 | add_column :nodes, :lft, :integer |
| 4 | add_column :nodes, :rgt, :integer | 4 | add_column :nodes, :rgt, :integer |
diff --git a/db/migrate/20090131113802_create_pages.rb b/db/migrate/20090131113802_create_pages.rb index 6a38038..bba9cad 100644 --- a/db/migrate/20090131113802_create_pages.rb +++ b/db/migrate/20090131113802_create_pages.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class CreatePages < ActiveRecord::Migration | 1 | class CreatePages < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :pages do |t| | 3 | create_table :pages do |t| |
| 4 | t.integer :node_id | 4 | t.integer :node_id |
diff --git a/db/migrate/20090131213536_add_published_at_to_pages.rb b/db/migrate/20090131213536_add_published_at_to_pages.rb index 0e4ee62..1a57deb 100644 --- a/db/migrate/20090131213536_add_published_at_to_pages.rb +++ b/db/migrate/20090131213536_add_published_at_to_pages.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddPublishedAtToPages < ActiveRecord::Migration | 1 | class AddPublishedAtToPages < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :pages, :published_at, :datetime | 3 | add_column :pages, :published_at, :datetime |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090201211523_add_join_table_for_flags_pages.rb b/db/migrate/20090201211523_add_join_table_for_flags_pages.rb index 99eb9c9..cda4af4b 100644 --- a/db/migrate/20090201211523_add_join_table_for_flags_pages.rb +++ b/db/migrate/20090201211523_add_join_table_for_flags_pages.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddJoinTableForFlagsPages < ActiveRecord::Migration | 1 | class AddJoinTableForFlagsPages < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :flags_pages, :id => false do |t| | 3 | create_table :flags_pages, :id => false do |t| |
| 4 | t.integer :flag_id | 4 | t.integer :flag_id |
diff --git a/db/migrate/20090206201554_add_head_id_to_node.rb b/db/migrate/20090206201554_add_head_id_to_node.rb index 7f4af4f..0e580c7 100644 --- a/db/migrate/20090206201554_add_head_id_to_node.rb +++ b/db/migrate/20090206201554_add_head_id_to_node.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddHeadIdToNode < ActiveRecord::Migration | 1 | class AddHeadIdToNode < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :nodes, :head_id, :integer | 3 | add_column :nodes, :head_id, :integer |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090208130829_create_users.rb b/db/migrate/20090208130829_create_users.rb index e91193c..1bd5228 100644 --- a/db/migrate/20090208130829_create_users.rb +++ b/db/migrate/20090208130829_create_users.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class CreateUsers < ActiveRecord::Migration | 1 | class CreateUsers < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :users do |t| | 3 | create_table :users do |t| |
| 4 | t.string :login | 4 | t.string :login |
diff --git a/db/migrate/20090208130906_add_user_id_to_pages.rb b/db/migrate/20090208130906_add_user_id_to_pages.rb index 02ebdef..4172829 100644 --- a/db/migrate/20090208130906_add_user_id_to_pages.rb +++ b/db/migrate/20090208130906_add_user_id_to_pages.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddUserIdToPages < ActiveRecord::Migration | 1 | class AddUserIdToPages < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :pages, :user_id, :integer | 3 | add_column :pages, :user_id, :integer |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090211220524_create_permissions.rb b/db/migrate/20090211220524_create_permissions.rb index 2e007a4..4ef6bc4 100644 --- a/db/migrate/20090211220524_create_permissions.rb +++ b/db/migrate/20090211220524_create_permissions.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class CreatePermissions < ActiveRecord::Migration | 1 | class CreatePermissions < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :permissions do |t| | 3 | create_table :permissions do |t| |
| 4 | t.boolean :granted | 4 | t.boolean :granted |
diff --git a/db/migrate/20090301104237_add_draft_id_to_nodes.rb b/db/migrate/20090301104237_add_draft_id_to_nodes.rb index a0ea672..32a79e5 100644 --- a/db/migrate/20090301104237_add_draft_id_to_nodes.rb +++ b/db/migrate/20090301104237_add_draft_id_to_nodes.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddDraftIdToNodes < ActiveRecord::Migration | 1 | class AddDraftIdToNodes < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :nodes, :draft_id, :integer | 3 | add_column :nodes, :draft_id, :integer |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090302184350_add_template_column_to_pages.rb b/db/migrate/20090302184350_add_template_column_to_pages.rb index e3aac66..c4d2ca3 100644 --- a/db/migrate/20090302184350_add_template_column_to_pages.rb +++ b/db/migrate/20090302184350_add_template_column_to_pages.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddTemplateColumnToPages < ActiveRecord::Migration | 1 | class AddTemplateColumnToPages < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :pages, :template, :string | 3 | add_column :pages, :template, :string |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090302215335_rename_template_to_template_name.rb b/db/migrate/20090302215335_rename_template_to_template_name.rb index 288209e..6efe523 100644 --- a/db/migrate/20090302215335_rename_template_to_template_name.rb +++ b/db/migrate/20090302215335_rename_template_to_template_name.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class RenameTemplateToTemplateName < ActiveRecord::Migration | 1 | class RenameTemplateToTemplateName < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | rename_column :pages, :template, :template_name | 3 | rename_column :pages, :template, :template_name |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090316194152_create_events.rb b/db/migrate/20090316194152_create_events.rb index 7f44fdf..4bf1174 100644 --- a/db/migrate/20090316194152_create_events.rb +++ b/db/migrate/20090316194152_create_events.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class CreateEvents < ActiveRecord::Migration | 1 | class CreateEvents < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :events do |t| | 3 | create_table :events do |t| |
| 4 | t.datetime :start_time | 4 | t.datetime :start_time |
diff --git a/db/migrate/20090316195143_create_occurrences.rb b/db/migrate/20090316195143_create_occurrences.rb index e0df07b..e397e3c 100644 --- a/db/migrate/20090316195143_create_occurrences.rb +++ b/db/migrate/20090316195143_create_occurrences.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class CreateOccurrences < ActiveRecord::Migration | 1 | class CreateOccurrences < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :occurrences do |t| | 3 | create_table :occurrences do |t| |
| 4 | t.string :summary | 4 | t.string :summary |
diff --git a/db/migrate/20090318203913_add_location_to_event.rb b/db/migrate/20090318203913_add_location_to_event.rb index 5345781..40dfbf1 100644 --- a/db/migrate/20090318203913_add_location_to_event.rb +++ b/db/migrate/20090318203913_add_location_to_event.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddLocationToEvent < ActiveRecord::Migration | 1 | class AddLocationToEvent < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :events, :location, :text | 3 | add_column :events, :location, :text |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090318212438_remove_summary_column_from_occurrences.rb b/db/migrate/20090318212438_remove_summary_column_from_occurrences.rb index 7110987..101b87c 100644 --- a/db/migrate/20090318212438_remove_summary_column_from_occurrences.rb +++ b/db/migrate/20090318212438_remove_summary_column_from_occurrences.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class RemoveSummaryColumnFromOccurrences < ActiveRecord::Migration | 1 | class RemoveSummaryColumnFromOccurrences < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | remove_column :occurrences, :summary | 3 | remove_column :occurrences, :summary |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090321150359_add_locking_user_id_to_nodes.rb b/db/migrate/20090321150359_add_locking_user_id_to_nodes.rb index b40dd71..32332c6 100644 --- a/db/migrate/20090321150359_add_locking_user_id_to_nodes.rb +++ b/db/migrate/20090321150359_add_locking_user_id_to_nodes.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddLockingUserIdToNodes < ActiveRecord::Migration | 1 | class AddLockingUserIdToNodes < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :nodes, :locking_user_id, :integer | 3 | add_column :nodes, :locking_user_id, :integer |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090401190026_add_full_name_to_users.rb b/db/migrate/20090401190026_add_full_name_to_users.rb index a2599e7..8bac436 100644 --- a/db/migrate/20090401190026_add_full_name_to_users.rb +++ b/db/migrate/20090401190026_add_full_name_to_users.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddFullNameToUsers < ActiveRecord::Migration | 1 | class AddFullNameToUsers < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | end | 3 | end |
| 4 | 4 | ||
diff --git a/db/migrate/20090424085851_create_assets.rb b/db/migrate/20090424085851_create_assets.rb index c7f1796..f6373b1 100644 --- a/db/migrate/20090424085851_create_assets.rb +++ b/db/migrate/20090424085851_create_assets.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class CreateAssets < ActiveRecord::Migration | 1 | class CreateAssets < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :assets do |t| | 3 | create_table :assets do |t| |
| 4 | t.string :name | 4 | t.string :name |
diff --git a/db/migrate/20090719180204_create_menu_items.rb b/db/migrate/20090719180204_create_menu_items.rb index a05012a..daf9597 100644 --- a/db/migrate/20090719180204_create_menu_items.rb +++ b/db/migrate/20090719180204_create_menu_items.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class CreateMenuItems < ActiveRecord::Migration | 1 | class CreateMenuItems < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :menu_items do |t| | 3 | create_table :menu_items do |t| |
| 4 | t.integer :node_id | 4 | t.integer :node_id |
diff --git a/db/migrate/20090809104800_add_position_to_menu_items.rb b/db/migrate/20090809104800_add_position_to_menu_items.rb index 97ff6f9..19f7825 100644 --- a/db/migrate/20090809104800_add_position_to_menu_items.rb +++ b/db/migrate/20090809104800_add_position_to_menu_items.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddPositionToMenuItems < ActiveRecord::Migration | 1 | class AddPositionToMenuItems < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :menu_items, :position, :integer | 3 | add_column :menu_items, :position, :integer |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090815220058_migrate_tagging_tables.rb b/db/migrate/20090815220058_migrate_tagging_tables.rb index e28a16e..23848da 100644 --- a/db/migrate/20090815220058_migrate_tagging_tables.rb +++ b/db/migrate/20090815220058_migrate_tagging_tables.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class MigrateTaggingTables < ActiveRecord::Migration | 1 | class MigrateTaggingTables < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :tags, :taggings_count, :integer, :default => 0, :null => false | 3 | add_column :tags, :taggings_count, :integer, :default => 0, :null => false |
| 4 | add_column :taggings, :user_id, :integer | 4 | add_column :taggings, :user_id, :integer |
diff --git a/db/migrate/20090901051946_create_related_assets.rb b/db/migrate/20090901051946_create_related_assets.rb index 849bf19..9c7b5bc 100644 --- a/db/migrate/20090901051946_create_related_assets.rb +++ b/db/migrate/20090901051946_create_related_assets.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class CreateRelatedAssets < ActiveRecord::Migration | 1 | class CreateRelatedAssets < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | create_table :related_assets do |t| | 3 | create_table :related_assets do |t| |
| 4 | t.integer :asset_id | 4 | t.integer :asset_id |
diff --git a/db/migrate/20090901095657_add_indices.rb b/db/migrate/20090901095657_add_indices.rb index 6dd54b2..15d3d77 100644 --- a/db/migrate/20090901095657_add_indices.rb +++ b/db/migrate/20090901095657_add_indices.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddIndices < ActiveRecord::Migration | 1 | class AddIndices < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | change_table :pages do |t| | 3 | change_table :pages do |t| |
| 4 | t.index :id | 4 | t.index :id |
diff --git a/db/migrate/20090907103525_add_type_column_to_menu_items.rb b/db/migrate/20090907103525_add_type_column_to_menu_items.rb index dda0f9c..ae935da 100644 --- a/db/migrate/20090907103525_add_type_column_to_menu_items.rb +++ b/db/migrate/20090907103525_add_type_column_to_menu_items.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddTypeColumnToMenuItems < ActiveRecord::Migration | 1 | class AddTypeColumnToMenuItems < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :menu_items, :type, :string | 3 | add_column :menu_items, :type, :string |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090907111533_add_type_id_to_menu_items.rb b/db/migrate/20090907111533_add_type_id_to_menu_items.rb index 5000e92..ea6790a 100644 --- a/db/migrate/20090907111533_add_type_id_to_menu_items.rb +++ b/db/migrate/20090907111533_add_type_id_to_menu_items.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddTypeIdToMenuItems < ActiveRecord::Migration | 1 | class AddTypeIdToMenuItems < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :menu_items, :type_id, :integer | 3 | add_column :menu_items, :type_id, :integer |
| 4 | end | 4 | end |
diff --git a/db/migrate/20090909113832_add_staged_slug_and_parent_id.rb b/db/migrate/20090909113832_add_staged_slug_and_parent_id.rb index ab883ca..2a65445 100644 --- a/db/migrate/20090909113832_add_staged_slug_and_parent_id.rb +++ b/db/migrate/20090909113832_add_staged_slug_and_parent_id.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddStagedSlugAndParentId < ActiveRecord::Migration | 1 | class AddStagedSlugAndParentId < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :nodes, :staged_slug, :string | 3 | add_column :nodes, :staged_slug, :string |
| 4 | add_column :nodes, :staged_parent_id, :integer | 4 | add_column :nodes, :staged_parent_id, :integer |
diff --git a/db/migrate/20090917180422_add_admin_flag_to_user.rb b/db/migrate/20090917180422_add_admin_flag_to_user.rb index d15c866..e33f5dd 100644 --- a/db/migrate/20090917180422_add_admin_flag_to_user.rb +++ b/db/migrate/20090917180422_add_admin_flag_to_user.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddAdminFlagToUser < ActiveRecord::Migration | 1 | class AddAdminFlagToUser < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :users, :admin, :boolean | 3 | add_column :users, :admin, :boolean |
| 4 | end | 4 | end |
diff --git a/db/migrate/20091111154113_add_editor_id_to_pages.rb b/db/migrate/20091111154113_add_editor_id_to_pages.rb index 971b8a3..bc13240 100644 --- a/db/migrate/20091111154113_add_editor_id_to_pages.rb +++ b/db/migrate/20091111154113_add_editor_id_to_pages.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class AddEditorIdToPages < ActiveRecord::Migration | 1 | class AddEditorIdToPages < ActiveRecord::Migration[4.2] |
| 2 | def self.up | 2 | def self.up |
| 3 | add_column :pages, :editor_id, :integer | 3 | add_column :pages, :editor_id, :integer |
| 4 | end | 4 | end |
diff --git a/db/migrate/20260623232228_upgrade_taggings_for_acts_as_taggable_on.rb b/db/migrate/20260623232228_upgrade_taggings_for_acts_as_taggable_on.rb new file mode 100644 index 0000000..4dad8a9 --- /dev/null +++ b/db/migrate/20260623232228_upgrade_taggings_for_acts_as_taggable_on.rb | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | class UpgradeTaggingsForActsAsTaggableOn < ActiveRecord::Migration[4.2] | ||
| 2 | def up | ||
| 3 | add_column :taggings, :context, :string | ||
| 4 | add_column :taggings, :tagger_id, :integer | ||
| 5 | add_column :taggings, :tagger_type, :string | ||
| 6 | |||
| 7 | # populate context for existing taggings | ||
| 8 | execute "UPDATE taggings SET context = 'tags'" | ||
| 9 | |||
| 10 | add_index :taggings, :context | ||
| 11 | add_index :taggings, [:tagger_id, :tagger_type] | ||
| 12 | end | ||
| 13 | |||
| 14 | def down | ||
| 15 | remove_column :taggings, :context | ||
| 16 | remove_column :taggings, :tagger_id | ||
| 17 | remove_column :taggings, :tagger_type | ||
| 18 | end | ||
| 19 | end | ||
diff --git a/db/migrate/20260624035149_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20260624035149_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..35daedd --- /dev/null +++ b/db/migrate/20260624035149_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 1) | ||
| 2 | class ActsAsTaggableOnMigration < ActiveRecord::Migration[4.2] | ||
| 3 | def self.up | ||
| 4 | create_table :tags do |t| | ||
| 5 | t.string :name | ||
| 6 | end | ||
| 7 | |||
| 8 | create_table :taggings do |t| | ||
| 9 | t.references :tag | ||
| 10 | |||
| 11 | # You should make sure that the column created is | ||
| 12 | # long enough to store the required class names. | ||
| 13 | t.references :taggable, polymorphic: true | ||
| 14 | t.references :tagger, polymorphic: true | ||
| 15 | |||
| 16 | # Limit is created to prevent MySQL error on index | ||
| 17 | # length for MyISAM table type: http://bit.ly/vgW2Ql | ||
| 18 | t.string :context, limit: 128 | ||
| 19 | |||
| 20 | t.datetime :created_at | ||
| 21 | end | ||
| 22 | |||
| 23 | add_index :taggings, :tag_id | ||
| 24 | add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 25 | end | ||
| 26 | |||
| 27 | def self.down | ||
| 28 | drop_table :taggings | ||
| 29 | drop_table :tags | ||
| 30 | end | ||
| 31 | end | ||
diff --git a/db/migrate/20260624035150_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20260624035150_add_missing_unique_indices.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..52f9ab5 --- /dev/null +++ b/db/migrate/20260624035150_add_missing_unique_indices.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 2) | ||
| 2 | class AddMissingUniqueIndices < ActiveRecord::Migration[4.2] | ||
| 3 | def self.up | ||
| 4 | add_index :tags, :name, unique: true | ||
| 5 | |||
| 6 | remove_index :taggings, :tag_id | ||
| 7 | remove_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 8 | add_index :taggings, | ||
| 9 | [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], | ||
| 10 | unique: true, name: 'taggings_idx' | ||
| 11 | end | ||
| 12 | |||
| 13 | def self.down | ||
| 14 | remove_index :tags, :name | ||
| 15 | |||
| 16 | remove_index :taggings, name: 'taggings_idx' | ||
| 17 | add_index :taggings, :tag_id | ||
| 18 | add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 19 | end | ||
| 20 | end | ||
diff --git a/db/migrate/20260624035151_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20260624035151_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..5a3f71a --- /dev/null +++ b/db/migrate/20260624035151_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 3) | ||
| 2 | class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2] | ||
| 3 | def self.up | ||
| 4 | add_column :tags, :taggings_count, :integer, default: 0 | ||
| 5 | |||
| 6 | ActsAsTaggableOn::Tag.reset_column_information | ||
| 7 | ActsAsTaggableOn::Tag.find_each do |tag| | ||
| 8 | ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) | ||
| 9 | end | ||
| 10 | end | ||
| 11 | |||
| 12 | def self.down | ||
| 13 | remove_column :tags, :taggings_count | ||
| 14 | end | ||
| 15 | end | ||
diff --git a/db/migrate/20260624035152_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20260624035152_add_missing_taggable_index.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..f287376 --- /dev/null +++ b/db/migrate/20260624035152_add_missing_taggable_index.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 4) | ||
| 2 | class AddMissingTaggableIndex < ActiveRecord::Migration[4.2] | ||
| 3 | def self.up | ||
| 4 | add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 5 | end | ||
| 6 | |||
| 7 | def self.down | ||
| 8 | remove_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 9 | end | ||
| 10 | end | ||
diff --git a/db/migrate/20260624035153_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20260624035153_change_collation_for_tag_names.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..4c144a8 --- /dev/null +++ b/db/migrate/20260624035153_change_collation_for_tag_names.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 5) | ||
| 2 | # This migration is added to circumvent issue #623 and have special characters | ||
| 3 | # work properly | ||
| 4 | class ChangeCollationForTagNames < ActiveRecord::Migration[4.2] | ||
| 5 | def up | ||
| 6 | if ActsAsTaggableOn::Utils.using_mysql? | ||
| 7 | execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") | ||
| 8 | end | ||
| 9 | end | ||
| 10 | end | ||
diff --git a/db/migrate/20260625031409_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20260625031409_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..7c39589 --- /dev/null +++ b/db/migrate/20260625031409_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 6) | ||
| 2 | if ActiveRecord.gem_version >= Gem::Version.new('5.0') | ||
| 3 | class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end | ||
| 4 | else | ||
| 5 | class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end | ||
| 6 | end | ||
| 7 | AddMissingIndexesOnTaggings.class_eval do | ||
| 8 | def change | ||
| 9 | add_index ActsAsTaggableOn.taggings_table, :tag_id unless index_exists? ActsAsTaggableOn.taggings_table, :tag_id | ||
| 10 | add_index ActsAsTaggableOn.taggings_table, :taggable_id unless index_exists? ActsAsTaggableOn.taggings_table, :taggable_id | ||
| 11 | add_index ActsAsTaggableOn.taggings_table, :taggable_type unless index_exists? ActsAsTaggableOn.taggings_table, :taggable_type | ||
| 12 | add_index ActsAsTaggableOn.taggings_table, :tagger_id unless index_exists? ActsAsTaggableOn.taggings_table, :tagger_id | ||
| 13 | add_index ActsAsTaggableOn.taggings_table, :context unless index_exists? ActsAsTaggableOn.taggings_table, :context | ||
| 14 | |||
| 15 | unless index_exists? ActsAsTaggableOn.taggings_table, [:tagger_id, :tagger_type] | ||
| 16 | add_index ActsAsTaggableOn.taggings_table, [:tagger_id, :tagger_type] | ||
| 17 | end | ||
| 18 | |||
| 19 | unless index_exists? ActsAsTaggableOn.taggings_table, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy' | ||
| 20 | add_index ActsAsTaggableOn.taggings_table, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy' | ||
| 21 | end | ||
| 22 | end | ||
| 23 | end | ||
diff --git a/db/migrate/20260626025705_add_search_vector_to_page_translations.rb b/db/migrate/20260626025705_add_search_vector_to_page_translations.rb new file mode 100644 index 0000000..0747637 --- /dev/null +++ b/db/migrate/20260626025705_add_search_vector_to_page_translations.rb | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | class AddSearchVectorToPageTranslations < ActiveRecord::Migration[7.2] | ||
| 2 | def up | ||
| 3 | add_column :page_translations, :search_vector, :tsvector | ||
| 4 | |||
| 5 | execute <<~SQL | ||
| 6 | UPDATE page_translations | ||
| 7 | SET search_vector = to_tsvector( | ||
| 8 | 'simple', | ||
| 9 | coalesce(title, '') || ' ' || | ||
| 10 | coalesce(abstract, '') || ' ' || | ||
| 11 | coalesce(body, '') | ||
| 12 | ) | ||
| 13 | SQL | ||
| 14 | |||
| 15 | add_index :page_translations, :search_vector, | ||
| 16 | using: :gin, | ||
| 17 | name: 'index_page_translations_on_search_vector' | ||
| 18 | |||
| 19 | execute <<~SQL | ||
| 20 | CREATE OR REPLACE FUNCTION page_translations_search_vector_update() | ||
| 21 | RETURNS trigger AS $$ | ||
| 22 | BEGIN | ||
| 23 | NEW.search_vector := to_tsvector( | ||
| 24 | 'simple', | ||
| 25 | coalesce(NEW.title, '') || ' ' || | ||
| 26 | coalesce(NEW.abstract, '') || ' ' || | ||
| 27 | coalesce(NEW.body, '') | ||
| 28 | ); | ||
| 29 | RETURN NEW; | ||
| 30 | END; | ||
| 31 | $$ LANGUAGE plpgsql; | ||
| 32 | |||
| 33 | CREATE TRIGGER page_translations_search_vector_trigger | ||
| 34 | BEFORE INSERT OR UPDATE ON page_translations | ||
| 35 | FOR EACH ROW EXECUTE PROCEDURE page_translations_search_vector_update(); | ||
| 36 | SQL | ||
| 37 | end | ||
| 38 | |||
| 39 | def down | ||
| 40 | execute <<~SQL | ||
| 41 | DROP TRIGGER IF EXISTS page_translations_search_vector_trigger ON page_translations; | ||
| 42 | DROP FUNCTION IF EXISTS page_translations_search_vector_update(); | ||
| 43 | SQL | ||
| 44 | remove_index :page_translations, name: 'index_page_translations_on_search_vector' | ||
| 45 | remove_column :page_translations, :search_vector | ||
| 46 | end | ||
| 47 | end | ||
diff --git a/db/migrate/20260626222953_remove_root_locale_from_page_translations.rb b/db/migrate/20260626222953_remove_root_locale_from_page_translations.rb new file mode 100644 index 0000000..51fcfbc --- /dev/null +++ b/db/migrate/20260626222953_remove_root_locale_from_page_translations.rb | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | class RemoveRootLocaleFromPageTranslations < ActiveRecord::Migration[7.2] | ||
| 2 | def up | ||
| 3 | count = execute("DELETE FROM page_translations WHERE locale = 'root'").cmd_tuples | ||
| 4 | say "Deleted #{count} root locale records from page_translations" | ||
| 5 | end | ||
| 6 | |||
| 7 | def down | ||
| 8 | raise ActiveRecord::IrreversibleMigration | ||
| 9 | end | ||
| 10 | end | ||
