-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathseeds.ts
51 lines (46 loc) · 1.73 KB
/
seeds.ts
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
import seedCalendarEntries from "./seeds/calenderEntries"
import seedContacts from "./seeds/contacts"
import seedMemberships from "./seeds/memberships"
import seedOperators from "./seeds/operators"
import seedProjects from "./seeds/projects"
import seedQualityLevels from "./seeds/qualityLevels"
import seedStakeholdernotes from "./seeds/stakeholdernotes"
import seedSubsections from "./seeds/subsections"
import seedSubsubsectionInfra from "./seeds/subsubsectionInfra"
import seedSubsubsectionSpecial from "./seeds/subsubsectionSpecial"
import seedSubsubsectionStatus from "./seeds/subsubsectionStatus"
import seedSubsubsectionTask from "./seeds/subsubsectionTask"
import seedSurveyResponseTopics from "./seeds/surveyresponsetopics"
import seedSurveys from "./seeds/surveys"
import seedUploads from "./seeds/uploads"
import seedUsers from "./seeds/users"
/*
* This seed function is executed when you run `blitz db seed`.
*/
const seed = async () => {
// It looks like we cannot set ENV variables as prefix to a call in npm run.
// But we can hack around this like this…
const seedAll = !process.env.npm_lifecycle_script?.includes("SEED_USER_ONLY")
if (seedAll) {
await seedProjects()
}
// When we use `npm run db:restoreDump` we want to seed our test uses
await seedUsers()
await seedMemberships()
if (seedAll) {
await seedOperators()
await seedQualityLevels()
await seedSubsections()
await seedStakeholdernotes()
await seedCalendarEntries()
await seedContacts()
await seedUploads()
await seedSurveys()
await seedSurveyResponseTopics()
await seedSubsubsectionStatus()
await seedSubsubsectionTask()
await seedSubsubsectionInfra()
await seedSubsubsectionSpecial()
}
}
export default seed