-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
32 lines (21 loc) · 850 Bytes
/
models.py
File metadata and controls
32 lines (21 loc) · 850 Bytes
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
from sqlalchemy import Column, ForeignKey, Integer, BigInteger, DateTime, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func
Base = declarative_base()
class Wallet(Base):
__tablename__ = 'wallets'
id = Column(Integer, primary_key=True)
balance = Column(BigInteger)
class Refill(Base):
__tablename__ = 'refills'
id = Column(Integer, primary_key=True)
wallet_id = Column(Integer, ForeignKey('wallets.id'))
amount = Column(BigInteger)
datetime = Column(DateTime, server_default=func.now())
class Transaction(Base):
__tablename__ = 'transactions'
id = Column(Integer, primary_key=True)
wallet_id = Column(Integer, ForeignKey('wallets.id'))
amount = Column(BigInteger)
datetime = Column(DateTime, server_default=func.now())
ip = Column(String)