Module: OracleToMysql::OptionalOverrideInstanceMethods
- Defined in:
- lib/oracle_to_mysql/optional_override_instance_methods.rb
Instance Method Summary collapse
-
#otm_config_file ⇒ Object
Override this if you have zany rules about where your config file is, there is a handy otm_config_hash method in the ApiInstanceMethods you can use to get stuff outta here.
-
#otm_retain_options ⇒ Object
TO CHANGE the retain options, override this method.
- #otm_source_config_hash ⇒ Object
-
#otm_strategy ⇒ Object
YOU WILL OFTEN WANT TO OVERRIDE THIS,.
- #otm_target_config_hash ⇒ Object
-
#otm_temp_target_table ⇒ Object
This is the table name that is created first on the server for the :atomic_rename strategy.
- #tmp_directory ⇒ Object
Instance Method Details
#otm_config_file ⇒ Object
Override this if you have zany rules about where your config file is, there is a handy otm_config_hash method in the ApiInstanceMethods you can use to get stuff outta here
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/oracle_to_mysql/optional_override_instance_methods.rb', line 39 def otm_config_file non_rails_path = File.join(Dir.pwd, 'oracle_to_mysql.yml') if defined?(RAILS_ROOT) rails_path = File.join(RAILS_ROOT,'config','database.yml') if rails_path @otm_db_config_yml_file_name = rails_path else raise "Weird, RAILS_ROOT detected but no databases.yml, something is amiss!" end elsif File.exists?(non_rails_path) @otm_db_config_yml_file_name = non_rails_path else raise "ERROR: No otm config file found" end end |
#otm_retain_options ⇒ Object
TO CHANGE the retain options, override this method
14 15 16 17 18 19 |
# File 'lib/oracle_to_mysql/optional_override_instance_methods.rb', line 14 def if @otm_retain_options.nil? @otm_retain_options = self.class. end @otm_retain_options end |
#otm_source_config_hash ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/oracle_to_mysql/optional_override_instance_methods.rb', line 21 def otm_source_config_hash if self.otm_config_hash.has_key?('oracle_source') return otm_config_hash['oracle_source'] else raise "Could not find oracle_source key in config file #{self.otm_config_file}, you should override this method" end end |
#otm_strategy ⇒ Object
YOU WILL OFTEN WANT TO OVERRIDE THIS,
5 6 7 8 9 10 |
# File 'lib/oracle_to_mysql/optional_override_instance_methods.rb', line 5 def otm_strategy if @otm_strategy.nil? @otm_strategy = self.class.otm_default_strategy end @otm_strategy end |
#otm_target_config_hash ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/oracle_to_mysql/optional_override_instance_methods.rb', line 28 def otm_target_config_hash if self.otm_config_hash.has_key?('mysql_target') return otm_config_hash['mysql_target'] else raise "Could not find mysql_target key in config file #{self.otm_config_file}, you should override this method" end end |
#otm_temp_target_table ⇒ Object
This is the table name that is created first on the server for the :atomic_rename strategy
57 58 59 |
# File 'lib/oracle_to_mysql/optional_override_instance_methods.rb', line 57 def otm_temp_target_table "#{self.otm_target_table}_#{self..to_i}_temp" end |
#tmp_directory ⇒ Object
61 62 63 |
# File 'lib/oracle_to_mysql/optional_override_instance_methods.rb', line 61 def tmp_directory "/tmp" end |