class Vcs4sql::Sqlite::Applied
The applied (existing) database change log.
Public Class Methods
new(conn, sql: "select * from changelog order by version")
click to toggle source
@param [Object] conn the connection to the database. @param [String (frozen)] sql the query to fetch the change log from db.
# File lib/vcs4sql/sqlite/applied.rb, line 31 def initialize(conn, sql: "select * from changelog order by version") @conn = conn @sql = sql end
Public Instance Methods
absent(version)
click to toggle source
Ensure that applied change set has a change with particular version
# File lib/vcs4sql/sqlite/applied.rb, line 41 def absent(version) change(version).nil? end
change(version)
click to toggle source
Returns the details about applied change by version @param [Object] version the version of applied change @todo #/DEV Add verification of array usage over index.
The changelog shouldn't be a null.
# File lib/vcs4sql/sqlite/applied.rb, line 49 def change(version) changelog[version] end
empty?()
click to toggle source
# File lib/vcs4sql/sqlite/applied.rb, line 36 def empty? changelog.empty? end
Private Instance Methods
changelog()
click to toggle source
Evaluate the applied database change log. @todo #/DEV Add verification that connection not a null, throw error
with proper error code in order to explain the problem. Potentially we need to define the class with error codes.
# File lib/vcs4sql/sqlite/applied.rb, line 59 def changelog return @changelog if defined? @changelog @changelog = @conn.query(@sql).map do |row| Changelog.new( row["file"], row["applied"], row["version"], row["md5sum"], row["sql"], id: row["id"] ) end end