class Vcs4sql::Changelog

Attributes

file[R]
id[R]
md5sum[R]
sql[R]
version[R]

Public Class Methods

new(file, applied, version, md5sum, sql, id: 0) click to toggle source
# File lib/vcs4sql/changelog.rb, line 30
def initialize(file, applied, version, md5sum, sql, id: 0)
  @file = file
  @applied = applied
  @version = version
  @md5sum = md5sum
  @sql = sql
  @id = id
end

Public Instance Methods

apply(conn) click to toggle source

@todo #/DEV Raise the exception in case if

- this.* are empty or null
- conn is empty or null
# File lib/vcs4sql/changelog.rb, line 42
def apply(conn)
  # @todo #/DEV Wrap the sql's execution to separate blocks which will:
  #  - catch the error
  #  - provide the detailed description
  #  - populate the error code
  conn.execute_batch @sql
  conn.execute "insert /* ll.sqlid:#{__FILE__}:#{__method__} */
                into changelog(file,version,md5sum,applied,sql)
                values(?,?,?,?,?)",
               @file, @version, @md5sum, @applied, @sql
end
matches(exist) click to toggle source
# File lib/vcs4sql/changelog.rb, line 58
def matches(exist)
  @md5sum == exist.md5sum
end
to_s() click to toggle source
# File lib/vcs4sql/changelog.rb, line 54
def to_s
  "#{@version}: #{@file} #{@md5sum}"
end