diff --git a/internal/creator/accounts.go b/internal/creator/accounts.go index 183cf52..b17be58 100644 --- a/internal/creator/accounts.go +++ b/internal/creator/accounts.go @@ -310,11 +310,6 @@ func (s *Store) UpdateAccountProfile(ctx context.Context, accountID string, inpu return AccountProfile{}, databaseError(err) } } - if !input.BigAccount || input.BusinessStatus != "normal" { - if _, err := tx.ExecContext(ctx, `UPDATE creator_strategy SET enabled=false, updated_at=now() WHERE big_account_id=$1 OR execution_account_id=$1`, accountID); err != nil { - return AccountProfile{}, databaseError(err) - } - } if err := tx.Commit(); err != nil { return AccountProfile{}, fmt.Errorf("commit account profile update: %w", err) } diff --git a/internal/creator/deletion.go b/internal/creator/deletion.go index 20144e0..84134ad 100644 --- a/internal/creator/deletion.go +++ b/internal/creator/deletion.go @@ -21,12 +21,6 @@ func (s *Store) CheckOwnedAccountDeletion(ctx context.Context, accountID string) var active bool if err := s.db.QueryRowContext(ctx, ` SELECT EXISTS ( - SELECT 1 FROM creator_operation - WHERE account_id = $1 AND state = 'processing' - UNION ALL - SELECT 1 FROM creator_event - WHERE (receiving_account_id = $1 OR execution_account_id = $1) AND state = 'processing' - UNION ALL SELECT 1 FROM creator_collection_checkpoint WHERE source_type = 'owned' AND source_id = $1 AND status = 'running' UNION ALL @@ -149,12 +143,6 @@ func checkOwnedAccountDeletionTx(ctx context.Context, tx *sql.Tx, accountID stri var active bool if err := tx.QueryRowContext(ctx, ` SELECT EXISTS ( - SELECT 1 FROM creator_operation - WHERE account_id = $1 AND state = 'processing' - UNION ALL - SELECT 1 FROM creator_event - WHERE (receiving_account_id = $1 OR execution_account_id = $1) AND state = 'processing' - UNION ALL SELECT 1 FROM creator_collection_checkpoint WHERE source_type = 'owned' AND source_id = $1 AND status = 'running' UNION ALL @@ -184,13 +172,8 @@ func deleteCreatorSourceTx(ctx context.Context, tx *sql.Tx, sourceType, sourceID var active bool if err := tx.QueryRowContext(ctx, ` SELECT EXISTS ( - SELECT 1 FROM creator_operation - WHERE state = 'processing' - AND (target_work_id IN (SELECT id FROM creator_delete_work_ids) - OR target_comment_id IN (SELECT id FROM creator_comment WHERE work_id IN (SELECT id FROM creator_delete_work_ids))) - UNION ALL - SELECT 1 FROM creator_event - WHERE state = 'processing' AND work_id IN (SELECT id FROM creator_delete_work_ids) + SELECT 1 FROM creator_collection_checkpoint + WHERE source_type = $1 AND source_id = $2 AND status = 'running' )`).Scan(&active); err != nil { return databaseError(err) } @@ -217,29 +200,6 @@ func deleteCreatorSourceTx(ctx context.Context, tx *sql.Tx, sourceType, sourceID WHERE work.id = source.work_id AND work.source_type = $1 AND work.source_id = $2`, sourceType, sourceID); err != nil { return databaseError(err) } - if _, err := tx.ExecContext(ctx, ` - DELETE FROM creator_operation - WHERE target_work_id IN ( - SELECT id FROM creator_delete_work_ids - WHERE NOT EXISTS (SELECT 1 FROM creator_work_source WHERE work_id = creator_delete_work_ids.id) - ) - OR target_comment_id IN ( - SELECT comment.id FROM creator_comment comment - WHERE comment.work_id IN ( - SELECT id FROM creator_delete_work_ids - WHERE NOT EXISTS (SELECT 1 FROM creator_work_source WHERE work_id = creator_delete_work_ids.id) - ) - )`); err != nil { - return databaseError(err) - } - if _, err := tx.ExecContext(ctx, ` - DELETE FROM creator_event - WHERE work_id IN ( - SELECT id FROM creator_delete_work_ids - WHERE NOT EXISTS (SELECT 1 FROM creator_work_source WHERE work_id = creator_delete_work_ids.id) - )`); err != nil { - return databaseError(err) - } if _, err := tx.ExecContext(ctx, ` DELETE FROM creator_work WHERE id IN (