Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Updated instance-authorized-user migration. #8412

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

barankyle
Copy link
Member

@barankyle barankyle commented Aug 1, 2023

Summary

In the current state where not everything has been converted off of sequelize, some sequelize BelongsToMany (join table) associations are bugging because they are being made under new names without all of the required fields before the knex migration can create it properly.

Specifically, instance_authorized_user was renamed to instance-authorized-user. The sequelize BelongsToMany relationship between user and instance is making a new instance-authorized-user table just based on that relationship, which doesn't know about the 'id' field. Then the knex migration tries to run, and fails because the instance-authorized-user table already exists. The deployment then has bugs because the table schema isn't correct.

The solution was to make the migration delete the new table if it exists if it detects that the old table still exists. This probably needs to be done for other join table/BelongsToMany conversions.

References

closes #insert number here

Checklist

  • If this PR is still a WIP, convert to a draft
  • When this PR is ready, mark it as "Ready for review"
  • ensure all checks pass
  • Changes have been manually QA'd
  • Changes reviewed by at least 2 approved reviewer

QA Steps

List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.

In the current state where not everything has been converted off of sequelize,
some sequelize BelongsToMany (join table) associations are bugging because they
are being made under new names without all of the required fields before the knex
migration can create it properly.

Specifically, instance_authorized_user was renamed to instance-authorized-user.
The sequelize BelongsToMany relationship between user and instance is making a
new instance-authorized-user table just based on that relationship, which doesn't
know about the 'id' field. Then the knex migration tries to run, and fails because
the instance-authorized-user table already exists. The deployment then has bugs
because the table schema isn't correct.

The solution was to make the migration delete the new table if it exists if it
detects that the old table still exists. This probably needs to be done for other
join table/BelongsToMany conversions.
@hanzlamateen hanzlamateen added this pull request to the merge queue Aug 2, 2023
Merged via the queue into dev with commit e99b58a Aug 2, 2023
8 checks passed
@hanzlamateen hanzlamateen deleted the instance-authorized-user-migration-fix branch August 2, 2023 02:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants