Sha256: 6b5ffeacf6a1a120da91cd272afc2a941c529e5cfcb83abc83ae3c5f3b01c154
Contents?: true
Size: 922 Bytes
Versions: 2
Compression:
Stored size: 922 Bytes
Contents
# We can't use Volt::Model until after the reconcile step has happened, so # these methods work directly with the database. module Volt class MigrationRunner def raw_db @raw_db ||= Volt.current_app.database.raw_db end def ensure_migration_versions_table if !raw_db.tables || !raw_db.tables.include?(:migration_versions) raw_db.create_table(:migration_versions) do primary_key :id Fixnum :version, unique: true end end end def add_version(version) raw_db[:migration_versions].insert(version: version) end def has_version?(version) raw_db.from(:migration_versions).where(version: version).count > 0 end def remove_version(version) raw_db.from(:migration_versions).where(version: version).delete end def all_versions raw_db.from(:migration_versions).all.map {|v| v[:version] } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
volt-sql-0.0.3 | app/sql/lib/migration_runner.rb |
volt-sql-0.0.2 | app/sql/lib/migration_runner.rb |