Class: Vert::Generators::RlsMigrationGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Vert::Generators::RlsMigrationGenerator
- Defined in:
- lib/vert/generators/rls_migration_generator.rb
Instance Method Summary collapse
- #create_enable_rls_migration ⇒ Object
- #create_rls_functions_migration ⇒ Object
- #show_instructions ⇒ Object
Instance Method Details
#create_enable_rls_migration ⇒ Object
21 22 23 24 25 26 |
# File 'lib/vert/generators/rls_migration_generator.rb', line 21 def create_enable_rls_migration return if [:tables].empty? migration_template "enable_rls_on_tables.rb.tt", "db/migrate/#{}_enable_rls_on_tables.rb" end |
#create_rls_functions_migration ⇒ Object
16 17 18 19 |
# File 'lib/vert/generators/rls_migration_generator.rb', line 16 def create_rls_functions_migration migration_template "create_rls_functions.rb.tt", "db/migrate/#{}_create_rls_functions.rb" end |
#show_instructions ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vert/generators/rls_migration_generator.rb', line 28 def show_instructions say "\n" say "RLS migrations generated!", :green say "\n" say "Next steps:", :yellow say "1. Run migrations: rails db:migrate" say "2. Set enable_rls = true in config/initializers/vert.rb" say "3. Ensure your database user has appropriate privileges" say "\n" say "To enable RLS on additional tables, run:", :cyan say " rails generate vert:rls_migration --tables orders invoices" say "\n" end |