feat: Update trading_plans table to use ReplacingMergeTree for better update support

This commit is contained in:
Bobby (aider) 2025-02-11 18:34:35 -08:00
parent aa282de020
commit 978d9c7a20

View File

@ -78,7 +78,7 @@ def create_trading_plan_table():
"""Create the trading plans table if it doesn't exist""" """Create the trading plans table if it doesn't exist"""
with create_client() as client: with create_client() as client:
try: try:
# Create new table with a simple structure if it doesn't exist # Create new table with a structure that supports updates
query = """ query = """
CREATE TABLE IF NOT EXISTS trading_plans CREATE TABLE IF NOT EXISTS trading_plans
( (
@ -120,7 +120,7 @@ def create_trading_plan_table():
fundamental_criteria String, fundamental_criteria String,
options_strategy_details String options_strategy_details String
) )
ENGINE = MergeTree() ENGINE = ReplacingMergeTree(updated_at)
ORDER BY id ORDER BY id
""" """
client.command(query) client.command(query)