Sha256: 0342f9562f7e35059272c09cd91d9c7c750e34d228b1291914d31ad282b7d648

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

module Timetrap
  class Entry < Sequel::Model
    plugin :schema

    def start= time
      self[:start]= Chronic.parse(time) || time
    end

    def end= time
      self[:end]= Chronic.parse(time) || time
    end

    # do a quick pseudo migration.  This should only get executed on the first run
    set_schema do
      primary_key :id
      column :note, :string
      column :start, :timestamp
      column :end, :timestamp
      column :sheet, :string
    end
    create_table unless table_exists?
  end

  class Meta < Sequel::Model(:meta)
    plugin :schema

    set_schema do
      primary_key :id
      column :key, :string
      column :value, :string
    end
    create_table unless table_exists?
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
samg-timetrap-0.0.8 lib/timetrap/models.rb
samg-timetrap-0.0.9 lib/timetrap/models.rb
samg-timetrap-0.1.0 lib/timetrap/models.rb