Initial commit: Fleet Management app with security hardening and background launcher
- Flask app with SQLAlchemy, Flask-Login, Flask-Mail - Admin/owner roles, vessel management, charters, work orders - Background launcher (Iniciar.vbs) runs server without terminal window - Root redirect fixed: / → /login - debug=False, use_reloader=False for pythonw.exe compatibility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
from app import create_app, db
|
||||
from app.models import db
|
||||
import sqlalchemy as sa
|
||||
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
# Verificar si la tabla vessel_systems existe
|
||||
inspector = sa.inspect(db.engine)
|
||||
if not inspector.has_table('vessel_systems'):
|
||||
# Crear tabla de sistemas de embarcación
|
||||
db.session.execute('''
|
||||
CREATE TABLE vessel_systems (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
vessel_id INTEGER NOT NULL,
|
||||
system_type TEXT NOT NULL,
|
||||
component_name TEXT NOT NULL,
|
||||
manufacturer TEXT,
|
||||
model TEXT,
|
||||
serial_number TEXT,
|
||||
installation_date DATE,
|
||||
last_maintenance_date DATE,
|
||||
status TEXT DEFAULT 'active',
|
||||
notes TEXT,
|
||||
FOREIGN KEY (vessel_id) REFERENCES vessels(id)
|
||||
)
|
||||
''')
|
||||
print("Tabla vessel_systems creada")
|
||||
|
||||
if not inspector.has_table('maintenance_logs'):
|
||||
# Crear tabla de registros de mantenimiento
|
||||
db.session.execute('''
|
||||
CREATE TABLE maintenance_logs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
system_id INTEGER NOT NULL,
|
||||
work_order_id INTEGER,
|
||||
maintenance_date DATE NOT NULL,
|
||||
maintenance_type TEXT NOT NULL,
|
||||
description TEXT,
|
||||
cost REAL,
|
||||
technician TEXT,
|
||||
next_maintenance_date DATE,
|
||||
hours_accumulated INTEGER,
|
||||
FOREIGN KEY (system_id) REFERENCES vessel_systems(id),
|
||||
FOREIGN KEY (work_order_id) REFERENCES work_orders(id)
|
||||
)
|
||||
''')
|
||||
print("Tabla maintenance_logs creada")
|
||||
|
||||
print("Estructura de historial por sistemas agregada")
|
||||
Reference in New Issue
Block a user