Skip to content

added openadapt.renew #207

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

Merged
merged 6 commits into from
Jun 16, 2023
Merged

added openadapt.renew #207

merged 6 commits into from
Jun 16, 2023

Conversation

0dm
Copy link
Collaborator

@0dm 0dm commented May 30, 2023

purpose: removes existing database file and runs alembic migrations
usage: python3 -m openadapt.renew

I find this pretty useful and like it more than typing rm openadapt.db && alembic upgrade head - and it's more pythonic..
I also added a definition for DB_FNAME because my linter was reporting an issue here:

image

src
.DS_Store
Copy link
Collaborator Author

@0dm 0dm May 30, 2023

Choose a reason for hiding this comment

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

I always have to ignore the .DS_Store file on Mac 😅

db = getenv_fallback("DB_FNAME")
if os.path.exists(db):
os.remove(db)
result = run(["alembic", "upgrade", "head"], stderr=PIPE, text=True)
Copy link
Collaborator Author

@0dm 0dm May 30, 2023

Choose a reason for hiding this comment

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

prevents duplicate logging of config

should have probably commented the code 🥲

Copy link
Member

Choose a reason for hiding this comment

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

Please do!

@0dm 0dm requested a review from abrichr May 30, 2023 22:15
@abrichr
Copy link
Member

abrichr commented Jun 1, 2023

Thanks @0dm ! Can you please merge to latest main? It seems the config.py is out of date.

@Mustaballer is working on something similar for exporting databases, perhaps it makes sense to consolidate this logic (perhaps not).

Can you please move renew.py into scripts/ and call it reset_db.py?

@0dm
Copy link
Collaborator Author

0dm commented Jun 1, 2023

new usage:
python3 -m openadapt.scripts.reset_db (a little longer now)

@0dm
Copy link
Collaborator Author

0dm commented Jun 1, 2023

@abrichr ready again

@0dm 0dm closed this Jun 16, 2023
@0dm
Copy link
Collaborator Author

0dm commented Jun 16, 2023

implemented in #135

@0dm 0dm reopened this Jun 16, 2023
@0dm
Copy link
Collaborator Author

0dm commented Jun 16, 2023

nevermind, there's a small change that needs to be merged (use config.DB_FPATH rather than getenv_fallback)

@abrichr abrichr merged commit 15a5cca into OpenAdaptAI:main Jun 16, 2023
R-ohit-B-isht pushed a commit to R-ohit-B-isht/OpenAdapt that referenced this pull request Jun 21, 2024
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.

3 participants