Class: AfterMigrate::Stores::FileStore
- Defined in:
- lib/after_migrate/store.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#run_id ⇒ Object
readonly
Returns the value of attribute run_id.
Instance Method Summary collapse
- #affected_tables ⇒ Object
-
#initialize(path:, run_id: nil) ⇒ FileStore
constructor
A new instance of FileStore.
- #merge_tables(schema, table_names) ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize(path:, run_id: nil) ⇒ FileStore
Returns a new instance of FileStore.
30 31 32 33 34 |
# File 'lib/after_migrate/store.rb', line 30 def initialize(path:, run_id: nil) super() @path = path.to_s @run_id = run_id.to_s.presence end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
28 29 30 |
# File 'lib/after_migrate/store.rb', line 28 def path @path end |
#run_id ⇒ Object (readonly)
Returns the value of attribute run_id.
28 29 30 |
# File 'lib/after_migrate/store.rb', line 28 def run_id @run_id end |
Instance Method Details
#affected_tables ⇒ Object
36 37 38 39 |
# File 'lib/after_migrate/store.rb', line 36 def affected_tables load_into_memory super end |
#merge_tables(schema, table_names) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/after_migrate/store.rb', line 41 def merge_tables(schema, table_names) return if table_names.blank? with_lock do merge_into_memory(read_schemas) merge_into_memory(schema => table_names) write_schemas(memory_to_hash) end end |
#reset! ⇒ Object
51 52 53 54 |
# File 'lib/after_migrate/store.rb', line 51 def reset! super with_lock { ::FileUtils.rm_f(path) } end |