Sha256: 664cdbde04e71ebedc45a81530ee17f77e1de42c9d16d0c2f8f4e1be9d060de5

Contents?: true

Size: 890 Bytes

Versions: 2

Compression:

Stored size: 890 Bytes

Contents

module Turntables
# @author Simon Symeonidis
# Some static information factored out to avoid class variables, and to 
# separate concerns.
module VersionHistorySql
  # Table name of this guy
  TableName  = "version_histories"

  # Table schema for the version history table.
  Create     = "CREATE TABLE #{TableName} ("\
    "id      INTEGER PRIMARY KEY AUTOINCREMENT, "\
    "version BIGINT, "\
    "date    BIGINT, "\
    "comment TEXT)"

  # Select last inserted transaction
  SelectLast = "SELECT * FROM #{TableName} "\
    " WHERE id=(SELECT MAX(id) FROM #{TableName});"

  # Select a record by id
  SelectById = "SELECT * FROM #{TableName} WHERE id=?"

  # Select all the records
  SelectAll  = "SELECT * FROM #{TableName}"
 
  # Sql to insert a version history into the table
  Insert     = "INSERT INTO #{TableName} (version,date,comment)"\
               " values (?,?,?)"
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turntables-1.0.3 lib/turntables/sql_modules/version_history_sql.rb
turntables-1.0.1 lib/turntables/sql_modules/version_history_sql.rb