Class: Testament::Database
- Inherits:
-
Object
- Object
- Testament::Database
- Defined in:
- lib/testament/database.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
Instance Method Summary collapse
- #create_schema ⇒ Object
-
#initialize(connection_parameters) ⇒ Database
constructor
A new instance of Database.
- #record(attributes) ⇒ Object
Constructor Details
#initialize(connection_parameters) ⇒ Database
Returns a new instance of Database.
7 8 9 |
# File 'lib/testament/database.rb', line 7 def initialize(connection_parameters) @db = Sequel.connect connection_parameters end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
5 6 7 |
# File 'lib/testament/database.rb', line 5 def db @db end |
Instance Method Details
#create_schema ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/testament/database.rb', line 11 def create_schema db.create_table :executions do primary_key :id, type: Bignum String :project, null: false String :command, null: false Time :start_time, null: false Fixnum :elapsed_milliseconds, null: false Fixnum :exit_status, null: false String :user, null: false String :version, null: false String :category, null: false end end |
#record(attributes) ⇒ Object
25 26 27 |
# File 'lib/testament/database.rb', line 25 def record(attributes) db[:executions].insert attributes end |