Class: PgEasyReplicate::CLI
- Inherits:
-
Thor
- Object
- Thor
- PgEasyReplicate::CLI
- Defined in:
- lib/pg_easy_replicate/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #bootstrap ⇒ Object
- #cleanup ⇒ Object
- #config_check ⇒ Object
- #start_sync ⇒ Object
- #stats ⇒ Object
- #stop_sync ⇒ Object
-
#switchover ⇒ Object
method_option :bi_directional, aliases: “-b”, desc: “Setup replication from target database to source database”.
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
159 160 161 |
# File 'lib/pg_easy_replicate/cli.rb', line 159 def self.exit_on_failure? true end |
Instance Method Details
#bootstrap ⇒ Object
53 54 55 |
# File 'lib/pg_easy_replicate/cli.rb', line 53 def bootstrap PgEasyReplicate.bootstrap() end |
#cleanup ⇒ Object
70 71 72 |
# File 'lib/pg_easy_replicate/cli.rb', line 70 def cleanup PgEasyReplicate.cleanup() end |
#config_check ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pg_easy_replicate/cli.rb', line 28 def config_check PgEasyReplicate.assert_config( special_user_role: [:special_user_role], copy_schema: [:copy_schema], tables: [:tables], schema_name: [:schema_name], ) puts "✅ Config is looking good." end |
#start_sync ⇒ Object
100 101 102 |
# File 'lib/pg_easy_replicate/cli.rb', line 100 def start_sync PgEasyReplicate::Orchestrate.start_sync() end |
#stats ⇒ Object
146 147 148 149 150 151 152 |
# File 'lib/pg_easy_replicate/cli.rb', line 146 def stats if [:watch] PgEasyReplicate::Stats.follow([:group_name]) else PgEasyReplicate::Stats.print([:group_name]) end end |
#stop_sync ⇒ Object
110 111 112 |
# File 'lib/pg_easy_replicate/cli.rb', line 110 def stop_sync PgEasyReplicate::Orchestrate.stop_sync(group_name: [:group_name]) end |
#switchover ⇒ Object
method_option :bi_directional,
aliases: "-b",
desc:
"Setup replication from target database to source database"
132 133 134 135 136 137 138 |
# File 'lib/pg_easy_replicate/cli.rb', line 132 def switchover PgEasyReplicate::Orchestrate.switchover( group_name: [:group_name], lag_delta_size: [:lag_delta_size], skip_vacuum_analyze: [:skip_vacuum_analyze] ) end |
#version ⇒ Object
155 156 157 |
# File 'lib/pg_easy_replicate/cli.rb', line 155 def version puts PgEasyReplicate::VERSION end |