Add salute and share counts for frontend Challenge 6 #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds the following columns to the post model types (Badge, Photo, Story, Testimonial).:
This is conducted through a database migration, so I had to add a config/config.json file to be able to run migrations with the CLI tool. The database configuration for production is not functional. This is for the purposes of running the sequelize cli tool because the other database config uses environment variables located here: https://github.com/topcoderinc/va-online-memorial-data-models/blob/master/config/custom-environment-variables.json
I'm not certain how migrations are being run in production (this may actually be the first migration), but it looks like previously it is using a forced sequelize.sync that runs a migration if the model files change. I think this is fine for generating a dev/test schema, but probably not something you want to have happen in production:
https://github.com/topcoderinc/va-online-memorial-data-models/blob/master/index.js#L103
I suspect this only gets run when the init-data.js file is called in the rest API project:
https://github.com/topcoderinc/va-online-memorial-rest-api/blob/master/init-data.js#L20
Bumped the version in package.json from 0.0.1 to 0.0.2 to reflect schema changes (maybe it should be version 0.1, but I don't know what the project's conventions are).
Running Migrations
node_modules/.bin/sequelize db:migrate
For migration instructions, see: http://docs.sequelizejs.com/manual/tutorial/migrations.html
Limitation
The migration doesn't take into account previous salutes that may already exist in the PostSalutes table. It simply initializes the columns at 0.