transactions-users-database v0.11.2
transactions-users-databse
Get Started
To jump right in for the first time you can set up your entire local database with the command:
yarn setup:local
Configuring a development database
If you like to know what's happening behind the scenes, we start with creating the database
yarn create:users
Once the database has been created you need to migrate the schema across and dump some data to each table.
yarn migrate && yarn seed
If you no longer need the data or you like to pack everything up once you've used it
yarn seed:undo
- will remove all auto-generated data from all tables
yarn rollback
- will undo the last migration that was run
Prerequisites
- You must have an instance of mysql running locally.
- Ubuntu https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-16-04
- Mac https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e
- Login into mysql using
mysql -u root -p
Default root password is no password - In mysql on the command line run
SHOW DATABASES
. The newly created database should be listed.
Steps
- Clone this repo.
- Run
yarn install
- To run the migrations on the database run
yarn migrate
- To rollback the last migration run
yarn rollback
- Once the database and table have been created, users will need to be created. To do this run
yarn seed
- You should now be all systems go!
Adding migrations
To create a new migration, run npx sequelize migration:generate --name <migration-name>
. This will generate a file under 'migrations' folder and add attach a timestamp to its name. Modify the created file as needed.
Changelog
The changelog can be automatically updated by running yarn run changelog
. This will take
the semantic git commit messages
since the previous tag, and add them to the changelog (and then automatically create a commit with the
updated changelog).
You can also run yarn run changelog:report
to print the changelog update (with
STDOUT). This needs to
be run before yarn run changelog
.