-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
executable file
·38 lines (32 loc) · 1.14 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from peewee import *
import config
db = PostgresqlDatabase(config.DB_NAME, user=config.DB_USERNAME, password=config.DB_PASSWORD, host='vk_postgres')
class BaseModel(Model):
class Meta:
database = db
class User(BaseModel):
user_id = TextField(unique=True)
vk_id = TextField(default='123')
target = TextField(default='test')
token = TextField(default='test')
app_id = TextField(default='test')
app_secret = TextField(default='test')
target_sex = IntegerField(default=3)
is_active = BooleanField(default=True)
do_friends = BooleanField(default=True)
do_likes = BooleanField(default=True)
class Friend(BaseModel):
user_id = TextField()
owner = ForeignKeyField(User, backref='friends')
first_name = TextField(default='Василиса')
last_name = TextField(default='Пупкина')
sex = IntegerField(default=1)
bdate = DateTimeField(default='01.1.1900')
with db.atomic():
#db.drop_tables([User])
try:
db.create_tables([User, Friend])
except:
db.evolve(interactive=False)
#migrate(
# migrator.add_column('user', 'order_type', order_type))