Sha256: 263cdca56916464cf7518d27c249803056ddcb6c75be4c7a3792d4039144cc03

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

postgres = ActiveRecord::Base.connection.class.name == "ActiveRecord::ConnectionAdapters::PostgreSQLAdapter"

ActiveRecord::Schema.define do
  if postgres
    enable_extension "pgcrypto"
  end

  create_table :people, temporal: true, force: true do |t|
    t.belongs_to :coven
    t.string :name
  end

  create_table :covens, force: true do |t|
    t.string :name
  end
  add_temporal_table :covens

  create_table :warts, temporal: true, force: true do |t|
    t.belongs_to :person
    t.integer :hairiness
  end

  create_table :flying_machines, temporal: true, force: true do |t|
    t.belongs_to :person
    t.string :type
    t.string :model
  end

  create_table :cats, id: (postgres ? :uuid : :integer), temporal: true, force: true do |t|
    t.string :name
    t.string :color
  end

  create_table :cat_lives, id: (postgres ? :uuid : :integer), temporal: true do |t|
    t.belongs_to :cat, type: (postgres ? :uuid : :integer)
    t.timestamp :started_at
    t.timestamp :ended_at
    t.string :death_reason
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
temporal_tables-0.8.1 spec/internal/db/schema.rb
temporal_tables-0.8.0 spec/internal/db/schema.rb