feat: Add order_for_labels table to database initialization
- Added order_for_labels table to initialize_db.py with columns: * comanda_productie: Production order code (indexed) * cod_articol: Article code * descr_com_prod: Production order description * cantitate: Quantity * com_achiz_client: Client purchase order * nr_linie_com_client: Client order line number * customer_name: Customer name * customer_article_number: Customer's article reference * open_for_order: Open for order flag * line_number: Line number reference * printed_labels: Print status (indexed, default 0) * data_livrara: Delivery date * dimensiune: Dimensions * Indexes on: comanda_productie, printed_labels, created_at - Added order_for_labels schema verification to db_schema_verifier.py - Table supports labels printing module with proper indexing for queries - Timestamps: created_at, updated_at for audit trail
This commit is contained in:
@@ -108,6 +108,7 @@ class SchemaVerifier:
|
|||||||
'application_settings': self.get_application_settings_schema,
|
'application_settings': self.get_application_settings_schema,
|
||||||
'audit_logs': self.get_audit_logs_schema,
|
'audit_logs': self.get_audit_logs_schema,
|
||||||
'backup_schedules': self.get_backup_schedules_schema,
|
'backup_schedules': self.get_backup_schedules_schema,
|
||||||
|
'order_for_labels': self.get_order_for_labels_schema,
|
||||||
}
|
}
|
||||||
|
|
||||||
for table_name, schema_getter in tables_to_verify.items():
|
for table_name, schema_getter in tables_to_verify.items():
|
||||||
@@ -371,3 +372,29 @@ class SchemaVerifier:
|
|||||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_order_for_labels_schema():
|
||||||
|
return """
|
||||||
|
CREATE TABLE IF NOT EXISTS order_for_labels (
|
||||||
|
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
comanda_productie VARCHAR(50) NOT NULL,
|
||||||
|
cod_articol VARCHAR(50),
|
||||||
|
descr_com_prod TEXT,
|
||||||
|
cantitate DECIMAL(10, 2),
|
||||||
|
com_achiz_client VARCHAR(50),
|
||||||
|
nr_linie_com_client VARCHAR(50),
|
||||||
|
customer_name VARCHAR(255),
|
||||||
|
customer_article_number VARCHAR(100),
|
||||||
|
open_for_order TINYINT(1) DEFAULT 1,
|
||||||
|
line_number INT,
|
||||||
|
printed_labels TINYINT(1) DEFAULT 0,
|
||||||
|
data_livrara DATE,
|
||||||
|
dimensiune VARCHAR(50),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
INDEX idx_comanda_productie (comanda_productie),
|
||||||
|
INDEX idx_printed_labels (printed_labels),
|
||||||
|
INDEX idx_created_at (created_at)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||||
|
"""
|
||||||
|
|||||||
@@ -399,6 +399,31 @@ def create_tables():
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||||
""", description="Table 'cp_location_history'")
|
""", description="Table 'cp_location_history'")
|
||||||
|
|
||||||
|
# Order For Labels table (for printing module)
|
||||||
|
execute_sql(conn, """
|
||||||
|
CREATE TABLE IF NOT EXISTS order_for_labels (
|
||||||
|
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
comanda_productie VARCHAR(50) NOT NULL,
|
||||||
|
cod_articol VARCHAR(50),
|
||||||
|
descr_com_prod TEXT,
|
||||||
|
cantitate DECIMAL(10, 2),
|
||||||
|
com_achiz_client VARCHAR(50),
|
||||||
|
nr_linie_com_client VARCHAR(50),
|
||||||
|
customer_name VARCHAR(255),
|
||||||
|
customer_article_number VARCHAR(100),
|
||||||
|
open_for_order TINYINT(1) DEFAULT 1,
|
||||||
|
line_number INT,
|
||||||
|
printed_labels TINYINT(1) DEFAULT 0,
|
||||||
|
data_livrara DATE,
|
||||||
|
dimensiune VARCHAR(50),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
INDEX idx_comanda_productie (comanda_productie),
|
||||||
|
INDEX idx_printed_labels (printed_labels),
|
||||||
|
INDEX idx_created_at (created_at)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||||
|
""", description="Table 'order_for_labels'")
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
logger.info("✓ All tables created successfully")
|
logger.info("✓ All tables created successfully")
|
||||||
|
|||||||
Reference in New Issue
Block a user