-
Notifications
You must be signed in to change notification settings - Fork 470
Update database.py so that the sample database will use bigint for fi… #2603
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
Open
markykchua
wants to merge
1
commit into
kevoreilly:master
Choose a base branch
from
markykchua:int_to_big_in_on_sample_table
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The change from
Integer
toBigInteger
forfile_size
is correct for supporting larger files. However, this is a database schema modification, and the project uses Alembic for managing schema migrations (as evidenced by theAlembicVersion
table and existing migration scripts).Could you clarify why an Alembic migration script was not included for this change? Relying on a manual
ALTER TABLE
command (as mentioned in the PR description) has a few potential drawbacks:INTEGER
column type.SCHEMA_VERSION
Management: TheSCHEMA_VERSION
constant in this file is typically updated with Alembic revisions. Without an Alembic migration and a correspondingSCHEMA_VERSION
bump, the Cuckoo startup check (if last.version_num != SCHEMA_VERSION
) won't be able to verify if this specific schema change has been applied.ALTER TABLE
command in the PR description is specific to PostgreSQL. Alembic handles generating the correct DDL for different database backends.It's generally recommended to use Alembic to generate a new migration script for schema changes like this. This script would contain operations like
op.alter_column('samples', 'file_size', type_=sa.BigInteger(), existing_type=sa.Integer())
.If there's a specific reason Alembic can't be used here (e.g., performance concerns with
ALTER COLUMN TYPE
on very large tables), could that be elaborated upon? In such a scenario, bumpingSCHEMA_VERSION
and instructing users to manually update theiralembic_version
table after the DDL would be a safer alternative to ensure consistency.Style Guide References