Attempt to be robust to not having an alignment in our RunXml file
[htsworkflow.git] / docs / upgrade_v0.2.6_to_v0.3.py
index 98772b030c57639e0f51fdf4559a09267d84adb1..92df026703f6c90c6066329b2c57cf36e2f10498 100644 (file)
@@ -10,6 +10,10 @@ def main(cmdline=None):
     shutil.copy(cmdline[0], dest)
     conn = sqlite3.connect(dest)
     c = conn.cursor()
+    
+    #Copy user id's from auth User to new HTSUser
+    c.execute('INSERT INTO samples_htsuser (user_ptr_id) SELECT id FROM auth_user;')
+    
     c.execute("""CREATE TEMPORARY TABLE experiments_flowcell_temp (
     "id" integer NOT NULL PRIMARY KEY,                                     
     "flowcell_id" varchar(20) NOT NULL UNIQUE,                             
@@ -81,6 +85,10 @@ WHERE id=%(id)d;"""
             c.execute( lane_insert % {'lane': int(lane), 'id': int(pk)} )
             
     c.execute('DROP TABLE experiments_flowcell_temp;')
+    
+    #Add control_lane column
+    c.execute('ALTER TABLE experiments_flowcell ADD COLUMN "control_lane" integer NULL;')
+    
     conn.commit()
 
 if __name__ == "__main__":