Initial commit: SIBU 2.0 MISSION
This commit is contained in:
82
backend/seed_taxis.py
Normal file
82
backend/seed_taxis.py
Normal file
@ -0,0 +1,82 @@
|
||||
from app.core.database import engine
|
||||
from sqlalchemy import text
|
||||
import uuid
|
||||
|
||||
def seed_taxis():
|
||||
taxis_data = [
|
||||
{
|
||||
'id': str(uuid.uuid4()),
|
||||
'owner_name': 'Taxi Volcán Express',
|
||||
'phone_number': '+507 771-3344',
|
||||
'license_plate': 'CHI-1234',
|
||||
'cooperative': 'Cooperativa Boquete',
|
||||
'corregimiento': 'Boquete',
|
||||
'shift': 'dia',
|
||||
'rating': 4.5,
|
||||
'english_speaking': True,
|
||||
'is_active': True
|
||||
},
|
||||
{
|
||||
'id': str(uuid.uuid4()),
|
||||
'owner_name': 'Taxi Taroe Boquete',
|
||||
'phone_number': '+507 722-8890',
|
||||
'license_plate': 'CHI-5678',
|
||||
'cooperative': 'Cooperativa Boquete',
|
||||
'corregimiento': 'David - Boquete',
|
||||
'shift': 'tarde',
|
||||
'rating': 5.0,
|
||||
'english_speaking': True,
|
||||
'is_active': True
|
||||
},
|
||||
{
|
||||
'id': str(uuid.uuid4()),
|
||||
'owner_name': 'Taxi Aeropuerto Express',
|
||||
'phone_number': '+507 788-9900',
|
||||
'license_plate': 'CHI-9012',
|
||||
'cooperative': None,
|
||||
'corregimiento': 'Aeropuerto - Boquete',
|
||||
'shift': 'dia',
|
||||
'rating': 4.8,
|
||||
'english_speaking': True,
|
||||
'is_active': True
|
||||
},
|
||||
{
|
||||
'id': str(uuid.uuid4()),
|
||||
'owner_name': 'Taxi Nocturno Boquete',
|
||||
'phone_number': '+507 755-4433',
|
||||
'license_plate': 'CHI-3456',
|
||||
'cooperative': 'Cooperativa Boquete',
|
||||
'corregimiento': 'Boquete - David',
|
||||
'shift': 'noche',
|
||||
'rating': 4.2,
|
||||
'english_speaking': False,
|
||||
'is_active': True
|
||||
},
|
||||
{
|
||||
'id': str(uuid.uuid4()),
|
||||
'owner_name': 'Taxi Local Boquete',
|
||||
'phone_number': '+507 766-5544',
|
||||
'license_plate': 'CHI-7890',
|
||||
'cooperative': None,
|
||||
'corregimiento': 'Boquete',
|
||||
'shift': 'tarde',
|
||||
'rating': 4.7,
|
||||
'english_speaking': False,
|
||||
'is_active': True
|
||||
}
|
||||
]
|
||||
|
||||
with engine.connect() as conn:
|
||||
for taxi in taxis_data:
|
||||
conn.execute(text("""
|
||||
INSERT INTO taxis (id, owner_name, phone_number, license_plate, cooperative,
|
||||
corregimiento, shift, rating, english_speaking, is_active)
|
||||
VALUES (:id, :owner_name, :phone_number, :license_plate, :cooperative,
|
||||
:corregimiento, :shift, :rating, :english_speaking, :is_active)
|
||||
ON CONFLICT (license_plate) DO NOTHING
|
||||
"""), taxi)
|
||||
conn.commit()
|
||||
print(f"✅ Inserted {len(taxis_data)} taxis successfully!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
seed_taxis()
|
||||
Reference in New Issue
Block a user