Attempt to be robust to not having an alignment in our RunXml file
[htsworkflow.git] / docs / upgrade_v0.4.3_to_v0.4.4.py
1 """
2 This renames avg_lib_size to gel_cut_size and adds an insert length field 
3 to samples_library.
4 """
5
6 import shutil
7 import sqlite3
8 import sys
9
10 def main(cmdline=None):
11     if len(cmdline) == 1:
12        dest='/tmp/fctracker.db'
13     else:
14       dest = cmdline[1]
15     shutil.copy(cmdline[0], dest)
16     conn = sqlite3.connect(dest)
17     c = conn.cursor()
18     
19     c.execute("""
20 alter table samples_library 
21 add column "bioanalyzer_concentration" decimal;
22 """)
23     
24     c.execute("""
25 alter table samples_library 
26 add column "bioanalyzer_summary" text NOT NULL default "";
27 """)
28
29     c.execute("""
30 alter table samples_library 
31 add column "bioanalyzer_image_url" varchar(200) NOT NULL default "";
32 """)
33
34     conn.commit()
35
36 if __name__ == "__main__":
37     main(sys.argv[1:])