fix: backup completeness — add 15 missing tables, accept .tar.gz uploads
Tables added to backup AND clear lists: - Payment providers: riopay, severpay, paypear, rollypay, overpay, aurapay, saved_payment_methods - Content: email_templates, info_pages, news_articles, news_categories, news_tags - Landing: landing_pages, guest_purchases - Analytics: yandex_client_id_map Also: - Telegram backup upload handler now accepts .tar.gz format (was .json/.json.gz only) - All 92 ORM models + 3 association tables now covered
This commit is contained in:
@@ -383,7 +383,7 @@ async def restore_backup_execute(callback: types.CallbackQuery, db_user: User, d
|
||||
async def handle_backup_file_upload(message: types.Message, db_user: User, db: AsyncSession, state: FSMContext):
|
||||
if not message.document:
|
||||
await message.answer(
|
||||
'❌ Пожалуйста, отправьте файл бекапа (.json или .json.gz)',
|
||||
'❌ Пожалуйста, отправьте файл бекапа (.json, .json.gz или .tar.gz)',
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
inline_keyboard=[[InlineKeyboardButton(text='◀️ Отмена', callback_data='backup_panel')]]
|
||||
),
|
||||
@@ -391,10 +391,11 @@ async def handle_backup_file_upload(message: types.Message, db_user: User, db: A
|
||||
return
|
||||
|
||||
document = message.document
|
||||
allowed_extensions = ('.json', '.json.gz', '.tar.gz', '.tar')
|
||||
|
||||
if not (document.file_name.endswith('.json') or document.file_name.endswith('.json.gz')):
|
||||
if not any(document.file_name.endswith(ext) for ext in allowed_extensions):
|
||||
await message.answer(
|
||||
'❌ Неподдерживаемый формат файла. Загрузите .json или .json.gz файл',
|
||||
'❌ Неподдерживаемый формат файла. Загрузите .json, .json.gz или .tar.gz файл',
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
inline_keyboard=[[InlineKeyboardButton(text='◀️ Отмена', callback_data='backup_panel')]]
|
||||
),
|
||||
|
||||
@@ -31,6 +31,7 @@ from app.database.models import (
|
||||
AdminRole,
|
||||
AdvertisingCampaign,
|
||||
AdvertisingCampaignRegistration,
|
||||
AurapayPayment,
|
||||
BroadcastHistory,
|
||||
ButtonClickLog,
|
||||
CabinetRefreshToken,
|
||||
@@ -40,18 +41,27 @@ from app.database.models import (
|
||||
ContestTemplate,
|
||||
CryptoBotPayment,
|
||||
DiscountOffer,
|
||||
EmailTemplate,
|
||||
FaqPage,
|
||||
FaqSetting,
|
||||
FreekassaPayment,
|
||||
GuestPurchase,
|
||||
HeleketPayment,
|
||||
InfoPage,
|
||||
KassaAiPayment,
|
||||
LandingPage,
|
||||
MainMenuButton,
|
||||
MenuLayoutHistory,
|
||||
MonitoringLog,
|
||||
MulenPayPayment,
|
||||
NewsArticle,
|
||||
NewsCategory,
|
||||
NewsTag,
|
||||
OverpayPayment,
|
||||
Pal24Payment,
|
||||
PartnerApplication,
|
||||
PaymentMethodConfig,
|
||||
PaypearPayment,
|
||||
PinnedMessage,
|
||||
PlategaPayment,
|
||||
Poll,
|
||||
@@ -71,9 +81,13 @@ from app.database.models import (
|
||||
ReferralContestVirtualParticipant,
|
||||
ReferralEarning,
|
||||
RequiredChannel,
|
||||
RioPayPayment,
|
||||
RollyPayPayment,
|
||||
SavedPaymentMethod,
|
||||
SentNotification,
|
||||
ServerSquad,
|
||||
ServiceRule,
|
||||
SeverPayPayment,
|
||||
Squad,
|
||||
Subscription,
|
||||
SubscriptionConversion,
|
||||
@@ -102,6 +116,7 @@ from app.database.models import (
|
||||
WheelPrize,
|
||||
WheelSpin,
|
||||
WithdrawalRequest,
|
||||
YandexClientIdMap,
|
||||
YooKassaPayment,
|
||||
payment_method_promo_groups,
|
||||
server_squad_promo_groups,
|
||||
@@ -183,6 +198,13 @@ class BackupService:
|
||||
CloudPaymentsPayment,
|
||||
FreekassaPayment,
|
||||
KassaAiPayment,
|
||||
RioPayPayment,
|
||||
SeverPayPayment,
|
||||
PaypearPayment,
|
||||
RollyPayPayment,
|
||||
OverpayPayment,
|
||||
AurapayPayment,
|
||||
SavedPaymentMethod,
|
||||
# --- Settings/content ---
|
||||
PaymentMethodConfig,
|
||||
PrivacyPolicy,
|
||||
@@ -192,6 +214,17 @@ class BackupService:
|
||||
PinnedMessage,
|
||||
MainMenuButton,
|
||||
MenuLayoutHistory,
|
||||
EmailTemplate,
|
||||
InfoPage,
|
||||
# --- News (FK: none / self-contained) ---
|
||||
NewsCategory,
|
||||
NewsTag,
|
||||
NewsArticle,
|
||||
# --- Landing / Guest purchases (FK: users, tariffs, landings) ---
|
||||
LandingPage,
|
||||
GuestPurchase,
|
||||
# --- Yandex analytics (FK: users) ---
|
||||
YandexClientIdMap,
|
||||
# --- User data (FK: users, promo_groups, subscriptions) ---
|
||||
UserPromoGroup,
|
||||
TrafficPurchase,
|
||||
@@ -1476,6 +1509,13 @@ class BackupService:
|
||||
'cloudpayments_payments',
|
||||
'freekassa_payments',
|
||||
'kassa_ai_payments',
|
||||
'riopay_payments',
|
||||
'severpay_payments',
|
||||
'paypear_payments',
|
||||
'rollypay_payments',
|
||||
'overpay_payments',
|
||||
'aurapay_payments',
|
||||
'saved_payment_methods',
|
||||
# --- Content/config ---
|
||||
'pinned_messages',
|
||||
'main_menu_buttons',
|
||||
@@ -1485,6 +1525,17 @@ class BackupService:
|
||||
'privacy_policies',
|
||||
'public_offers',
|
||||
'payment_method_configs',
|
||||
'email_templates',
|
||||
'info_pages',
|
||||
# --- News ---
|
||||
'news_articles',
|
||||
'news_categories',
|
||||
'news_tags',
|
||||
# --- Landing / Guest purchases ---
|
||||
'guest_purchases',
|
||||
'landing_pages',
|
||||
# --- Yandex analytics ---
|
||||
'yandex_client_id_map',
|
||||
# --- Support ---
|
||||
'support_audit_logs',
|
||||
'ticket_messages',
|
||||
|
||||
Reference in New Issue
Block a user