Class: UseUnprefixedCmsTables

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/ruby_cms/templates/db/migrate/20260212000001_use_unprefixed_cms_tables.rb

Overview

Ensures CMS uses unprefixed table names (preferences, content_blocks, permissions, user_permissions, visitor_errors). Creates tables only if they don't exist so host apps with existing tables are not overwritten. Adds missing columns when tables exist.

Instance Method Summary collapse

Instance Method Details

#downObject



17
18
19
# File 'lib/generators/ruby_cms/templates/db/migrate/20260212000001_use_unprefixed_cms_tables.rb', line 17

def down
  # No-op: leave unprefixed tables in place; host app may rely on them.
end

#upObject



7
8
9
10
11
12
13
14
15
# File 'lib/generators/ruby_cms/templates/db/migrate/20260212000001_use_unprefixed_cms_tables.rb', line 7

def up
  create_preferences_if_missing
  ensure_content_blocks_table
  ensure_content_blocks_columns
  create_permissions_if_missing
  create_user_permissions_if_missing
  ensure_visitor_errors_table
  ensure_visitor_errors_columns
end