-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.rb
More file actions
40 lines (33 loc) · 1016 Bytes
/
database.rb
File metadata and controls
40 lines (33 loc) · 1016 Bytes
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
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'mysql://localhost/fixmyhospital')
class Problem
include DataMapper::Resource
property :id, Serial
property :code1, Text
property :code2, Text
property :subject, Text
property :details, Text
property :photo, Text
property :name, Text
property :email, Text
property :phone, Text
property :fixed, Boolean, :default => false
property :created_at, DateTime
property :updated_at, DateTime
has n, :comments
end
class Comment
include DataMapper::Resource
property :id, Serial
property :problem_id, Integer
property :name, Text
property :email, Text
property :web, Text
property :comment, Text
property :created_at, DateTime
property :updated_at, DateTime
belongs_to :problem
end
#DataMapper.auto_migrate!
#p = Problem.new(:code1 => 'RKEQ4', :subject => 'Things broke!', :details => 'Srsly, they were important.')
#p.save!