Skip to content

Commit

Permalink
fix: migration
Browse files Browse the repository at this point in the history
  • Loading branch information
GareArc committed Dec 23, 2024
1 parent 05b7816 commit 7e96b27
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""added account_deletion_logs
"""added account_deletion_logs and details
Revision ID: 582e52119c70
Revision ID: 35e1a3223204
Revises: e1944c35e15e
Create Date: 2024-12-20 21:36:46.856033
Create Date: 2024-12-23 00:47:44.483419
"""
from alembic import op
Expand All @@ -11,18 +11,30 @@


# revision identifiers, used by Alembic.
revision = '582e52119c70'
revision = '35e1a3223204'
down_revision = 'e1944c35e15e'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('account_deletion_log_details',
sa.Column('id', models.types.StringUUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
sa.Column('account_id', models.types.StringUUID(), nullable=False),
sa.Column('tenant_id', models.types.StringUUID(), nullable=False),
sa.Column('role', sa.String(length=16), nullable=False),
sa.Column('snapshot', sa.Text(), nullable=False),
sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
sa.PrimaryKeyConstraint('id', name='account_deletion_log_detail_pkey')
)
op.create_table('account_deletion_logs',
sa.Column('id', models.types.StringUUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
sa.Column('email', sa.String(length=255), nullable=False),
sa.Column('reason', sa.Text(), nullable=True),
sa.Column('account_id', models.types.StringUUID(), nullable=False),
sa.Column('snapshot', sa.Text(), nullable=False),
sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
sa.PrimaryKeyConstraint('id', name='account_deletion_log_pkey')
Expand All @@ -33,4 +45,5 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('account_deletion_logs')
op.drop_table('account_deletion_log_details')
# ### end Alembic commands ###
3 changes: 1 addition & 2 deletions api/tasks/delete_account_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
import click
from celery import shared_task
from extensions.ext_database import db
from libs.helper import to_json
from models.account import (Account, AccountDeletionLogDetail,
TenantAccountJoin, TenantAccountJoinRole)
from services.account_deletion_log_service import AccountDeletionLogService
from services.billing_service import BillingService
from tasks.mail_account_deletion_task import send_deletion_success_task

from api.libs.helper import to_json

logger = logging.getLogger(__name__)


Expand Down

0 comments on commit 7e96b27

Please sign in to comment.