-
Notifications
You must be signed in to change notification settings - Fork 845
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
Facade collection update #2184
Merged
Merged
Facade collection update #2184
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9998b77
alter repoStatus to reflect facade changes
IsaacMilarky e48fb29
Facade scheduling changes. Force methods and use of repo_status mostl…
IsaacMilarky b75bbd2
syntax
IsaacMilarky 6ab11d0
log first
IsaacMilarky 7f7ee70
resolve merge conflicts
IsaacMilarky 3db0063
add query to reset table after collection is halted by the user
IsaacMilarky 2263dcb
Syntax
IsaacMilarky 61846a5
merge
IsaacMilarky b05f9cf
merge
IsaacMilarky 1351589
Requested changes to remove repo_status since facade_status makes it …
IsaacMilarky 7be0141
Update schema script
ABrain7710 a0bfa26
Define function to get enabled phases
ABrain7710 fc2ee11
change default collection interval for tasks
IsaacMilarky fd5cd96
by default materialized views will be updated every 5 hours since it …
IsaacMilarky b9a7331
Merge branch 'facade-collection-update' of github.com:chaoss/augur in…
IsaacMilarky File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
101 changes: 101 additions & 0 deletions
101
...pplication/schema/alembic/versions/2023-02-16_6_change_collectionstatus_table_to_keep_.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
"""change CollectionStatus table to keep track of facade independently | ||
|
||
Revision ID: 6 | ||
Revises: 5 | ||
Create Date: 2023-02-16 12:45:57.486871 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
from sqlalchemy.sql import text | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '6' | ||
down_revision = '5' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column('releases', 'release_id', | ||
existing_type=sa.CHAR(length=256), | ||
type_=sa.CHAR(length=128), | ||
existing_nullable=False, | ||
existing_server_default=sa.text('nextval(\'"augur_data".releases_release_id_seq\'::regclass)'), | ||
schema='augur_data') | ||
|
||
|
||
op.drop_column('repo', 'repo_status', schema='augur_data') | ||
op.add_column('collection_status', sa.Column('facade_status', sa.String(), server_default=sa.text("'Pending'"), nullable=False), schema='augur_operations') | ||
op.add_column('collection_status', sa.Column('facade_data_last_collected', postgresql.TIMESTAMP(), nullable=True), schema='augur_operations') | ||
op.add_column('collection_status', sa.Column('facade_task_id', sa.String(), nullable=True), schema='augur_operations') | ||
op.add_column('collection_status', sa.Column('repo_status', sa.String(), server_default=sa.text("'New'::character varying"), nullable=False), schema='augur_operations') | ||
|
||
#Recreate the foreign key | ||
op.drop_constraint('collection_status_repo_id_fk', 'collection_status', schema='augur_operations', type_='foreignkey') | ||
op.create_foreign_key('collection_status_repo_id_fk', 'collection_status', 'repo', ['repo_id'], ['repo_id'], source_schema='augur_operations', referent_schema='augur_data') | ||
|
||
op.alter_column('user_groups', 'user_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True, | ||
schema='augur_operations') | ||
op.drop_constraint('user_groups_user_id_name_key', 'user_groups', schema='augur_operations', type_='unique') | ||
op.create_unique_constraint('user_group_unique', 'user_groups', ['user_id', 'name'], schema='augur_operations') | ||
op.drop_constraint('user_repos_repo_id_fkey', 'user_repos', schema='augur_operations', type_='foreignkey') | ||
op.create_foreign_key('user_repo_user_id_fkey', 'user_repos', 'repo', ['repo_id'], ['repo_id'], source_schema='augur_operations', referent_schema='augur_data') | ||
op.alter_column('user_session_tokens', 'user_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=True, | ||
schema='augur_operations') | ||
op.alter_column('user_session_tokens', 'application_id', | ||
existing_type=sa.VARCHAR(), | ||
nullable=False, | ||
schema='augur_operations') | ||
|
||
|
||
#Add toggle for facade collection. | ||
conn = op.get_bind() | ||
result = conn.execute(text("""SELECT * FROM augur_operations.config WHERE section_name='Task_Routine';""")).fetchall() | ||
if result: | ||
|
||
conn.execute(text(f""" | ||
INSERT INTO "augur_operations"."config" ("section_name", "setting_name", "value", "type") VALUES ('Task_Routine', 'facade_phase', '{1}', 'int'); | ||
INSERT INTO "augur_operations"."config" ("section_name", "setting_name", "value", "type") VALUES ('Facade', 'run_facade_contributors', '{1}', 'int'); | ||
""")) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column('user_session_tokens', 'application_id', | ||
existing_type=sa.VARCHAR(), | ||
nullable=True, | ||
schema='augur_operations') | ||
op.alter_column('user_session_tokens', 'user_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False, | ||
schema='augur_operations') | ||
op.drop_constraint('user_repo_user_id_fkey', 'user_repos', schema='augur_operations', type_='foreignkey') | ||
op.create_foreign_key('user_repos_repo_id_fkey', 'user_repos', 'repo', ['repo_id'], ['repo_id'], source_schema='augur_operations') | ||
op.drop_constraint('user_group_unique', 'user_groups', schema='augur_operations', type_='unique') | ||
op.create_unique_constraint('user_groups_user_id_name_key', 'user_groups', ['user_id', 'name'], schema='augur_operations') | ||
op.alter_column('user_groups', 'user_id', | ||
existing_type=sa.INTEGER(), | ||
nullable=False, | ||
schema='augur_operations') | ||
op.drop_constraint('collection_status_repo_id_fk', 'collection_status', schema='augur_operations', type_='foreignkey') | ||
op.create_foreign_key('collection_status_repo_id_fk', 'collection_status', 'repo', ['repo_id'], ['repo_id'], source_schema='augur_operations') | ||
op.drop_column('collection_status', 'repo_status', schema='augur_operations') | ||
op.drop_column('collection_status', 'facade_task_id', schema='augur_operations') | ||
op.drop_column('collection_status', 'facade_data_last_collected', schema='augur_operations') | ||
op.drop_column('collection_status', 'facade_status', schema='augur_operations') | ||
op.add_column('repo', sa.Column('repo_status', sa.VARCHAR(), server_default=sa.text("'New'::character varying"), autoincrement=False, nullable=False), schema='augur_data') | ||
op.alter_column('releases', 'release_id', | ||
existing_type=sa.CHAR(length=128), | ||
type_=sa.CHAR(length=256), | ||
existing_nullable=False, | ||
existing_server_default=sa.text('nextval(\'"augur_data".releases_release_id_seq\'::regclass)'), | ||
schema='augur_data') | ||
# ### end Alembic commands ### |
This file contains 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
Oops, something went wrong.
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.
@IsaacMilarky This should only include, the changes that are needed for this pr. I can change this if you would like