Skip to content

Commit cdabb62

Browse files
committed
Revert "Fix migrations tests"
This reverts commit 1386d02.
1 parent 5684600 commit cdabb62

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

tests/migrations/conftest.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,49 @@
33
import tempfile
44
import logging
55

6-
from sqlalchemy import create_engine
6+
from sqlalchemy import create_engine, Column, String, Integer, Float
7+
from sqlalchemy.ext.declarative import declarative_base
78
from sqlalchemy.orm import sessionmaker
89

910
log = logging.getLogger("dexbot")
1011
log.setLevel(logging.DEBUG)
1112

13+
Base = declarative_base()
14+
15+
# Classes are represent initial table structure
16+
17+
18+
class Config(Base):
19+
__tablename__ = 'config'
20+
21+
id = Column(Integer, primary_key=True)
22+
category = Column(String)
23+
key = Column(String)
24+
value = Column(String)
25+
26+
27+
class Orders(Base):
28+
__tablename__ = 'orders'
29+
30+
id = Column(Integer, primary_key=True)
31+
worker = Column(String)
32+
order_id = Column(String)
33+
order = Column(String)
34+
35+
36+
class Balances(Base):
37+
__tablename__ = 'balances'
38+
39+
id = Column(Integer, primary_key=True)
40+
account = Column(String)
41+
worker = Column(String)
42+
base_total = Column(Float)
43+
base_symbol = Column(String)
44+
quote_total = Column(Float)
45+
quote_symbol = Column(String)
46+
center_price = Column(Float)
47+
timestamp = Column(Integer)
48+
1249

1350
@pytest.fixture
1451
def initial_db():
@@ -17,6 +54,7 @@ def initial_db():
1754
engine = create_engine('sqlite:///{}'.format(db_file), echo=False)
1855
Session = sessionmaker(bind=engine)
1956
session = Session()
57+
Base.metadata.create_all(engine)
2058
session.commit()
2159
log.debug('Prepared db on {}'.format(db_file))
2260

0 commit comments

Comments
 (0)