| 2 | import seedsData from "./seedsData"; |
| 3 | |
| 4 | async function main() { |
| 5 | const hashID: string[] = []; |
| 6 | for (const seed of seedsData) { |
| 7 | if (!hashID.includes(seed.data.id)) { |
| 8 | try { |
| 9 | const alreadyExists = await db.track.findUnique({ |
| 10 | where:{ |
| 11 | id:seed.data.id |
| 12 | } |
| 13 | }) |
| 14 | if(!alreadyExists){ |
| 15 | const track = await db.track.create({ |
| 16 | data: seed.data, |
| 17 | }); |
| 18 | } |
| 19 | hashID.push(seed.data.id); |
| 20 | } catch (error) { |
| 21 | console.log(error); |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | await db.categories.create({ |
| 27 | data: { |
| 28 | id: "web-development", |
| 29 | category: "Web Development", |
| 30 | }, |
| 31 | }); |
| 32 | |
| 33 | await db.categories.create({ |
| 34 | data: { |
| 35 | id: "adv-web-development", |
| 36 | category: "Advance Web Development", |
| 37 | }, |
| 38 | }); |
| 39 | |
| 40 | await db.categories.create({ |
| 41 | data: { |
| 42 | id: "dsa", |
| 43 | category: "Data Structures and Algorithms", |
| 44 | }, |
| 45 | }); |
| 46 | |
| 47 | await db.categories.create({ |
| 48 | data: { |
| 49 | id: "devops", |
| 50 | category: "Devops", |
| 51 | }, |
| 52 | }); |
| 53 | |
| 54 | await db.categories.create({ |
| 55 | data: { |
| 56 | id: "projects", |
| 57 | category: "Projects", |
| 58 | }, |
| 59 | }); |
| 60 | |
| 61 | await db.categories.create({ |