First commit
This commit is contained in:
20
migrations.py
Normal file
20
migrations.py
Normal file
@ -0,0 +1,20 @@
|
||||
from models import db, Contacts
|
||||
from faker import Factory
|
||||
|
||||
fake = Factory.create()
|
||||
# Spanish
|
||||
#fake = Factory.create('es_ES')
|
||||
# Reload tables
|
||||
db.drop_all()
|
||||
db.create_all()
|
||||
# Make 100 fake contacts
|
||||
for num in range(100):
|
||||
fullname = fake.name().split()
|
||||
name = fullname[0]
|
||||
surname = ' '.join(fullname[1:])
|
||||
email = fake.email()
|
||||
phone = fake.phone_number()
|
||||
# Save in database
|
||||
mi_contacto = Contacts(name, surname, email, phone)
|
||||
db.session.add(mi_contacto)
|
||||
db.session.commit()
|
Reference in New Issue
Block a user