Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
$:.unshift 'lib'
require 'rubygems'
require 'camping-unabridged'
require 'sqlite3_api'
Camping.goes :Left
Camping.goes :Right
Camping.goes :StraightAhead
Camping.connect(:adapter => 'sqlite3', :database => 'test.db')

module Left::Models
  ActiveRecord! # or: AR!
  
  class Post < Base
  end
  
  class CreatePost < V 0.1
    def self.up
      create_table :left_posts do |t|
        t.string :title
        t.text   :body
      end
    end
    
    def self.down
      drop_table :left_posts
    end
  end
end

module Right::Models
  DataMapper! # or: DM!
  class Post
    include Resource
    
    property :id,    Serial
    property :title, String
    property :text,  String
  end
  
  class CreatePost < V 0.1
    up do
      create_table :right_posts do
        column :id,    Integer, :serial => true
        column :title, String
        column :text,  String
      end
    end
  end
end

module StraightAhead::Models
  Sequel!
  
  class Post < Model
  end
  
  class CreatePost < V 0.1
    def up
      create_table :straight_ahead_posts do
        string :title
        text   :body
      end
    end
    
    def down
      drop_table :straight_ahead_posts
    end
  end
end

Left::Models.create_schema
Right::Models.create_schema # or .auto_upgrade
StraightAhead::Models.create_schema