Module: Turntables::VersionHistorySql
- Included in:
- VersionHistory
- Defined in:
- lib/turntables/sql_modules/version_history_sql.rb
Overview
separate concerns.
Constant Summary collapse
- TableName =
Table name of this guy
"version_histories"
- Create =
Table schema for the version history table.
"CREATE TABLE #{TableName} ("\ "id INTEGER PRIMARY KEY AUTOINCREMENT, "\ "version BIGINT, "\ "date BIGINT, "\ "comment TEXT)"
- SelectLast =
Select last inserted transaction
"SELECT * FROM #{TableName} "\ " WHERE id=(SELECT MAX(id) FROM #{TableName});"
- SelectById =
Select a record by id
"SELECT * FROM #{TableName} WHERE id=?"
- SelectAll =
Select all the records
"SELECT * FROM #{TableName}"
- Insert =
Sql to insert a version history into the table
"INSERT INTO #{TableName} (version,date,comment)"\ " values (?,?,?)"