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):
|
async def handle_backup_file_upload(message: types.Message, db_user: User, db: AsyncSession, state: FSMContext):
|
||||||
if not message.document:
|
if not message.document:
|
||||||
await message.answer(
|
await message.answer(
|
||||||
'❌ Пожалуйста, отправьте файл бекапа (.json или .json.gz)',
|
'❌ Пожалуйста, отправьте файл бекапа (.json, .json.gz или .tar.gz)',
|
||||||
reply_markup=InlineKeyboardMarkup(
|
reply_markup=InlineKeyboardMarkup(
|
||||||
inline_keyboard=[[InlineKeyboardButton(text='◀️ Отмена', callback_data='backup_panel')]]
|
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
|
return
|
||||||
|
|
||||||
document = message.document
|
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(
|
await message.answer(
|
||||||
'❌ Неподдерживаемый формат файла. Загрузите .json или .json.gz файл',
|
'❌ Неподдерживаемый формат файла. Загрузите .json, .json.gz или .tar.gz файл',
|
||||||
reply_markup=InlineKeyboardMarkup(
|
reply_markup=InlineKeyboardMarkup(
|
||||||
inline_keyboard=[[InlineKeyboardButton(text='◀️ Отмена', callback_data='backup_panel')]]
|
inline_keyboard=[[InlineKeyboardButton(text='◀️ Отмена', callback_data='backup_panel')]]
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ from app.database.models import (
|
|||||||
AdminRole,
|
AdminRole,
|
||||||
AdvertisingCampaign,
|
AdvertisingCampaign,
|
||||||
AdvertisingCampaignRegistration,
|
AdvertisingCampaignRegistration,
|
||||||
|
AurapayPayment,
|
||||||
BroadcastHistory,
|
BroadcastHistory,
|
||||||
ButtonClickLog,
|
ButtonClickLog,
|
||||||
CabinetRefreshToken,
|
CabinetRefreshToken,
|
||||||
@@ -40,18 +41,27 @@ from app.database.models import (
|
|||||||
ContestTemplate,
|
ContestTemplate,
|
||||||
CryptoBotPayment,
|
CryptoBotPayment,
|
||||||
DiscountOffer,
|
DiscountOffer,
|
||||||
|
EmailTemplate,
|
||||||
FaqPage,
|
FaqPage,
|
||||||
FaqSetting,
|
FaqSetting,
|
||||||
FreekassaPayment,
|
FreekassaPayment,
|
||||||
|
GuestPurchase,
|
||||||
HeleketPayment,
|
HeleketPayment,
|
||||||
|
InfoPage,
|
||||||
KassaAiPayment,
|
KassaAiPayment,
|
||||||
|
LandingPage,
|
||||||
MainMenuButton,
|
MainMenuButton,
|
||||||
MenuLayoutHistory,
|
MenuLayoutHistory,
|
||||||
MonitoringLog,
|
MonitoringLog,
|
||||||
MulenPayPayment,
|
MulenPayPayment,
|
||||||
|
NewsArticle,
|
||||||
|
NewsCategory,
|
||||||
|
NewsTag,
|
||||||
|
OverpayPayment,
|
||||||
Pal24Payment,
|
Pal24Payment,
|
||||||
PartnerApplication,
|
PartnerApplication,
|
||||||
PaymentMethodConfig,
|
PaymentMethodConfig,
|
||||||
|
PaypearPayment,
|
||||||
PinnedMessage,
|
PinnedMessage,
|
||||||
PlategaPayment,
|
PlategaPayment,
|
||||||
Poll,
|
Poll,
|
||||||
@@ -71,9 +81,13 @@ from app.database.models import (
|
|||||||
ReferralContestVirtualParticipant,
|
ReferralContestVirtualParticipant,
|
||||||
ReferralEarning,
|
ReferralEarning,
|
||||||
RequiredChannel,
|
RequiredChannel,
|
||||||
|
RioPayPayment,
|
||||||
|
RollyPayPayment,
|
||||||
|
SavedPaymentMethod,
|
||||||
SentNotification,
|
SentNotification,
|
||||||
ServerSquad,
|
ServerSquad,
|
||||||
ServiceRule,
|
ServiceRule,
|
||||||
|
SeverPayPayment,
|
||||||
Squad,
|
Squad,
|
||||||
Subscription,
|
Subscription,
|
||||||
SubscriptionConversion,
|
SubscriptionConversion,
|
||||||
@@ -102,6 +116,7 @@ from app.database.models import (
|
|||||||
WheelPrize,
|
WheelPrize,
|
||||||
WheelSpin,
|
WheelSpin,
|
||||||
WithdrawalRequest,
|
WithdrawalRequest,
|
||||||
|
YandexClientIdMap,
|
||||||
YooKassaPayment,
|
YooKassaPayment,
|
||||||
payment_method_promo_groups,
|
payment_method_promo_groups,
|
||||||
server_squad_promo_groups,
|
server_squad_promo_groups,
|
||||||
@@ -183,6 +198,13 @@ class BackupService:
|
|||||||
CloudPaymentsPayment,
|
CloudPaymentsPayment,
|
||||||
FreekassaPayment,
|
FreekassaPayment,
|
||||||
KassaAiPayment,
|
KassaAiPayment,
|
||||||
|
RioPayPayment,
|
||||||
|
SeverPayPayment,
|
||||||
|
PaypearPayment,
|
||||||
|
RollyPayPayment,
|
||||||
|
OverpayPayment,
|
||||||
|
AurapayPayment,
|
||||||
|
SavedPaymentMethod,
|
||||||
# --- Settings/content ---
|
# --- Settings/content ---
|
||||||
PaymentMethodConfig,
|
PaymentMethodConfig,
|
||||||
PrivacyPolicy,
|
PrivacyPolicy,
|
||||||
@@ -192,6 +214,17 @@ class BackupService:
|
|||||||
PinnedMessage,
|
PinnedMessage,
|
||||||
MainMenuButton,
|
MainMenuButton,
|
||||||
MenuLayoutHistory,
|
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) ---
|
# --- User data (FK: users, promo_groups, subscriptions) ---
|
||||||
UserPromoGroup,
|
UserPromoGroup,
|
||||||
TrafficPurchase,
|
TrafficPurchase,
|
||||||
@@ -1476,6 +1509,13 @@ class BackupService:
|
|||||||
'cloudpayments_payments',
|
'cloudpayments_payments',
|
||||||
'freekassa_payments',
|
'freekassa_payments',
|
||||||
'kassa_ai_payments',
|
'kassa_ai_payments',
|
||||||
|
'riopay_payments',
|
||||||
|
'severpay_payments',
|
||||||
|
'paypear_payments',
|
||||||
|
'rollypay_payments',
|
||||||
|
'overpay_payments',
|
||||||
|
'aurapay_payments',
|
||||||
|
'saved_payment_methods',
|
||||||
# --- Content/config ---
|
# --- Content/config ---
|
||||||
'pinned_messages',
|
'pinned_messages',
|
||||||
'main_menu_buttons',
|
'main_menu_buttons',
|
||||||
@@ -1485,6 +1525,17 @@ class BackupService:
|
|||||||
'privacy_policies',
|
'privacy_policies',
|
||||||
'public_offers',
|
'public_offers',
|
||||||
'payment_method_configs',
|
'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 ---
|
||||||
'support_audit_logs',
|
'support_audit_logs',
|
||||||
'ticket_messages',
|
'ticket_messages',
|
||||||
|
|||||||
Reference in New Issue
Block a user