from collections import defaultdict from alembic import op import sqlalchemy as sa from sqlalchemy import func from appcomposer.db import db from appcomposer.application import app metadata = db.MetaData() TranslationExternalSuggestion = db.Table( 'TranslationExternalSuggestions', metadata, sa.Column('id', sa.Integer, nullable=True), sa.Column('engine', sa.Unicode(length=255), nullable=True), sa.Column('language', sa.Integer, nullable=False), sa.Column('human_key_hash', sa.Integer, nullable=False), ) def upgrade(): with app.app_context(): duplicated_suggestions = list( db.session.query( TranslationExternalSuggestion.c.engine, TranslationExternalSuggestion.c.language, TranslationExternalSuggestion.c.human_key_hash).group_by( TranslationExternalSuggestion.c.engine, TranslationExternalSuggestion.c.language, TranslationExternalSuggestion.c.human_key_hash).
down_revision = '92235b77ea53' from collections import defaultdict from alembic import op import sqlalchemy as sa from sqlalchemy import func from appcomposer.db import db from appcomposer.application import app metadata = db.MetaData() ActiveTranslationMessage = db.Table( 'ActiveTranslationMessages', metadata, sa.Column('id', sa.Integer, nullable=True), sa.Column('key', sa.Unicode(length=255), nullable=True), sa.Column('bundle_id', sa.Integer, nullable=False), ) def upgrade(): # ### commands auto generated by Alembic - please adjust! ### with app.app_context(): duplicated_active_messages = list( db.session.query( ActiveTranslationMessage.c.key, ActiveTranslationMessage.c.bundle_id).group_by( ActiveTranslationMessage.c.bundle_id, ActiveTranslationMessage.c.key).having(
# revision identifiers, used by Alembic. revision = '4e20dff98010' down_revision = '4c0992d0b552' from alembic import op import sqlalchemy as sa import sqlalchemy.sql as sql from appcomposer.db import db from appcomposer.application import app metadata = db.MetaData() translation_urls = db.Table( 'TranslationUrls', metadata, db.Column('id', db.Integer()), db.Column('automatic', db.Boolean), ) def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('TranslationUrls', sa.Column('automatic', sa.Boolean(), nullable=True)) op.create_index(u'ix_TranslationUrls_automatic', 'TranslationUrls', ['automatic'], unique=False) ### end Alembic commands ### with app.app_context(): update_stmt = translation_urls.update().values(automatic=True)
# revision identifiers, used by Alembic. revision = '3d2668a96dce' down_revision = '4e20dff98010' from alembic import op import sqlalchemy as sa import sqlalchemy.sql as sql from appcomposer.db import db from appcomposer.application import app metadata = db.MetaData() translation_fast_caches = db.Table( 'TranslationFastCaches', metadata, db.Column('id', db.Integer()), ) def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('TranslationFastCaches', sa.Column('app_metadata', sa.UnicodeText(), nullable=True)) ### end Alembic commands ### with app.app_context(): delete_stmt = translation_fast_caches.delete() db.session.execute(delete_stmt) db.session.commit()
revision = '2943b8eaa095' down_revision = '435d360d3398' from alembic import op import sqlalchemy as sa import sqlalchemy.sql as sql from appcomposer.db import db from appcomposer.application import app metadata = db.MetaData() active_translation = db.Table( 'ActiveTranslationMessages', metadata, db.Column('id', db.Integer()), db.Column('bundle_id', db.Integer), db.Column('taken_from_default', db.Boolean), db.Column('from_developer', db.Boolean), db.Column('key', db.Unicode(255)), db.Column('value', db.UnicodeText()), ) bundle = db.Table( 'TranslationBundles', metadata, db.Column('id', db.Integer()), db.Column('from_developer', db.Boolean), db.Column('translation_url_id', db.Integer), db.Column('language', db.Unicode(20)), db.Column('target', db.Unicode(20)), )
revision = 'd20615919d80' down_revision = 'b262149925a7' from collections import defaultdict from alembic import op import sqlalchemy as sa from sqlalchemy import func from appcomposer.db import db from appcomposer.application import app metadata = db.MetaData() ActiveTranslationMessage = db.Table( 'ActiveTranslationMessages', metadata, sa.Column('id', sa.Integer, nullable=True), sa.Column('bundle_id', sa.Integer, nullable=False), ) TranslationMessageHistory = db.Table( 'TranslationMessageHistory', metadata, sa.Column('id', sa.Integer, nullable=True), sa.Column('bundle_id', sa.Integer, nullable=False), ) TranslationBundle = db.Table( 'TranslationBundles', metadata, sa.Column('id', sa.Integer, nullable=True), sa.Column('translation_url_id', sa.Integer, nullable=False),
down_revision = '100cfe53a84' import datetime from alembic import op import sqlalchemy as sa import sqlalchemy.sql as sql import sys sys.path.append('.') from appcomposer.db import db from appcomposer.application import app metadata = db.MetaData() translation_subscriptions = db.Table('TranslationSubscriptions', metadata, db.Column('last_check', sa.DateTime())) def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('TranslationSubscriptions', sa.Column('last_check', sa.DateTime(), nullable=True)) op.create_index(u'ix_TranslationSubscriptions_last_check', 'TranslationSubscriptions', ['last_check'], unique=False) ### end Alembic commands ### with app.app_context(): update_stmt = translation_subscriptions.update().where( translation_subscriptions.c.last_check == None).values( last_check=datetime.datetime.utcnow() - datetime.timedelta(hours=72))
down_revision = 'bfa1f94763c' from alembic import op import sqlalchemy as sa import sqlalchemy.sql as sql from appcomposer.db import db from appcomposer.application import app metadata = db.MetaData() active_translation = db.Table( 'ActiveTranslationMessages', metadata, sa.Column('history_id', sa.Integer()), sa.Column('category', sa.Unicode(length=255), nullable=True), sa.Column('fmt', sa.Unicode(length=255), nullable=True), sa.Column('from_developer', sa.Boolean(), nullable=True), sa.Column('namespace', sa.Unicode(length=255), nullable=True), sa.Column('position', sa.Integer(), nullable=True), sa.Column('same_tool', sa.Boolean(), nullable=True), sa.Column('tool_id', sa.Unicode(length=255), nullable=True), ) translation_history = db.Table( 'TranslationMessageHistory', metadata, sa.Column('id', sa.Integer()), sa.Column('parent_translation_id', sa.Integer()), sa.Column('category', sa.Unicode(length=255), nullable=True), sa.Column('fmt', sa.Unicode(length=255), nullable=True), sa.Column('from_developer', sa.Boolean(), nullable=True), sa.Column('namespace', sa.Unicode(length=255), nullable=True),