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

Migration tests #636

Merged
merged 1 commit into from
Jul 8, 2020
Merged

Migration tests #636

merged 1 commit into from
Jul 8, 2020

Conversation

jonahkagan
Copy link
Contributor

Adds some basic tests to ensure our migrations run successfully and yield the same resulting db schema as our models.

How we do it:

  • Create an initial migration from the empty database to the database before our current first migration
  • Leverage pytest-alembic, a plugin that runs these basic tests for you

This PR also moves the migrations directory inside server and adds some documentation to it.

@jonahkagan jonahkagan temporarily deployed to arlo-migration-tests-xoc6lvzsj July 7, 2020 22:43 Inactive
@@ -55,6 +55,9 @@ def run_migrations_offline():
context.configure(
url=url,
target_metadata=target_metadata,
compare_type=True,
compare_server_default=True,
include_schemas=True,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are suggested configs from the pytest-alembic docs

config.get_section(config.config_ini_section),
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

change required by pytest-alembic

Adds some basic tests to ensure our migrations run successfully and
yield the same resulting db schema as our models.

How we do it:
- Create an initial migration from the empty database to the database
before our current first migration
- Leverage pytest-alembic, a plugin that runs these basic tests for you
@jonahkagan jonahkagan temporarily deployed to arlo-migration-tests-xoc6lvzsj July 8, 2020 16:34 Inactive
@jonahkagan jonahkagan merged commit 1f24228 into main Jul 8, 2020
@jonahkagan jonahkagan deleted the migration-tests branch July 8, 2020 16:54
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.

None yet

2 participants