|
@@ -33,6 +33,7 @@ def drop_triggers(cursor):
|
|
|
cursor.execute("DROP TRIGGER IF EXISTS limit_requires_stop_loss_after_insert")
|
|
|
cursor.execute("DROP TRIGGER IF EXISTS limit_requires_stop_loss_after_update")
|
|
|
cursor.execute("DROP TRIGGER IF EXISTS minimum_order_amount_after_insert")
|
|
|
+ cursor.execute("DROP TRIGGER IF EXISTS integer_amount_after_insert")
|
|
|
|
|
|
|
|
|
# def drop_database(cursor):
|
|
@@ -171,6 +172,12 @@ def create_triggers(cursor):
|
|
|
WHEN NEW.ordered_amount < ?
|
|
|
BEGIN SELECT RAISE(ROLLBACK, 'There is a minimum amount for new orders.'); END
|
|
|
'''.replace('?',str(MINIMUM_ORDER_AMOUNT)))
|
|
|
+ cursor.execute('''
|
|
|
+ CREATE TRIGGER IF NOT EXISTS integer_amount_after_insert
|
|
|
+ AFTER INSERT ON orders
|
|
|
+ WHEN NEW.ordered_amount <> ROUND(NEW.ordered_amount)
|
|
|
+ BEGIN SELECT RAISE(ROLLBACK, 'Can only set integer amounts for new orders.'); END
|
|
|
+ '''.replace('?',str(MINIMUM_ORDER_AMOUNT)))
|
|
|
|
|
|
|
|
|
def tables(cursor):
|