This patch adds in fields to support storing bioanalyzer results. [ticket:166]
[htsworkflow.git] / docs / upgrade_v0.4.3_to_v0.4.4.py
diff --git a/docs/upgrade_v0.4.3_to_v0.4.4.py b/docs/upgrade_v0.4.3_to_v0.4.4.py
new file mode 100644 (file)
index 0000000..44e2baf
--- /dev/null
@@ -0,0 +1,37 @@
+"""
+This renames avg_lib_size to gel_cut_size and adds an insert length field 
+to samples_library.
+"""
+
+import shutil
+import sqlite3
+import sys
+
+def main(cmdline=None):
+    if len(cmdline) == 1:
+       dest='/tmp/fctracker.db'
+    else:
+      dest = cmdline[1]
+    shutil.copy(cmdline[0], dest)
+    conn = sqlite3.connect(dest)
+    c = conn.cursor()
+    
+    c.execute("""
+alter table samples_library 
+add column "bioanalyzer_concentration" decimal;
+""")
+    
+    c.execute("""
+alter table samples_library 
+add column "bioanalyzer_summary" text NOT NULL default "";
+""")
+
+    c.execute("""
+alter table samples_library 
+add column "bioanalyzer_image_url" varchar(200) NOT NULL default "";
+""")
+
+    conn.commit()
+
+if __name__ == "__main__":
+    main(sys.argv[1:])