https://github.com/rhildred/2023mysql2example
https://github.com/rhildred/2023mysql2example
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rhildred/2023mysql2example
- Owner: rhildred
- Created: 2023-02-17T15:01:20.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-24T19:55:04.000Z (over 3 years ago)
- Last Synced: 2025-10-26T21:24:15.426Z (9 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 2023 mysql2 example
This uses mysql2-async and await to retreive data from a mysql instance contained within a docker container. To use:
1. Install docker desktop or docker.io on linux (first time only).
2. Run `docker-compose up` in the project folder to start the database.
3. The first time you use this run `npm install`
4. To run the migrations run `npm run migrate`
5. To run tests run `npm run test`
6. Install mysql workbench if you prefer and set up a connection to localhost to view the data
To create more migrations:
1. run `node migrate.js create `
2. I noticed that when I did that the migration was created, but I needed to do ^c to stop it.
3. put sql in the *_up_*.sql file and the *_down_*.sql file