Class: PersonDb::CreateDb

Inherits:
Object
  • Object
show all
Defined in:
lib/persondb/schema.rb

Instance Method Summary collapse

Instance Method Details

#upObject



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
# File 'lib/persondb/schema.rb', line 7

def up
  ActiveRecord::Schema.define do

###########
# use people ? instead of persons (person/persons makes it easier?)

create_table :persons do |t|
  t.string      :key,      null: false   # import/export key
  t.string      :name,     null: false
  t.string      :synonyms  # comma separated list of synonyms
  ### fix: change to alt_names

  t.string      :code       # three letter code (short title)  e.g used for formula1 driver etc.


  ## todo: add gender flag (male/female -man/lady  how?)
  t.date        :born_at     # optional date of birth (birthday)
  ## todo: add country of birth  might not be the same as nationality

  t.references  :city
  t.references  :region
  t.references  :country      ## ,  null: false

  t.references  :nationality  ## , null: false  # by default assume same as country of birth (see above)
## fix: add nationality2 n nationality3 too

  t.timestamps
end


  end  # Schema.define
end