Sha256: f4db47704aac72c670f3cd9a2ef56549743de2a6d02298c2eeffca749679ec02

Contents?: true

Size: 704 Bytes

Versions: 15

Compression:

Stored size: 704 Bytes

Contents

### Connection

DB = if RUBY_PLATFORM == 'java'
  Jdbc::SQLite3.load_driver
  Sequel.connect('jdbc:sqlite::memory:')
else
  Sequel.sqlite
end

Sequel::Model.instance_eval do
  def none
    where('1 = 0')
  end
end

### Tables

[:dummies, :fluffies, :bobbies].each do |m|
  DB.create_table m do
    primary_key :id
    String :string
    Integer :number
    Text :text
    Integer :dummy_id
  end
end

DB.create_table :loonies do
  Integer :fluffy_id
  String :string
end

### Classes

class Dummy < Sequel::Model
  one_to_many :fluffies
  one_to_many :bobbies
end

class Fluffy < Sequel::Model
  many_to_one :dummy
  one_to_one :loony
end

class Bobby < Sequel::Model
end

class Loony < Sequel::Model
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
protector-0.5.4 migrations/sequel.rb
protector-0.5.3 migrations/sequel.rb
protector-0.5.2 migrations/sequel.rb
protector-0.5.1 migrations/sequel.rb
protector-0.4.1 migrations/sequel.rb
protector-0.4.0 migrations/sequel.rb
protector-0.3.3 migrations/sequel.rb
protector-0.3.2 migrations/sequel.rb
protector-0.3.1 migrations/sequel.rb
protector-0.3.0 migrations/sequel.rb
protector-0.3.0.beta.2 migrations/sequel.rb
protector-0.2.4 migrations/sequel.rb
protector-0.2.3 migrations/sequel.rb
protector-0.2.2 migrations/sequel.rb
protector-0.2.1 migrations/sequel.rb