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

Codeimprovement/migrate to sequelize #132

Open
wants to merge 10 commits into
base: development
Choose a base branch
from

Conversation

nlsvgtr
Copy link
Collaborator

@nlsvgtr nlsvgtr commented Apr 18, 2023

Description

The oauth-server uses Bookshelf as ORM. Bookshelf is no longer maintained and should be removed.

Issue reference

Fixes #110

Type of change

This is a code improvement

Documentation

The README will be updated before merge. docs.openstad.org will be updated after merge

@nlsvgtr nlsvgtr changed the base branch from master to development April 18, 2023 12:12
Copy link
Contributor

@Badmuts Badmuts left a comment

Choose a reason for hiding this comment

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

Looks good to me, haven't tested it locally yet.

What happens with net installations? Should they use the reset.js script? What happens with the old migrations from knex. Maybe some installations aren't yet up to date with changes that have been made in those migrations.

model/user.js Outdated Show resolved Hide resolved
model/user.js Outdated Show resolved Hide resolved
services/password.js Outdated Show resolved Hide resolved
const { Umzug, SequelizeStorage } = require('umzug');

const umzug = new Umzug({
migrations: { glob: './migrations/*.js' },
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens with the old migrations that got removed? Shouldn't they be migrated to use umzug instead of knex?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that's overkill: probably you're running an up to date database, or you're creating a new one.

My guess is that there should not be issues with current users of OpenStad. If there are it's probably less work to fix those then to rewrite these migrations.

Only if there are recent migrations those should be rewritten.

Copy link
Contributor

@rudivanhierden rudivanhierden left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! Looks to be quite a lot of work, and imo it's a lot better to have all services use Sequelize. 👍

I fixed the default JSON values in a commit (3bece85) as discussed. I did not test it thoroughly, but I did test the uniqueCode authType, and I was able to log in locally. Just a few small additions, and I have the same question as @Badmuts about the migrations and how this will work for existing environments (do we use reset.js, or..?)

app.js Outdated Show resolved Hide resolved
controllers/admin/user.js Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you move this to memoryStorage? The implementation seems to be database-based instead of in-memory.

middleware/user.js Outdated Show resolved Hide resolved
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.

None yet

3 participants