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

Migrations mismatch with pre-populated database in getting started tutorial #60

Open
devinivy opened this issue Jun 7, 2021 · 2 comments

Comments

@devinivy
Copy link
Member

devinivy commented Jun 7, 2021

The pre-populated database provided for learning/convenience creates a difficult snag when used in the context of the getting started tutorial: because the migrations tracked in the db by knex wont match the names of the migrations created during the getting started tutorial, knex will believe the migrations directory is corrupted. For example, upon server start:

> PATH_TO_DATABASE=riddles.db node server
[exiting] Fatal exception: Error: The migration directory is corrupt, the following files are missing: 20180420011654_add-riddles.js

I believe one of the main reasons to advertise the pre-populated db was to make it simple to have some persisted riddles without needing to create and re-create them across server starts while playing with the tutorial, so hopefully our solution will cater to this.

@openam
Copy link
Contributor

openam commented Jun 7, 2021

Could you do the prepopulated, but delete the knex tables? That way it will start properly. It would probably cause issues when people start adding migration scripts for the existing tables.

It could be said that if you don't want to go through the migration stuff here is a prepopulated table...

Another option would be to create a part of the tutorial that goes over seeding a database with knex like @zemccartney mentioned.

@zemccartney
Copy link
Member

@openam hey, thanks for that. I don't know for sure, but I'm guessing you're spot on that deleting any knex-related tables would lead to conflicts. Keeping the database clean, solely the purview of whoever's working through the tutorial, seems the safest way to go here.

And I totally agree addressing this issue will mean adding / revising the tutorial to walk people to new to pal through our approach

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

No branches or pull requests

3 participants