import { db } from 'api/src/lib/db.js' // Manually apply seeds via the `yarn cedar prisma db seed` command. // // Seeds automatically run the first time you run the `yarn cedar prisma migrate dev` // command and every time you run the `yarn cedar prisma migrate reset` command. // // See https://cedarjs.com/docs/database-seeds for more info export default async () => { try { const users = [ { id: '4c3d3e8e-2b1a-4f5c-8c7d-9e0f1a2b3c4d', email: 'user.one@example.com', hashedPassword: 'fake_hash', fullName: 'User One', salt: 'fake_salt', }, { id: '5d4e5f9f-3c2b-5e6d-9d8e-0f1a2b3c4d5e', email: 'user.two@example.com', hashedPassword: 'fake_hash', fullName: 'User Two', salt: 'fake_salt', }, ] if ((await db.user.count()) === 0) { await Promise.all(users.map((user) => db.user.create({ data: user }))) } else { console.log('Users already seeded') } } catch (error) { console.error(error) } try { const posts = [ { title: 'Welcome to the blog!', body: "I'm baby single- origin coffee kickstarter lo - fi paleo skateboard.Tumblr hashtag austin whatever DIY plaid knausgaard fanny pack messenger bag blog next level woke.Ethical bitters fixie freegan,helvetica pitchfork 90's tbh chillwave mustache godard subway tile ramps art party. Hammock sustainable twee yr bushwick disrupt unicorn, before they sold out direct trade chicharrones etsy polaroid hoodie. Gentrify offal hoodie fingerstache.", authorId: '4c3d3e8e-2b1a-4f5c-8c7d-9e0f1a2b3c4d', }, { title: 'A little more about me', body: "Raclette shoreditch before they sold out lyft. Ethical bicycle rights meh prism twee. Tote bag ennui vice, slow-carb taiyaki crucifix whatever you probably haven't heard of them jianbing raw denim DIY hot chicken. Chillwave blog succulents freegan synth af ramps poutine wayfarers yr seitan roof party squid. Jianbing flexitarian gentrify hexagon portland single-origin coffee raclette gluten-free. Coloring book cloud bread street art kitsch lumbersexual af distillery ethical ugh thundercats roof party poke chillwave. 90's palo santo green juice subway tile, prism viral butcher selvage etsy pitchfork sriracha tumeric bushwick.", authorId: '4c3d3e8e-2b1a-4f5c-8c7d-9e0f1a2b3c4d', }, { title: 'What is the meaning of life?', body: 'Meh waistcoat succulents umami asymmetrical, hoodie post-ironic paleo chillwave tote bag. Trust fund kitsch waistcoat vape, cray offal gochujang food truck cloud bread enamel pin forage. Roof party chambray ugh occupy fam stumptown. Dreamcatcher tousled snackwave, typewriter lyft unicorn pabst portland blue bottle locavore squid PBR&B tattooed.', authorId: '5d4e5f9f-3c2b-5e6d-9d8e-0f1a2b3c4d5e', }, ] if ((await db.post.count()) === 0) { await Promise.all( posts.map(async (post) => { const newPost = await db.post.create({ data: post }) console.log(newPost) }) ) } else { console.log('Posts already seeded') } } catch (error) { console.error(error) } try { const todos = [ { title: 'Learn Cedar', body: 'Read the docs and try building a small app.', done: true, }, { title: 'Try gqlorm', body: 'Auto-generated backend resolvers are pretty neat!', done: false, }, { title: 'Write tests', body: null, done: false, }, ] if ((await db.todo.count()) === 0) { await Promise.all( todos.map(async (todo) => { const newTodo = await db.todo.create({ data: todo }) console.log(newTodo) }) ) } else { console.log('Todos already seeded') } } catch (error) { console.error(error) } try { // Create your database records here! For example, seed some users: // // const users = [ // { name: 'Alice', email: 'alice@cedarjs.com' }, // { name: 'Bob', email: 'bob@cedarjs.com' }, // ] // // await db.user.createMany({ data: users }) console.info( '\n No seed data, skipping. See scripts/seed.ts to start seeding your database!\n' ) } catch (error) { console.error(error) } }