1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- from sqlite3 import Cursor
- def create_indices(cursor: Cursor):
- print(' - Creating indices...')
- print(' - Creating indices...')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS ownership_ownable
- ON ownership (ownable_id)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS transactions_ownable
- ON transactions (ownable_id)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS orders_expiry
- ON orders (expiry_dt)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS orders_ownership
- ON orders (ownership_id)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS orders_limit
- ON orders ("limit")
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS transactions_dt
- ON transactions (dt)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS news_dt
- ON news (dt)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS ownables_name
- ON ownables (name)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS users_name
- ON users (username)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS sessions_id
- ON sessions (session_id)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS sessions_user
- ON sessions (user_id)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS transactions_seller
- ON transactions (seller_id)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS transactions_buyer
- ON transactions (buyer_id)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS order_history_id
- ON order_history (order_id)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS order_canceled
- ON order_history (archived_dt)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS order_history_ownership
- ON order_history (ownership_id)
- ''')
- cursor.execute('''
- CREATE INDEX IF NOT EXISTS loan_by_user
- ON loans (user_id, last_interest_pay_dt)
- ''')
|