<commit_before>import sqlite3

__author__ = 'sammoth'


def build(log):
    """
    Build the necessary tables in the database
    use the 'IF NOT EXISTS' clause to allow for repeated running without barfing
    :return:
    """
    conn = sqlite3.connect('pool.db')
    c = conn.cursor()
    log.info('create the users table')
    c.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, user TEXT, "
              "address TEXT, exchange TEXT, unit TEXT)")
    log.info('create the orders table')
    c.execute("CREATE TABLE IF NOT EXISTS orders (id INTEGER PRIMARY KEY, user TEXT, "
              "tier TEXT, order_id TEXT, order_amount NUMBER, order_type TEXT, exchange "
              "TEXT, unit TEXT)")
    log.info('create the credits table')
    c.execute("CREATE TABLE IF NOT EXISTS credits (id INTEGER PRIMARY KEY, time NUMBER, "
              "user TEXT, exchange TEXT, unit TEXT, tier TEXT, side TEXT, provided "
              "NUMBER, total NUMBER, percentage NUMBER, reward NUMBER, paid INTEGER)")
    log.info('create the info table')
    c.execute("CREATE TABLE IF NOT EXISTS info (key Text, value Text)")
    c.execute("INSERT INTO info VALUES (?, ?)", ('last_credit_time', 0))
    conn.commit()
    conn.close()
    return
<commit_msg>update schemas Orders now persist and have a credited flag set.<commit_after>import sqlite3

__author__ = 'sammoth'


def build(log):
    """
    Build the necessary tables in the database
    use the 'IF NOT EXISTS' clause to allow for repeated running without barfing
    :return:
    """
    conn = sqlite3.connect('pool.db')
    c = conn.cursor()
    log.info('create the users table')
    c.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, user TEXT, "
              "address TEXT, exchange TEXT, unit TEXT)")
    log.info('create the orders table')
    c.execute("CREATE TABLE IF NOT EXISTS orders (id INTEGER PRIMARY KEY, user TEXT, "
              "tier TEXT, order_id TEXT, order_amount NUMBER, side TEXT, exchange "
              "TEXT, unit TEXT, credited INTEGER)")
    log.info('create the credits table')
    c.execute("CREATE TABLE IF NOT EXISTS credits (id INTEGER PRIMARY KEY, time NUMBER, "
              "user TEXT, exchange TEXT, unit TEXT, tier TEXT, side TEXT, "
              "order_id NUMBER, provided NUMBER, total NUMBER, percentage NUMBER, "
              "reward NUMBER, paid INTEGER)")
    log.info('create the info table')
    c.execute("CREATE TABLE IF NOT EXISTS info (key Text, value Text)")
    c.execute("INSERT INTO info VALUES (?, ?)", ('last_credit_time', 0))
    conn.commit()
    conn.close()
    return

{'fraction_non_alphanumeric': 0.10312024353120243, 'fraction_numerical': 0.00228310502283105, 'mean_word_length': 2.977307110438729, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '592676', 'n_tokens_mistral': 799, 'n_tokens_neox': 730, 'n_words': 294}