diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-26 05:19:28 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-26 05:19:28 +0200 |
| commit | a1ddc25da0d2aa79a4d9216ef7792f26233bd38e (patch) | |
| tree | 4d53e6ccb631e588c9e1d25c7a2dc5ef2ef44135 /doc | |
| parent | fa0ccc43010297c0c10e3075095c0a9171989498 (diff) | |
Stage 5 fixes: RouteWithParams removal, Globalize fallbacks, search stub, to_s(:db) → to_fs(:db), LockedByAnotherUser autoload, test environment config
- Remove safe_path helper and content_path shim from link_helper.rb
- Update all safe_path call sites in views to use named route helpers directly
- Fix Globalize fallbacks via config.i18n.fallbacks in application.rb, remove i18n initializer
- Stub Node.search returning none (search disabled pending PostgreSQL upgrade)
- Replace to_s(:db) with to_fs(:db) in node.rb, nodes_helper.rb, link_helper.rb, admin view
- Move LockedByAnotherUser to app/models/locked_by_another_user.rb for Zeitwerk autoloading
- Fix config/environments/test.rb: config.assets removed, cache_classes → enable_reloading,
test_order removed, minitest pinned to ~> 5.25
- Fix config/environments/development.rb: cache_classes → enable_reloading
- Park search vector migration in doc/ pending PostgreSQL and plpgsql availability
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/20260626025705_add_search_vector_to_page_translations.rb.pending | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/doc/20260626025705_add_search_vector_to_page_translations.rb.pending b/doc/20260626025705_add_search_vector_to_page_translations.rb.pending new file mode 100644 index 0000000..0747637 --- /dev/null +++ b/doc/20260626025705_add_search_vector_to_page_translations.rb.pending | |||
| @@ -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 | ||
