Commit 66565a94 authored by Your Name's avatar Your Name

fix: improve migration logging to clarify data preservation

- Changed log message from 'Default payment system data inserted' to 'Default payment system data checked (existing records preserved)'
- Added comments explaining INSERT OR IGNORE behavior
- Clarifies that existing records are never overwritten
- Uses INSERT OR IGNORE/INSERT IGNORE which only inserts if record doesn't exist based on UNIQUE constraints
parent c4aa7ff6
...@@ -448,9 +448,9 @@ class PaymentMigrations: ...@@ -448,9 +448,9 @@ class PaymentMigrations:
logger.warning(f"Migration check for stripe_customer_id column: {e}") logger.warning(f"Migration check for stripe_customer_id column: {e}")
def _insert_default_data(self, cursor): def _insert_default_data(self, cursor):
"""Insert default configuration data""" """Insert default configuration data (only if not already present)"""
# Insert default price sources # Insert default price sources (INSERT OR IGNORE = only if not exists)
default_sources = [ default_sources = [
('Coinbase', 'rest', 'https://api.coinbase.com/v2/prices', None, 1), ('Coinbase', 'rest', 'https://api.coinbase.com/v2/prices', None, 1),
('Binance', 'rest', 'https://api.binance.com/api/v3/ticker/price', None, 2), ('Binance', 'rest', 'https://api.binance.com/api/v3/ticker/price', None, 2),
...@@ -472,7 +472,7 @@ class PaymentMigrations: ...@@ -472,7 +472,7 @@ class PaymentMigrations:
except: except:
pass pass
# Insert default consolidation settings # Insert default consolidation settings (INSERT OR IGNORE = only if not exists)
default_consolidation = [ default_consolidation = [
('BTC', '0.1', ''), ('BTC', '0.1', ''),
('ETH', '1.0', ''), ('ETH', '1.0', ''),
...@@ -495,7 +495,7 @@ class PaymentMigrations: ...@@ -495,7 +495,7 @@ class PaymentMigrations:
except: except:
pass pass
# Insert default email notification settings # Insert default email notification settings (INSERT OR IGNORE = only if not exists)
default_notifications = [ default_notifications = [
('payment_failed', 'Payment Failed'), ('payment_failed', 'Payment Failed'),
('payment_retry_success', 'Payment Successful'), ('payment_retry_success', 'Payment Successful'),
...@@ -523,7 +523,7 @@ class PaymentMigrations: ...@@ -523,7 +523,7 @@ class PaymentMigrations:
except: except:
pass pass
logger.info("✅ Default payment system data inserted") logger.info("✅ Default payment system data checked (existing records preserved)")
# Insert default free tier if it doesn't exist # Insert default free tier if it doesn't exist
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment