Warning

This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for galaxy.model.migrate.versions.0021_user_prefs

"""
This migration script adds a user preferences table to Galaxy.
"""
from __future__ import print_function

import logging

from sqlalchemy import Column, ForeignKey, Integer, MetaData, Table, Unicode

from galaxy.model.migrate.versions.util import create_table, drop_table

log = logging.getLogger(__name__)
metadata = MetaData()

# New table to support user preferences.
UserPreference_table = Table("user_preference", metadata,
                             Column("id", Integer, primary_key=True),
                             Column("user_id", Integer, ForeignKey("galaxy_user.id"), index=True),
                             Column("name", Unicode(255), index=True),
                             Column("value", Unicode(1024)))


[docs]def upgrade(migrate_engine): print(__doc__) metadata.bind = migrate_engine metadata.reflect() create_table(UserPreference_table)
[docs]def downgrade(migrate_engine): metadata.bind = migrate_engine metadata.reflect() drop_table(UserPreference_table)