Project

General

Profile

« Previous | Next » 

Revision 2679

sql.py: create_table(): Don't add indexes on columns, because that shouldn't happen until after the table's rows have been inserted

View differences:

lib/sql.py
875 875

  
876 876
def create_table(db, table, cols):
877 877
    '''Creates a table.
878
    * The first column becomes the primary key.
879
    * Each column gets an index.
878
    The first column becomes the primary key.
880 879
    @param cols [sql_gen.TypedCol,...] The column names and types.
881 880
    '''
882 881
    table = sql_gen.as_Table(table)
......
887 886
    for col in cols: str_ += '    , '+col.to_str(db)+'\n'
888 887
    str_ += ');\n'
889 888
    run_query(db, str_, cacheable=True, log_level=2)
890
    
891
    for col in cols: add_index(db, sql_gen.Col(col.name, table))
892 889

  
893 890
def tables(db, schema_like='public', table_like='%'):
894 891
    module = util.root_module(db.db)

Also available in: Unified diff