-
Notifications
You must be signed in to change notification settings - Fork 8
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
Migrate to PostgreSQL #54
Conversation
@@ -4,7 +4,7 @@ services: | |||
build: . | |||
container_name: plugin_store | |||
environment: | |||
- DB_PATH=/app/.database/plugin_store_new.db | |||
- DB_URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want this DB_URL specified for local dev, as the postgres instance starts in the same dockerfile anyway.
@@ -4,26 +4,32 @@ services: | |||
build: . | |||
container_name: "${DEPLOYMENT_NAME}" | |||
environment: | |||
- DB_PATH | |||
- DB_URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, same here. We can build it from POSTGRES_PASSWORD
to not have it hardcoded here.
def db_sessionmaker(db_engine): | ||
return sessionmaker(bind=db_engine, autoflush=False, future=True, expire_on_commit=False, class_=AsyncSession) | ||
@pytest.fixture(scope="session") | ||
def seed_db_sessionmaker(seed_db_engine: tuple["AsyncEngine", "sessionmaker"]) -> "sessionmaker": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have unseed DB anymore, we can drop seed
from names everywhere.
for data migration: .dump the sqlite, edit the .sql to remove everything but the BEGIN TRANSACTION, INSERTs, and COMMIT, then edit it to look like this SET session_replication_role = 'replica'; -- Hack to make type checking more lenient, changed back later update pg_cast set castcontext='a' where casttarget = 'boolean'::regtype; -- Hack to allow int to boolean conversion, changed back later BEGIN TRANSACTION; tons of inserts COMMIT; update pg_cast set castcontext='e' where casttarget = 'boolean'::regtype; SET session_replication_role = 'origin'; then run migrations via the makefile on a new postgres db and then load the sql in
Tests were failing due to wrong default ordering of plugins being checked by them.
Pytest freezegun is no longer maintained, switched to a fork. Also bumped pytest-asyncio due to inability to use async fixtures in other scopes than `function` in older version.
Fixed black, isort and mypy failing
Seeder (FakePluginGenerator) no longer uses logic from Database class nor the time freezer for seeding the database.
Make use of DB transactions to rollback tests back to the original state instead of recreating DB on each test.
8265022
to
8b0423f
Compare
we should really merge this already |
`pull_request` trigger needs some more work to be functional. Reverting back to `pull_request_target` for now.
No description provided.