-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
d666233 OS-7228. Renamed migration 484fa91 OS-7228. Replace two indexes with one in raw_expenses collection 58400e4 OS-7260. Fixed 409 on name / description change for application with 5e3ded8 OS-6770. Derive tooltip and slice state to decrease chart tooltip updates amount 784afd9 OS-7253. Improve traffic_expenses performance 5d7ebe2 OS-7243. Fixed the katara hangup with a large number of tasks in the … 179d8d9 OS-7267. Fix input end adornments for Primary and Secondary metric fields ab86cf8 OS-7248. Fixed issue when limit hits requested with wrong entity id after changing an organization d7fa6ea OS-7163. Fixed user index and removed legacy roles in auth
- Loading branch information
Showing
28 changed files
with
341 additions
and
176 deletions.
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
72 changes: 72 additions & 0 deletions
72
auth/auth_server/alembic/versions/0321f4e3fe3f_remove_legacy_users.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,72 @@ | ||
# pylint: disable=C0103 | ||
""""remove_legacy_users" | ||
Revision ID: 0321f4e3fe3f | ||
Revises: cd08c646c952 | ||
Create Date: 2024-01-28 04:57:36.488047 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.orm import Session | ||
from auth.auth_server.models.models import Action, Type, Role, RoleAction | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '0321f4e3fe3f' | ||
down_revision = 'cd08c646c952' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
DRPLAN_OPERATOR = 'Drplan Operator' | ||
ADMIN = 'Super Admin' | ||
|
||
|
||
def upgrade(): | ||
assignment_t = sa.table('assignment', | ||
sa.column('role_id', sa.String())) | ||
role_t = sa.table('role', | ||
sa.column('id', sa.String()), | ||
sa.column('name', sa.String())) | ||
role_action_t = sa.table('role_action', | ||
sa.column('role_id', sa.String())) | ||
bind = op.get_bind() | ||
session = Session(bind=bind) | ||
try: | ||
roles_q = sa.select([role_t.c.id]).where( | ||
role_t.c.name.in_([DRPLAN_OPERATOR, ADMIN])) | ||
roles_ids = [x[0] for x in session.execute(roles_q)] | ||
session.execute(assignment_t.delete().where( | ||
assignment_t.c.role_id.in_(roles_ids))) | ||
session.execute(role_action_t.delete().where( | ||
role_action_t.c.role_id.in_(roles_ids))) | ||
session.execute(role_t.delete().where( | ||
role_t.c.id.in_(roles_ids))) | ||
session.commit() | ||
finally: | ||
session.close() | ||
|
||
|
||
def downgrade(): | ||
bind = op.get_bind() | ||
session = Session(bind=bind) | ||
actions = session.query(Action).all() | ||
type_root = session.query(Type).filter_by(name='root').one_or_none() | ||
type_organization = session.query(Type).filter_by( | ||
name='organization').one_or_none() | ||
type_pool = session.query(Type).filter_by(name='pool').one_or_none() | ||
role_drplan_operator = Role(name=DRPLAN_OPERATOR, type_=type_pool, | ||
description='DR plan operator', | ||
lvl_id=type_pool.id, is_active=True) | ||
role_admin = Role(name=ADMIN, type_=type_root, | ||
description='Hystax Admin', lvl_id=type_root.id, | ||
is_active=True) | ||
actions = session.query(Action).all() | ||
for action in actions: | ||
role_admin.assign_action(action) | ||
session.add(role_drplan_operator) | ||
session.add(role_admin) | ||
try: | ||
session.commit() | ||
finally: | ||
session.close() |
32 changes: 32 additions & 0 deletions
32
auth/auth_server/alembic/versions/cd08c646c952_fixed_users_unique_index.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,32 @@ | ||
""""fixed_users_unique_index" | ||
Revision ID: cd08c646c952 | ||
Revises: 86bb9ebc3c20 | ||
Create Date: 2024-01-28 05:01:58.248505 | ||
""" | ||
from alembic import op | ||
from sqlalchemy.exc import ProgrammingError | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'cd08c646c952' | ||
down_revision = '86bb9ebc3c20' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
try: | ||
op.create_index('idx_user_email_unique', 'user', | ||
['email', 'deleted_at'], | ||
unique=True) | ||
except ProgrammingError as exc: | ||
if "Duplicate key name" in str(exc): | ||
pass | ||
else: | ||
raise exc | ||
|
||
|
||
def downgrade(): | ||
pass |
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
58 changes: 58 additions & 0 deletions
58
diworker/diworker/migrations/2024012914311500_combine_aws_indexes.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,58 @@ | ||
import logging | ||
from diworker.diworker.migrations.base import BaseMigration | ||
|
||
""" | ||
Replaced AWSBillingPeriodSearch and AWSRawSearch with one changed index | ||
""" | ||
|
||
LOG = logging.getLogger(__name__) | ||
NEW_INDEXES = { | ||
'AWSRawSearch': ( | ||
['cloud_account_id', 'bill/BillingPeriodStartDate', 'resource_id'], | ||
{'bill/BillingPeriodStartDate': {'$exists': True}} | ||
) | ||
} | ||
OLD_INDEXES = { | ||
'AWSBillingPeriodSearch': ( | ||
['cloud_account_id', 'bill/BillingPeriodStartDate'], | ||
{'bill/BillingPeriodStartDate': {'$exists': True}} | ||
), | ||
'AWSRawSearch': ( | ||
['cloud_account_id', 'resource_id', 'bill/BillingPeriodStartDate'], | ||
{'bill/BillingPeriodStartDate': {'$exists': True}} | ||
) | ||
} | ||
|
||
|
||
class Migration(BaseMigration): | ||
@property | ||
def raw_collection(self): | ||
return self.db.raw_expenses | ||
|
||
def rebuild_indexes(self, old_indexes_map, new_indexes_map): | ||
index_list = self.raw_collection.list_indexes() | ||
existing_index_map = {i['name']: i['key'] for i in index_list} | ||
for new_index_name, (new_index_keys, partial_exp) in new_indexes_map.items(): | ||
if new_index_name in existing_index_map: | ||
existing_index_keys = list(existing_index_map[new_index_name]) | ||
if existing_index_keys == new_index_keys: | ||
LOG.info('Skip index %s - already exists', new_index_name) | ||
continue | ||
self.raw_collection.drop_index(new_index_name) | ||
LOG.info('Dropped index %s', new_index_name) | ||
self.raw_collection.create_index( | ||
[(f, 1) for f in new_index_keys], | ||
name=new_index_name, | ||
background=True, | ||
partialFilterExpression=partial_exp) | ||
LOG.info('Added index %s', new_index_name) | ||
for index_name in old_indexes_map.keys(): | ||
if index_name not in new_indexes_map: | ||
self.raw_collection.drop_index(index_name) | ||
LOG.info('Dropped index %s', index_name) | ||
|
||
def upgrade(self): | ||
self.rebuild_indexes(OLD_INDEXES, NEW_INDEXES) | ||
|
||
def downgrade(self): | ||
self.rebuild_indexes(NEW_INDEXES, OLD_INDEXES) |
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
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
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
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,3 @@ | ||
import DetectedConstraintsHistory from "./DetectedConstraintsHistory"; | ||
|
||
export default DetectedConstraintsHistory; |
Oops, something went wrong.