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

How to introduce refinery into existing project (with existing DB schema)? #178

Closed
jannes opened this issue Sep 18, 2021 · 2 comments · Fixed by #179
Closed

How to introduce refinery into existing project (with existing DB schema)? #178

jannes opened this issue Sep 18, 2021 · 2 comments · Fixed by #179
Labels
enhancement New feature or request

Comments

@jannes
Copy link

jannes commented Sep 18, 2021

Hi, I would like to start using refinery in a project that already has some logic to create tables on a first time start up (based on whether a sqlite file already exists or not). I'm unsure how I can introduce refinery in that context, specifically how to replace that logic with a v0 migration that works for both cases of first time setup and subsequent usages.

One way I can think of is to solve it on a SQL level by using "if not exists" when creating the tables, but maybe it can be solved in a better way by refinery?

@jxs jxs added the enhancement New feature or request label Sep 18, 2021
@jxs
Copy link
Member

jxs commented Sep 18, 2021

Hi there, thanks for the interest! Yes I am currently working on that, introduce the concept of Fake migrations so that you can:

  • generate a dump of the current schema of your database
  • fake migrate to that schema only creating and updating refinery schema migrations table
    then it's just a matter of introducing new migrations on top of that one, would that work for you?
    thanks

@jannes
Copy link
Author

jannes commented Sep 18, 2021

yes, that sounds good, i think it would be a useful addition.
for now i have solved this with a V0 migration that uses IF NOT EXISTS to create the tables and indices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants