mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 05:45:37 +08:00
Add new migration script that creates missing indexes and default data on galaxy_user and history_dataset_association tables. Fix the change datatype display in the edit_attributes template. Fix the tool config for main.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import *
|
||||
from migrate import *
|
||||
import sys, logging
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
log.setLevel(logging.DEBUG)
|
||||
handler = logging.StreamHandler( sys.stdout )
|
||||
format = "%(name)s %(levelname)s %(asctime)s %(message)s"
|
||||
formatter = logging.Formatter( format )
|
||||
handler.setFormatter( formatter )
|
||||
log.addHandler( handler )
|
||||
|
||||
metadata = MetaData( migrate_engine )
|
||||
db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, transactional=False ) )
|
||||
User_table = Table( "galaxy_user", metadata, autoload=True )
|
||||
HistoryDatasetAssociation_table = Table( "history_dataset_association", metadata, autoload=True )
|
||||
|
||||
def boolean_false():
|
||||
if migrate_engine.name == 'postgres' or migrate_engine.name == 'mysql':
|
||||
return False
|
||||
elif migrate_engine.name == 'sqlite':
|
||||
return 0
|
||||
else:
|
||||
raise Exception( 'Unable to convert data for unknown database type: %s' % db )
|
||||
|
||||
def upgrade():
|
||||
# Load existing tables
|
||||
metadata.reflect()
|
||||
# Add 2 indexes to the galaxy_user table
|
||||
i = Index( 'ix_galaxy_user_deleted', User_table.c.deleted )
|
||||
try:
|
||||
i.create()
|
||||
except Exception, e:
|
||||
log.debug( "Adding index 'ix_galaxy_user_deleted' to galaxy_user table failed: %s" % ( str( e ) ) )
|
||||
i = Index( 'ix_galaxy_user_purged', User_table.c.purged )
|
||||
try:
|
||||
i.create()
|
||||
except Exception, e:
|
||||
log.debug( "Adding index 'ix_galaxy_user_purged' to galaxy_user table failed: %s" % ( str( e ) ) )
|
||||
# Set the default data in the galaxy_user table, but only for null values
|
||||
cmd = "UPDATE galaxy_user SET deleted = %s WHERE deleted is null"
|
||||
cmd = cmd % boolean_false()
|
||||
try:
|
||||
db_session.execute( cmd )
|
||||
except Exception, e:
|
||||
log.debug( "Setting default data for galaxy_user.deleted column failed: %s" % ( str( e ) ) )
|
||||
cmd = "UPDATE galaxy_user SET purged = %s WHERE purged is null"
|
||||
cmd = cmd % boolean_false()
|
||||
try:
|
||||
db_session.execute( cmd )
|
||||
except Exception, e:
|
||||
log.debug( "Setting default data for galaxy_user.purged column failed: %s" % ( str( e ) ) )
|
||||
# Add 1 index to the history_dataset_association table
|
||||
i = Index( 'ix_hda_copied_from_library_dataset_dataset_association_id', HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id )
|
||||
try:
|
||||
i.create()
|
||||
except Exception, e:
|
||||
log.debug( "Adding index 'ix_hda_copied_from_library_dataset_dataset_association_id' to history_dataset_association table failed: %s" % ( str( e ) ) )
|
||||
def downgrade():
|
||||
pass
|
||||
@@ -1,4 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
#######
|
||||
# NOTE: To downgrade to a specific version, use something like:
|
||||
# sh manage_db.sh downgrade --version=3
|
||||
#######
|
||||
|
||||
cd `dirname $0`
|
||||
python -ES ./scripts/manage_db.py $@
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
|
||||
<%def name="datatype( dataset, datatypes )">
|
||||
<select name="datatype">
|
||||
## $datatypes.sort()
|
||||
%for ext in datatypes:
|
||||
%if dataset.ext == ext:
|
||||
<option value="${ext}" selected="yes">${_(ext)}}</option>
|
||||
<option value="${ext}" selected="yes">${_(ext)}</option>
|
||||
%else:
|
||||
<option value="${ext}">${_(ext)}}</option>
|
||||
<option value="${ext}">${_(ext)}</option>
|
||||
%endif
|
||||
%endfor
|
||||
</select>
|
||||
|
||||
+19
-31
@@ -10,14 +10,6 @@
|
||||
<tool file="data_source/encode_db.xml" />
|
||||
<tool file="data_source/epigraph_import.xml" />
|
||||
</section>
|
||||
<section name="Get ENCODE Data" id="encode">
|
||||
<tool file="data_source/encode_import_chromatin_and_chromosomes.xml"/>
|
||||
<tool file="data_source/encode_import_genes_and_transcripts.xml"/>
|
||||
<tool file="data_source/encode_import_multi-species_sequence_analysis.xml"/>
|
||||
<tool file="data_source/encode_import_transcription_regulation.xml"/>
|
||||
<tool file="data_source/encode_import_all_latest_datasets.xml" />
|
||||
<tool file="data_source/encode_import_gencode.xml" />
|
||||
</section>
|
||||
<section name="Send Data" id="send">
|
||||
<tool file="data_destination/epigraph.xml" />
|
||||
</section>
|
||||
@@ -42,17 +34,6 @@
|
||||
<tool file="filters/headWrapper.xml" />
|
||||
<tool file="filters/tailWrapper.xml" />
|
||||
</section>
|
||||
<section name="Filter and Sort" id="filter">
|
||||
<tool file="stats/filtering.xml" />
|
||||
<tool file="filters/sorter.xml" />
|
||||
<tool file="filters/grep.xml" />
|
||||
</section>
|
||||
<section name="Join, Subtract and Group" id="group">
|
||||
<tool file="filters/joiner.xml" />
|
||||
<tool file="filters/compare.xml"/>
|
||||
<tool file="new_operations/subtract_query.xml"/>
|
||||
<tool file="stats/grouping.xml" />
|
||||
</section>
|
||||
<section name="Convert Formats" id="convert">
|
||||
<tool file="filters/bed2gff.xml" />
|
||||
<tool file="fasta_tools/fasta_to_tabular.xml" />
|
||||
@@ -68,15 +49,21 @@
|
||||
<tool file="fasta_tools/fasta_to_tabular.xml" />
|
||||
<tool file="fasta_tools/tabular_to_fasta.xml" />
|
||||
</section>
|
||||
<section name="Filter and Sort" id="filter">
|
||||
<tool file="stats/filtering.xml" />
|
||||
<tool file="filters/sorter.xml" />
|
||||
<tool file="filters/grep.xml" />
|
||||
</section>
|
||||
<section name="Join, Subtract and Group" id="group">
|
||||
<tool file="filters/joiner.xml" />
|
||||
<tool file="filters/compare.xml"/>
|
||||
<tool file="new_operations/subtract_query.xml"/>
|
||||
<tool file="stats/grouping.xml" />
|
||||
</section>
|
||||
<section name="Extract Features" id="features">
|
||||
<tool file="filters/ucsc_gene_bed_to_exon_bed.xml" />
|
||||
<tool file="extract/extract_GFF_Features.xml" />
|
||||
</section>
|
||||
<!--
|
||||
<section name="Pattern-Matching" id="patmat">
|
||||
<tool file="patmat/findcluster_mysql.xml" />
|
||||
</section>
|
||||
-->
|
||||
<section name="Fetch Sequences" id="fetchSeq">
|
||||
<tool file="extract/extract_genomic_dna.xml" />
|
||||
</section>
|
||||
@@ -149,13 +136,20 @@
|
||||
<tool file="hyphy/hyphy_nj_tree_wrapper.xml" />
|
||||
<tool file="hyphy/hyphy_dnds_wrapper.xml" />
|
||||
</section>
|
||||
<section name="Taxonomy manipulation" id="tax_manipulation">
|
||||
<section name="Metagenomic analyses" id="tax_manipulation">
|
||||
<tool file="taxonomy/gi2taxonomy.xml" />
|
||||
<tool file="taxonomy/t2t_report.xml" />
|
||||
<tool file="taxonomy/t2ps_wrapper.xml" />
|
||||
<tool file="taxonomy/find_diag_hits.xml" />
|
||||
<tool file="taxonomy/lca.xml" />
|
||||
<tool file="taxonomy/poisson2test.xml" />
|
||||
</section>
|
||||
<section name="Short Read Analysis" id="short_read_analysis">
|
||||
<tool file="metag_tools/short_reads_figure_score.xml" />
|
||||
<tool file="metag_tools/short_reads_trim_seq.xml" />
|
||||
<tool file="metag_tools/megablast_wrapper.xml" />
|
||||
<tool file="metag_tools/megablast_xml_parser.xml" />
|
||||
</section>
|
||||
<section name="EMBOSS" id="EMBOSSLite">
|
||||
<tool file="emboss_5/emboss_antigenic.xml" />
|
||||
<tool file="emboss_5/emboss_backtranseq.xml" />
|
||||
@@ -265,10 +259,4 @@
|
||||
<tool file="emboss_5/emboss_wordcount.xml" />
|
||||
<tool file="emboss_5/emboss_wordmatch.xml" />
|
||||
</section>
|
||||
<section name="Short Read Analysis" id="short_read_analysis">
|
||||
<tool file="metag_tools/short_reads_figure_score.xml" />
|
||||
<tool file="metag_tools/short_reads_trim_seq.xml" />
|
||||
<tool file="metag_tools/megablast_wrapper.xml" />
|
||||
<tool file="metag_tools/megablast_xml_parser.xml" />
|
||||
</section>
|
||||
</toolbox>
|
||||
|
||||
Reference in New Issue
Block a user