from app import create_app, db
from app.models import User, Vendor

app = create_app()
with app.app_context():
    # Check what tables exist after init-db
    from sqlalchemy import inspect
    inspector = inspect(db.engine)
    tables_after = inspector.get_table_names()
    print(f'Tables after init-db: {len(tables_after)} tables')
    for table in sorted(tables_after):
        print(f'  - {table}')
    
    # Check if admin user was created
    admin_user = User.query.filter_by(username='admin').first()
    if admin_user:
        print(f'Admin user found: {admin_user.username} ({admin_user.email})')
    else:
        print('Admin user NOT found')
    
    # Check if demo vendor was created
    demo_vendor = Vendor.query.filter_by(vendor_code='VND-0001').first()
    if demo_vendor:
        print(f'Demo vendor found: {demo_vendor.vendor_name}')
    else:
        print('Demo vendor NOT found')