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

Add `diesel setup` #115

Closed
sgrif opened this Issue Jan 20, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@sgrif
Member

sgrif commented Jan 20, 2016

This should do the following:

  • Look for a migrations dir. If it doesn't exist, create one in the same directory as Cargo.toml (maybe with a .gitkeep file so it's clear to the user that it's there if they want to move it later)
  • Try to connect to DATABASE_URL if that env var is set (or if the --database-url= option was set, and the database doesn't exist, attempt to create it by connecting to the same URL with the database unspecified.
  • Runs migrations if __diesel_schema_migrations doesn't already exist
@mcasper

This comment has been minimized.

Collaborator

mcasper commented Jan 20, 2016

Should this also run any existing and pending migrations?

@sgrif

This comment has been minimized.

Member

sgrif commented Jan 20, 2016

Good point. I think it definitely makes sense for it to run migrations as a "I just cloned this app and want to get up and running" case. I'm not sure if it should just run pending migrations in general though, or if it should only run migrations if the __diesel_schema_migrations table didn't already exist. I'm open to arguments either way.

@mcasper

This comment has been minimized.

Collaborator

mcasper commented Jan 20, 2016

I would err on the side of only running migrations if __diesel_schema_migrations didn't previously exist, as the use case in my mind was the 'I just cloned and want to get set up' scenario. If it always ran migrations I think it would just become a replacement for diesel migration run

@sgrif

This comment has been minimized.

Member

sgrif commented Jan 20, 2016

Yup, that's my thoughts as well. I've updated the original issue to include that as a prerequisite.

@pseudomuto

This comment has been minimized.

pseudomuto commented Jan 30, 2016

Just browsing around here...did #126 close this?

@sgrif sgrif closed this Jan 30, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment