Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

antti/postgres #11

Merged
merged 91 commits into from
Mar 1, 2024
Merged

antti/postgres #11

merged 91 commits into from
Mar 1, 2024

Conversation

anttiasmala
Copy link
Collaborator

Pohja tehty Postgresille

…able function name from handleSomething -> handlePrisma
…ed updatedAt as well. Made id, createdAt and updateAt optional
…etion works instantly. Before gave an error due to wrong ID. Added some class tests
…se search. Added functionality to Delete request
…risma. Added a response if gift was deleted properly
…ated a file prismaClient.ts to try a global Prisma client
@anttiasmala
Copy link
Collaborator Author

Kiitos jälleen tarkistuksesta! :) Nyt pitäisi olla kaikki korjailtu.

Tähän neuvoon #11 (comment) viittaavia korjaamattomia tai väärin korjattuja kohtia saattanee löytyä, pitää tuota harjoitella ja testailla, jotta pystyn olemaan varma osaamisestani 😄

Copy link
Owner

@samuliasmala samuliasmala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kommenttien lisäksi tekisin vielä kaksi muutosta:

  • README.md tiedostoon ohjeet miten otetaan käyttöön, eli
    1. Luo .env tiedosto .env.example tiedostosta
    2. Aja migraatiot npx prisma migrate deploy
  • Poistaisin kaikki migraatiot ja tyhjentäisin tietokannan, ja sitten generoisin skeemasta yhden uuden migraation niin poistuisi nuo testit.

Comment on lines +17 to +36
### Setting the environment variables

Create `.env` file using `.env.example` as a template.

Change the DATABASE_URL variable to match your database user's details.

For example: `DATABASE_URL="postgresql://johndoe:JohnDoeDoesPostgres@localhost:5432/johnDB?schema=public"`

`johnDB` in DATABASE_URL can be named whatever wanted. Prisma will make a new database if it does not exist.

### Run the migratiation

Run the migrations:

```bash
npx prisma migrate deploy
```

after this, the database is set up!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En ole README.md tiedostoja koskaan tehnyt, joten en tiedä onko tuo ollenkaan hyvä. 😄 Onko esimerkiksi rivit 23 - 25 turhat?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hyvin kirjoitettu tuo. Ja ei ole rivit 23-25 turhia. Erityisesti on hyvä tieto, että tietokantaa ei tarvitse itse luoda, vaan Prisma tekee sen.

Copy link
Owner

@samuliasmala samuliasmala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hienoa työtä!! 💪 Valmis mergettäväksi.

@anttiasmala anttiasmala merged commit 3a6a045 into main Mar 1, 2024
4 of 5 checks passed
@anttiasmala anttiasmala deleted the antti/postgres branch March 1, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2. Korvataan json-server tietokannalla
2 participants