robertcoopercode / tech-job-hunt

Record job applications and view analytics related to your job hunt 🎯
Apache License 2.0
26 stars 2 forks source link

Database SQL Tables #11

Open jono-allen opened 4 years ago

jono-allen commented 4 years ago

Hey awesome work on this! Really impressive! Wanting to play around with it locally. Had a few issues with the login and verifying email locally.

I have made this change in mail.ts to

const ses = new AWS.SES({ apiVersion: '2010-12-01', credentials, region: 'us-east-1', endpoint:'http://localhost:4566' });

also it's required to be run once localstack is running

aws ses verify-email-identity --email-address info@techjobhunt.com --endpoint-url=http://localhost:4566

as it was trying to hit the real aws.

The one thing that I couldn't;t work out though is how you created your tables locally? I was able to generate them using

prisma migrate save --experimental
prisma migrate up --experimental

but then I had to delete the changes as it would change the schema.prisma file. I guess its the one thing stopping me using Prisma for one of my own projects.

How did you go about creating the models and doing migrations? between environments?

robertcoopercode commented 4 years ago

Ah, I hadn't tried doing the email verification with local stack. Thanks for letting me know what is required to get that to work.

And regarding the SQL tables, I had developed most of this project using Prisma 1 and only recently migrated to Prisma 2. Prisma 1 basically had a migration tool built-in and I was relying on that to setup my MySQL tables.

I'm now working on a new Prisma 2 project and I'm planning on using Knex.js to manage the migrations since prisma migrate is still experiemental. However, I will be using the prisma introspect command line up my database tables with the Prisma schema definition in the schema.prisma. I still need to do manual adjustments to the schema.prisma file after introspecting, which isn't ideal (i'm hoping Prisma improves on this in the future).