Brad Chapman avatar Brad Chapman committed 778b236

Update LIMS table version; rollback with 'sh manage_db.sh downgrade --version=79' before doing 'sh manage_db.sh upgrade'

Comments (0)

Files changed (2)

lib/galaxy/model/migrate/versions/0080_seq_lims.py

-"""Add sequencing tables
-
-Fixing constraints on table:
-
-    1. alter table sample_request_map rename to sample_request_map_old;
-    2. Add table with new constraints;
-    3. insert into sample_request_map SELECT * from sample_request_map_old;
-    4. drop table sample_request_map_old;
-"""
-from sqlalchemy import *
-from migrate import *
-
-import datetime
-now = datetime.datetime.utcnow
-
-import logging
-log = logging.getLogger( __name__ )
-
-metadata = MetaData( migrate_engine )
-
-def display_migration_details():
-    print ""
-    print "Tables for a next generation sequencing lims tied to requests."
-    print ""
-
-SampleRequestMap_table = Table('sample_request_map', metadata,
-    Column("sample_id", Integer, ForeignKey("sample.id"),
-        primary_key = True),
-    Column("request_id", Integer, ForeignKey("request.id"),
-        primary_key = True),
-    Column("order", Integer, nullable = False, autoincrement=False,
-        primary_key = True),
-    Column("is_forward", Boolean, default = True, index=True,
-        primary_key = True),
-    )
-
-SqnRunResults_table = Table("sqn_run_results", metadata,
-    Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True,
-        nullable=True),
-    Column("lane", String(255), primary_key=True),
-    Column("request_id", Integer, ForeignKey("request.id"), primary_key=True),
-    Column("sample_id", Integer, ForeignKey("sample.id"), primary_key=True),
-    Column("form_values_id", Integer, ForeignKey("form_values.id")),
-    )
-
-tables = [SampleRequestMap_table, SqnRunResults_table]
-
-def upgrade():
-    display_migration_details()
-    metadata.reflect()
-    for table in tables:
-        try:
-            table.create()
-        except Exception, e:
-            print str(e)
-            log.debug( "Creating LIMS table failed: %s" % str( e ) )
-
-def downgrade():
-    return # do not drop tables for now while in development
-    metadata.reflect()
-    tables.reverse()
-    for table in tables:
-        try:
-            table.drop()
-        except Exception, e:
-            print str(e)
-            log.debug( "Dropping LIMS table failed: %s" % str( e ) )

lib/galaxy/model/migrate/versions/0082_seq_lims.py

+"""Add sequencing tables
+
+Fixing constraints on table:
+
+    1. alter table sample_request_map rename to sample_request_map_old;
+    2. Add table with new constraints;
+    3. insert into sample_request_map SELECT * from sample_request_map_old;
+    4. drop table sample_request_map_old;
+"""
+from sqlalchemy import *
+from migrate import *
+
+import datetime
+now = datetime.datetime.utcnow
+
+import logging
+log = logging.getLogger( __name__ )
+
+metadata = MetaData( migrate_engine )
+
+def display_migration_details():
+    print ""
+    print "Tables for a next generation sequencing lims tied to requests."
+    print ""
+
+SampleRequestMap_table = Table('sample_request_map', metadata,
+    Column("sample_id", Integer, ForeignKey("sample.id"),
+        primary_key = True),
+    Column("request_id", Integer, ForeignKey("request.id"),
+        primary_key = True),
+    Column("order", Integer, nullable = False, autoincrement=False,
+        primary_key = True),
+    Column("is_forward", Boolean, default = True, index=True,
+        primary_key = True),
+    )
+
+SqnRunResults_table = Table("sqn_run_results", metadata,
+    Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True,
+        nullable=True),
+    Column("lane", String(255), primary_key=True),
+    Column("request_id", Integer, ForeignKey("request.id"), primary_key=True),
+    Column("sample_id", Integer, ForeignKey("sample.id"), primary_key=True),
+    Column("form_values_id", Integer, ForeignKey("form_values.id")),
+    )
+
+tables = [SampleRequestMap_table, SqnRunResults_table]
+
+def upgrade():
+    display_migration_details()
+    metadata.reflect()
+    for table in tables:
+        try:
+            table.create()
+        except Exception, e:
+            print str(e)
+            log.debug( "Creating LIMS table failed: %s" % str( e ) )
+
+def downgrade():
+    return # do not drop tables for now while in development
+    metadata.reflect()
+    tables.reverse()
+    for table in tables:
+        try:
+            table.drop()
+        except Exception, e:
+            print str(e)
+            log.debug( "Dropping LIMS table failed: %s" % str( e ) )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.