Skip to content

Commit

Permalink
db seeding and migration updates
Browse files Browse the repository at this point in the history
  • Loading branch information
johndatserakis committed Sep 4, 2017
1 parent d3cbeb9 commit 32ea587
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center"><a href="https://koa-vue-notes-web.innermonkdesign.com/" target="_blank"><img width="200" src="./src/static/koa-vue-notes-icon.png"></a></p>

<p align="center">
<a href="http://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Issues"></a>
<a href="http://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fjohndatserakis%2Fkoa-vue-notes-api&text=Check%20out%20koa-vue-notes-api%20on%20GitHub&via=innermonkdesign">
<img src="https://img.shields.io/twitter/url/https/github.com/johndatserakis/koa-vue-notes-api.svg?style=social" alt="Tweet"></a>
</p>
Expand Down
3 changes: 3 additions & 0 deletions src/db/seeds/dev/seed_notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
//in the knex seed/migrate command. Knex will error out if it is not specified.
if (!process.env.NODE_ENV) { throw new Error('NODE_ENV not set') }

//We don't want seeds to run in production
if (process.env.NODE_ENV === 'production') { throw new Error('Can\'t run seeds in production') }

const faker = require('faker')

exports.seed = async function(knex, Promise) {
Expand Down
7 changes: 3 additions & 4 deletions src/db/seeds/dev/seed_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
//in the knex seed/migrate command. Knex will error out if it is not specified.
if (!process.env.NODE_ENV) { throw new Error('NODE_ENV not set') }

//We don't want seeds to run in production
if (process.env.NODE_ENV === 'production') { throw new Error('Can\'t run seeds in production') }

const faker = require('faker')
const bcrypt = require('bcrypt')

exports.seed = async function(knex, Promise) {
//I only want migrations, rollbacks, and seeds to run when the NODE_ENV is specified
//in the knex seed/migrate command
if (!process.env.NODE_ENV) { return; }

//Make 10 users using faker. Note: we're also bcrypting
//the passwords to make it exactly like the real app. All their
//passwords will be 'secret'
Expand Down

0 comments on commit 32ea587

Please sign in to comment.