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

Added drop trigger to alembic ugprade to prevent issue with trigger t… #176

Merged
merged 3 commits into from
Nov 20, 2023

Conversation

tjacovich
Copy link
Contributor

…rying to write to big_id after name is changed.

…rying to write to big_id after name is changed.
@@ -18,7 +18,7 @@

def upgrade():
op.execute('ALTER TABLE change_log ADD COLUMN big_id BIGINT;')
op.execute('CREATE FUNCTION set_new_id() RETURNS TRIGGER AS\n'\
op.execute('CREATE OR REPLACE FUNCTION set_new_id() RETURNS TRIGGER AS\n'\
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this just so this doesn't error out if the function already exists for some reason.

@@ -38,18 +38,21 @@ def upgrade():
op.execute("ALTER TABLE change_log RENAME COLUMN big_id TO id;")
op.drop_column('change_log', 'old_id')
op.execute('ALTER SEQUENCE change_log_id_seq as bigint MAXVALUE 9223372036854775807')
op.execute('DROP TRIGGER IF EXISTS set_new_id_trigger ON change_log')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this because writes will fail if the trigger still exists because the column big_id no longer exists

@tjacovich tjacovich merged commit dc8d126 into adsabs:master Nov 20, 2023
2 checks passed
@tjacovich tjacovich deleted the fix_upgrade_slightly branch November 20, 2023 23:24
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