Class: Vcs4sql::Sqlite::Migration
- Inherits:
-
Object
- Object
- Vcs4sql::Sqlite::Migration
- Defined in:
- lib/vcs4sql/sqlite/migration.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ Migration
constructor
A new instance of Migration.
- #upgrade(home, testdata = false) ⇒ Object
Constructor Details
#initialize(file) ⇒ Migration
Returns a new instance of Migration.
41 42 43 44 45 |
# File 'lib/vcs4sql/sqlite/migration.rb', line 41 def initialize(file) FileUtils.mkdir_p File.dirname(file) @conn = SQLite3::Database.new file @conn.results_as_hash = true end |
Instance Method Details
#upgrade(home, testdata = false) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/vcs4sql/sqlite/migration.rb', line 49 def upgrade(home, testdata=false) install_vcs4sql existing = Applied.new @conn expected = Expected.new home, testdata if existing.empty? expected.apply_all @conn else expected.apply_mismatch existing, @conn end end |