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

ci(migration-sql): checkout base commit to figure out the base revision #309

Merged
merged 1 commit into from
Aug 11, 2024

Conversation

sid-maddy
Copy link
Contributor

@sid-maddy sid-maddy commented Aug 11, 2024

This avoids having to reimplement Alembic's revision graph logic.

@sid-maddy sid-maddy requested review from a team as code owners August 11, 2024 14:04
@sid-maddy sid-maddy self-assigned this Aug 11, 2024
@sid-maddy sid-maddy force-pushed the sid/ci/migration-sql branch 7 times, most recently from ed94f77 to ee2bbef Compare August 11, 2024 14:57
@vipyrsec vipyrsec deleted a comment from github-actions bot Aug 11, 2024
@sid-maddy sid-maddy force-pushed the sid/ci/migration-sql branch from ee2bbef to bbe8117 Compare August 11, 2024 15:10
@vipyrsec vipyrsec deleted a comment from github-actions bot Aug 11, 2024
@sid-maddy sid-maddy force-pushed the sid/ci/migration-sql branch 2 times, most recently from d2067b4 to 1a6d098 Compare August 11, 2024 15:18
This avoids having to reimplement Alembic's revision graph logic.

Signed-off-by: Siddhesh Mhadnak <[email protected]>
@sid-maddy sid-maddy force-pushed the sid/ci/migration-sql branch from 4cf6891 to 5f820f2 Compare August 11, 2024 15:42
Copy link

alembic upgrade --sql $base:head

INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Generating static SQL
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 6991bcb18f89 -> ca14e3688152, Make datetimes timezone-aware
BEGIN;

-- Running upgrade 6991bcb18f89 -> ca14e3688152

ALTER TABLE scans ALTER COLUMN queued_at TYPE TIMESTAMP WITH TIME ZONE;

ALTER TABLE scans ALTER COLUMN pending_at TYPE TIMESTAMP WITH TIME ZONE;

ALTER TABLE scans ALTER COLUMN finished_at TYPE TIMESTAMP WITH TIME ZONE;

ALTER TABLE scans ALTER COLUMN reported_at TYPE TIMESTAMP WITH TIME ZONE;

UPDATE alembic_version SET version_num='ca14e3688152' WHERE alembic_version.version_num = '6991bcb18f89';

COMMIT;

alembic downgrade --sql head:$base

INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Generating static SQL
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running downgrade ca14e3688152 -> 6991bcb18f89, Make datetimes timezone-aware
BEGIN;

-- Running downgrade ca14e3688152 -> 6991bcb18f89

ALTER TABLE scans ALTER COLUMN reported_at TYPE TIMESTAMP WITHOUT TIME ZONE;

ALTER TABLE scans ALTER COLUMN finished_at TYPE TIMESTAMP WITHOUT TIME ZONE;

ALTER TABLE scans ALTER COLUMN pending_at TYPE TIMESTAMP WITHOUT TIME ZONE;

ALTER TABLE scans ALTER COLUMN queued_at TYPE TIMESTAMP WITHOUT TIME ZONE;

UPDATE alembic_version SET version_num='6991bcb18f89' WHERE alembic_version.version_num = 'ca14e3688152';

COMMIT;

@vipyrsec vipyrsec deleted a comment from github-actions bot Aug 11, 2024
@sid-maddy sid-maddy force-pushed the sid/ci/migration-sql branch from 5f820f2 to 8f66827 Compare August 11, 2024 15:43
@sid-maddy sid-maddy requested review from jonathan-d-zhang and removed request for a team August 11, 2024 15:46
@jonathan-d-zhang jonathan-d-zhang merged commit f434a8a into migration-comment Aug 11, 2024
5 checks passed
@jonathan-d-zhang jonathan-d-zhang deleted the sid/ci/migration-sql branch August 11, 2024 15:47
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.

2 participants