Skip to content
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

Db updates v3 #853

Merged
merged 12 commits into from
Jan 6, 2020
Merged

Db updates v3 #853

merged 12 commits into from
Jan 6, 2020

Conversation

chrismclarke
Copy link
Member

@chrismclarke chrismclarke commented Jan 5, 2020

Large update to update database.

Included:

Database

Add endpoints for v3_ references

Functions

  • Tidy old upgrade scripts (v1->v2)
  • Add new upgrade scripts (v2->v3)
    • Add moderation to all howtos, mappins, users
    • Tidy usernames, ids, add display names
    • Update user createdBy links where required

Users

  • Add displayName property to users
  • Update mocks
  • Add displayName to signup form (replaces username)
  • Generate username from displayname (like slug)

Tests

v2_ references to v3_ references

Todo

  • Test working correctly (v3 data already migrated in dev database)
  • Backup prod database
  • Run migration scripts before merge into production

Future

  • Add method to allow users to change their slug url (username/_id)
  • move all v2_ / v3_ references to a single prefix variable for easier changing in the future

@chrismclarke chrismclarke requested a review from BenGamma January 5, 2020 22:24
@cypress
Copy link

cypress bot commented Jan 5, 2020



Test summary

19 11 10 0


Run details

Project onearmy-community-platform
Status Failed
Commit 007756d
Started Jan 6, 2020 9:00 PM
Ended Jan 6, 2020 9:15 PM
Duration 15:19 💡
OS Linux Ubuntu Linux - 14.04
Browser Electron 73

View run in Cypress Dashboard ➡️


Failures

events.spec.ts Failed
1 [Events] > [List events] > [By Everyone]
2 [Events] > [List events] > [By Authenticated]
3 [Events] > [Filter Events] > [By Everyone]
4 [Events] > [Create an event] > [By Authenticated]
howto/read.spec.ts Failed
1 [How To] > [List how-tos] > [By Everyone]
2 [How To] > [Filter with Tag] > [By Everyone]
3 [How To] > [Read a How-to] > [By Owner]
4 ... > [See all info]
howto/write.spec.ts Failed
1 [How To] > [Create a how-to] > [By Authenticated]
2 [How To] > [Edit a how-to] > [By Owner]
This comment includes only the first 10 test failures. See all 11 failures in the Cypress Dashboard.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

Copy link
Contributor

@BenGamma BenGamma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks chris, overall migration script looks good to me. A few questions though :

  1. So if I understand well userName will now be the value we use as slug ?
    I pushed a fix for the settings page in case the user modify his name. It was modifying userName, now I set to update displayName.
    Also in the map we use the pin._id to open a pin from url /map#pin_id (see here for code reference) which was based on v2 userName, seems like we need to update the value of the _id field of v3_mappins with the newly formated slug v3 userName. Could you update the migration script ?
  2. Are we sure that we will not encounter similar userName after running the script ?
    I'll have a closer look at the tests tomorrow to try to fix them.
    Other than that we are very close to release !

@chrismclarke chrismclarke requested a review from BenGamma January 6, 2020 20:51
@chrismclarke
Copy link
Member Author

Update:

  • add mappin id to upgrade (same as names)
  • adjust function to strip all nonAlphanumeric (except - or _)
  • adjust moderation to keep any existing values if available

@BenGamma BenGamma merged commit 78abff5 into master Jan 6, 2020
@BenGamma BenGamma deleted the db-updates-v3 branch January 6, 2020 22:13
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