Skip to content

Commit ee09282

Browse files
Build datamodel for online application (#97)
1 parent f75dde0 commit ee09282

17 files changed

+493
-1
lines changed

app/models/church.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# == Schema Information
2+
#
3+
# Table name: churches
4+
#
5+
# id :bigint not null, primary key
6+
# church_email :string
7+
# city :string
8+
# name :string
9+
# pastor :string
10+
# phone :string
11+
# state :string
12+
# street_address :string
13+
# zipcode :string
14+
# created_at :datetime not null
15+
# updated_at :datetime not null
16+
#
17+
class Church < ApplicationRecord
18+
end

app/models/pilgrim.rb

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# == Schema Information
2+
#
3+
# Table name: pilgrims
4+
#
5+
# id :bigint not null, primary key
6+
# allergies :text
7+
# alternative_phone :string
8+
# city :string
9+
# clergy :boolean default(FALSE)
10+
# date_birth :datetime
11+
# email :string
12+
# emergency_alternative_phone :string
13+
# emergency_city :string
14+
# emergency_name :string
15+
# emergency_primary_phone :string
16+
# emergency_relationship :string
17+
# first_name :string
18+
# followup_activities :boolean default(FALSE)
19+
# gender :string
20+
# health_condition :string
21+
# last_name :string
22+
# medication_time :boolean default(FALSE)
23+
# middle_name :string
24+
# musician :boolean default(FALSE)
25+
# nametag_name :string
26+
# occupation :string
27+
# physical_limitations :string
28+
# primary_phone :string
29+
# short_notice :text
30+
# state :string
31+
# street_address :string
32+
# walk_explained :text
33+
# work_phone :string
34+
# zipcode :string
35+
# created_at :datetime not null
36+
# updated_at :datetime not null
37+
# pilgrim_application_id :bigint not null
38+
#
39+
# Indexes
40+
#
41+
# index_pilgrims_on_pilgrim_application_id (pilgrim_application_id)
42+
#
43+
# Foreign Keys
44+
#
45+
# fk_rails_... (pilgrim_application_id => pilgrim_applications.id)
46+
#
47+
class Pilgrim < ApplicationRecord
48+
belongs_to :pilgrim_application
49+
has_many :churches
50+
end

app/models/pilgrim_application.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# == Schema Information
2+
#
3+
# Table name: pilgrim_applications
4+
#
5+
# id :bigint not null, primary key
6+
# payment_amount :decimal(, )
7+
# payment_method :string
8+
# created_at :datetime not null
9+
# updated_at :datetime not null
10+
#
11+
class PilgrimApplication < ApplicationRecord
12+
has_many :pilgrims
13+
has_many :churches, through: :pilgrims
14+
has_many :sponsors
15+
end

app/models/sponsor.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# == Schema Information
2+
#
3+
# Table name: sponsors
4+
#
5+
# id :bigint not null, primary key
6+
# alternative_phone :string
7+
# church_reunion :text
8+
# email :string
9+
# first_name :string
10+
# followup :boolean default(FALSE)
11+
# handicap_shower :boolean default(FALSE)
12+
# last_name :string
13+
# letter_min :boolean default(FALSE)
14+
# manage_stairs :boolean default(FALSE)
15+
# manage_top_bunk :boolean default(FALSE)
16+
# must_attend_events :boolean default(FALSE)
17+
# primary_phone :string
18+
# reviewed_good_sponsor :boolean default(FALSE)
19+
# top_bunk_health :text
20+
# understand_transportation :boolean default(FALSE)
21+
# walking_ramp :boolean default(TRUE)
22+
# wheelchairs :boolean default(FALSE)
23+
# created_at :datetime not null
24+
# updated_at :datetime not null
25+
# pilgrim_application_id :bigint not null
26+
#
27+
# Indexes
28+
#
29+
# index_sponsors_on_pilgrim_application_id (pilgrim_application_id)
30+
#
31+
# Foreign Keys
32+
#
33+
# fk_rails_... (pilgrim_application_id => pilgrim_applications.id)
34+
#
35+
class Sponsor < ApplicationRecord
36+
belongs_to :pilgrim_application
37+
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class CreateChurches < ActiveRecord::Migration[7.1]
2+
def change
3+
create_table :churches do |t|
4+
t.string :name
5+
t.string :phone
6+
t.string :street_address
7+
t.string :city
8+
t.string :state
9+
t.string :zipcode
10+
t.string :pastor
11+
t.string :church_email
12+
13+
t.timestamps
14+
end
15+
end
16+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class CreatePilgrimApplications < ActiveRecord::Migration[7.1]
2+
def change
3+
create_table :pilgrim_applications do |t|
4+
t.string :payment_method
5+
t.decimal :payment_amount
6+
7+
t.timestamps
8+
end
9+
end
10+
end
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
class CreatePilgrims < ActiveRecord::Migration[7.1]
2+
def change
3+
create_table :pilgrims do |t|
4+
t.string :first_name
5+
t.string :middle_name
6+
t.string :last_name
7+
t.string :street_address
8+
t.string :city
9+
t.string :state
10+
t.string :zipcode
11+
t.string :primary_phone
12+
t.string :alternative_phone
13+
t.string :work_phone
14+
t.string :email
15+
t.datetime :date_birth
16+
t.string :gender
17+
t.string :occupation
18+
t.string :nametag_name
19+
t.boolean :clergy, default: false
20+
t.boolean :musician, default: false
21+
t.string :emergency_name
22+
t.string :emergency_relationship
23+
t.string :emergency_city
24+
t.string :emergency_primary_phone
25+
t.string :emergency_alternative_phone
26+
t.string :health_condition
27+
t.string :physical_limitations
28+
t.boolean :medication_time, default: false
29+
t.text :allergies
30+
t.text :walk_explained
31+
t.boolean :followup_activities, default: false
32+
t.text :short_notice
33+
t.references :pilgrim_application, null: false, foreign_key: true
34+
35+
t.timestamps
36+
end
37+
end
38+
end
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
class CreateSponsors < ActiveRecord::Migration[7.1]
2+
def change
3+
create_table :sponsors do |t|
4+
t.string :first_name
5+
t.string :last_name
6+
t.string :email
7+
t.string :primary_phone
8+
t.string :alternative_phone
9+
t.text :church_reunion
10+
t.boolean :manage_stairs, default: false
11+
t.boolean :walking_ramp, default: true
12+
t.boolean :wheelchairs, default: false
13+
t.boolean :handicap_shower, default: false
14+
t.boolean :manage_top_bunk, default: false
15+
t.text :top_bunk_health
16+
t.boolean :reviewed_good_sponsor, default: false
17+
t.boolean :understand_transportation, default: false
18+
t.boolean :letter_min, default: false
19+
t.boolean :must_attend_events, default: false
20+
t.boolean :followup, default: false
21+
t.references :pilgrim_application, null: false, foreign_key: true
22+
23+
t.timestamps
24+
end
25+
end
26+
end

db/schema.rb

Lines changed: 83 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/factories/churches.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# == Schema Information
2+
#
3+
# Table name: churches
4+
#
5+
# id :bigint not null, primary key
6+
# church_email :string
7+
# city :string
8+
# name :string
9+
# pastor :string
10+
# phone :string
11+
# state :string
12+
# street_address :string
13+
# zipcode :string
14+
# created_at :datetime not null
15+
# updated_at :datetime not null
16+
#
17+
FactoryBot.define do
18+
factory :church do
19+
name { "MyString" }
20+
phone { "MyString" }
21+
street_address { "MyString" }
22+
city { "MyString" }
23+
state { "MyString" }
24+
zipcode { "MyString" }
25+
pastor { "MyString" }
26+
church_email { "MyString" }
27+
end
28+
end

0 commit comments

Comments
 (0)