Project

General

Profile

« Previous | Next » 

Revision 2117

sql.py: add_row_num(): Make the row number column the primary key

View differences:

lib/sql.py
525 525
row_num_col = '_row_num'
526 526

  
527 527
def add_row_num(db, table):
528
    '''Adds a row number column to a table. Its name is in row_num_col.'''
528
    '''Adds a row number column to a table. Its name is in row_num_col. It will
529
    be the primary key.'''
529 530
    check_name(table)
530 531
    run_query(db, 'ALTER TABLE '+table+' ADD COLUMN '+row_num_col
531
        +' serial NOT NULL')
532
        +' serial NOT NULL PRIMARY KEY')
532 533

  
533 534
def tables(db, schema='public', table_like='%'):
534 535
    module = util.root_module(db.db)

Also available in: Unified diff