Skip to content

Add salute and share counts for frontend Challenge 6 #1

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

Merged
merged 3 commits into from
Jul 27, 2018

Conversation

ramillim
Copy link
Contributor

@ramillim ramillim commented Jul 25, 2018

Adds the following columns to the post model types (Badge, Photo, Story, Testimonial).:

  • saluteCount
  • shareCount
  • viewCount

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.

@ramillim ramillim changed the title Add salute and share counts Add salute and share counts for frontend Challenge 6 Jul 25, 2018
@ksmacleod99 ksmacleod99 merged commit 983491e into topcoderinc:master Jul 27, 2018
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 participants