Skip to content
This repository was archived by the owner on Mar 28, 2024. It is now read-only.

Commit d2a7477

Browse files
committed
Add seeds 🌱
1 parent 7c2699c commit d2a7477

1 file changed

Lines changed: 83 additions & 7 deletions

File tree

‎db/seeds.rb‎

Lines changed: 83 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,83 @@
1-
# This file should contain all the record creation needed to seed the database with its default values.
2-
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
3-
#
4-
# Examples:
5-
#
6-
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
7-
# Character.create(name: "Luke", movie: movies.first)
1+
ab_01 = AppropriateBody.create!(name: "Appropriate body one")
2+
ab_02 = AppropriateBody.create!(name: "Appropriate body two")
3+
_ab_03 = AppropriateBody.create!(name: "Appropriate body three")
4+
5+
ip_01 = InductionProgramme.create!
6+
_ip_02 = InductionProgramme.create!
7+
_ip_03 = InductionProgramme.create!
8+
9+
teacher_01 = Teacher.create!(name: "Teacher one")
10+
teacher_02 = Teacher.create!(name: "Teacher two")
11+
teacher_03 = Teacher.create!(name: "Teacher three")
12+
teacher_04 = Teacher.create!(name: "Teacher four")
13+
teacher_05 = Teacher.create!(name: "Teacher five")
14+
teacher_06 = Teacher.create!(name: "Teacher six")
15+
teacher_07 = Teacher.create!(name: "Teacher seven")
16+
teacher_08 = Teacher.create!(name: "Teacher eight")
17+
18+
[teacher_01, teacher_02, teacher_03, teacher_04, teacher_05, teacher_06, teacher_07, teacher_08].each do |teacher|
19+
teacher.email_addresses.create!(email: teacher.name.gsub(" ", "-").downcase + "@example.com")
20+
end
21+
22+
mat_01 = School.create!(name: "MAT one")
23+
school_01 = School.create!(name: "School one", mat: mat_01)
24+
school_02 = School.create!(name: "School two")
25+
school_03 = School.create!(name: "School three")
26+
27+
tenureship_01 = Tenureship.create!(school: school_01, teacher: teacher_01, started_on: 5.years.ago, finished_on: 3.year.ago)
28+
tenureship_02 = Tenureship.create!(school: school_02, teacher: teacher_01, started_on: 3.years.ago)
29+
tenureship_03 = Tenureship.create!(school: school_02, teacher: teacher_02, started_on: 6.years.ago)
30+
tenureship_04 = Tenureship.create!(school: school_01, teacher: teacher_03, started_on: 9.years.ago, finished_on: 3.year.ago)
31+
tenureship_05 = Tenureship.create!(school: school_02, teacher: teacher_04, started_on: 6.years.ago, finished_on: 2.year.ago)
32+
tenureship_06 = Tenureship.create!(school: school_03, teacher: teacher_03, started_on: 3.years.ago)
33+
tenureship_07 = Tenureship.create!(school: school_03, teacher: teacher_03, started_on: 3.years.ago)
34+
tenureship_08 = Tenureship.create!(school: school_02, teacher: teacher_04, started_on: 2.years.ago)
35+
tenureship_09 = Tenureship.create!(school: school_02, teacher: teacher_05, started_on: 4.years.ago)
36+
tenureship_10 = Tenureship.create!(school: mat_01, teacher: teacher_07, started_on: 4.years.ago)
37+
38+
Mentorship.create!(tenureship: tenureship_01, mentor: teacher_03) do |mentorship|
39+
InductionPeriod.create!(
40+
mentorship:,
41+
started_on: 3.years.ago,
42+
finished_on: 18.months.ago,
43+
appropriate_body: ab_01,
44+
induction_programme: ip_01
45+
)
46+
end
47+
48+
Mentorship.create!(tenureship: tenureship_02, mentor: teacher_01) do |mentorship|
49+
InductionPeriod.create!(
50+
mentorship:,
51+
started_on: 2.years.ago,
52+
finished_on: 9.months.ago,
53+
appropriate_body: ab_01,
54+
induction_programme: ip_01
55+
)
56+
end
57+
58+
Mentorship.create!(tenureship: tenureship_04, mentor: teacher_05) do |mentorship|
59+
InductionPeriod.create!(
60+
mentorship:,
61+
started_on: 1.years.ago,
62+
finished_on: 8.months.ago,
63+
appropriate_body: ab_01,
64+
induction_programme: ip_01
65+
)
66+
67+
InductionPeriod.create!(
68+
mentorship:,
69+
started_on: 8.years.ago,
70+
finished_on: 5.months.ago,
71+
appropriate_body: ab_02,
72+
induction_programme: ip_01
73+
)
74+
end
75+
76+
Mentorship.create!(tenureship: tenureship_03, mentor: teacher_03)
77+
Mentorship.create!(tenureship: tenureship_05, mentor: teacher_04)
78+
Mentorship.create!(tenureship: tenureship_06, mentor: teacher_07)
79+
Mentorship.create!(tenureship: tenureship_06, mentor: teacher_06)
80+
Mentorship.create!(tenureship: tenureship_07, mentor: teacher_02)
81+
Mentorship.create!(tenureship: tenureship_08, mentor: teacher_03)
82+
Mentorship.create!(tenureship: tenureship_09, mentor: teacher_02)
83+
Mentorship.create!(tenureship: tenureship_10, mentor: teacher_08)

0 commit comments

Comments
 (0)