我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用sqlalchemy.VARCHAR。
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('privatemessages', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('user_id', sa.INTEGER(), nullable=False), sa.Column('from_user_id', sa.INTEGER(), nullable=True), sa.Column('to_user_id', sa.INTEGER(), nullable=True), sa.Column('subject', sa.VARCHAR(length=255), nullable=True), sa.Column('message', sa.TEXT(), nullable=True), sa.Column('date_created', sa.DATETIME(), nullable=True), sa.Column('trash', sa.BOOLEAN(), nullable=False), sa.Column('draft', sa.BOOLEAN(), nullable=False), sa.Column('unread', sa.BOOLEAN(), nullable=False), sa.ForeignKeyConstraint(['from_user_id'], [u'users.id'], ), sa.ForeignKeyConstraint(['to_user_id'], [u'users.id'], ), sa.ForeignKeyConstraint(['user_id'], [u'users.id'], ), sa.PrimaryKeyConstraint('id') ) op.drop_table('messages') op.drop_table('conversations') ### end Alembic commands ###
def upgrade(): op.alter_column('kubes', 'name', existing_type=sa.VARCHAR(length=64), nullable=False) op.create_index('one_default', 'kubes', ['is_default'], unique=True, postgresql_where=sa.text(u'kubes.is_default IS true')) op.drop_constraint(u'kubes_is_default_key', 'kubes', type_='unique') op.alter_column('packages', 'name', existing_type=sa.VARCHAR(length=64), nullable=False) op.alter_column('packages', 'prefix', existing_type=sa.VARCHAR(), nullable=False) op.alter_column('packages', 'suffix', existing_type=sa.VARCHAR(), nullable=False) session = Session(bind=op.get_bind()) session.query(PackageKube).filter(sa.or_( PackageKube.package_id.is_(None), PackageKube.kube_id.is_(None), )).delete() session.commit() op.alter_column('package_kube', 'kube_id', existing_type=sa.INTEGER(), nullable=False) op.alter_column('package_kube', 'package_id', existing_type=sa.INTEGER(), nullable=False)
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('searches', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('search_terms', sa.VARCHAR(length=64), nullable=False), sa.Column('timestamp', sa.DATETIME(), nullable=True), sa.Column('user_id', sa.INTEGER(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('users', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('social_id', sa.VARCHAR(length=64), nullable=False), sa.Column('nickname', sa.VARCHAR(length=64), nullable=False), sa.Column('email', sa.VARCHAR(length=64), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('social_id') ) ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('housing_evals', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('uid', sa.VARCHAR(length=32), nullable=False), sa.Column('social_attended', sa.TEXT(), nullable=False), sa.Column('social_hosted', sa.TEXT(), nullable=False), sa.Column('technical_attended', sa.TEXT(), nullable=False), sa.Column('technical_hosted', sa.TEXT(), nullable=False), sa.Column('projects', sa.TEXT(), nullable=False), sa.Column('comments', sa.TEXT(), nullable=False), sa.Column('points', sa.INTEGER(), nullable=False), sa.Column('active', sa.BOOLEAN(), nullable=False), sa.Column('date_created', sa.DATE(), nullable=False), sa.PrimaryKeyConstraint('id') ) ### end Alembic commands ###
def createTable(tab): tableName=tab.tableName columns=tab.m db = dataset.connect('sqlite:///olidata.db') db.query('DROP table IF EXISTS '+tableName) table = db.create_table(tableName) for row in columns: if (row[2]=='int'): table.create_column(row[0], sqlalchemy.Integer) elif (row[2]=='varchar'): table.create_column(row[0], sqlalchemy.VARCHAR(255)) cols=', '.join(columns[:,0]) db.query('DROP INDEX IF EXISTS unique_name') db.query('create unique index unique_name on '+tableName+'('+cols+')') print(db[tableName].columns)
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column(u'users', 'user_id', existing_type=sa.VARCHAR(length=100), nullable=True) op.alter_column(u'users', 'updated_at', existing_type=postgresql.TIMESTAMP(), nullable=True) op.alter_column(u'users', 'name', existing_type=sa.VARCHAR(length=100), nullable=True) op.alter_column(u'users', 'last_name', existing_type=sa.VARCHAR(length=200), nullable=True) op.alter_column(u'users', 'email', existing_type=sa.VARCHAR(length=150), nullable=True) op.alter_column(u'users', 'created_at', existing_type=postgresql.TIMESTAMP(), nullable=True) op.drop_table('request_referral') ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'mailing_list', type_='unique') op.drop_column('mailing_list', 'url') op.create_table('email', sa.Column('id', sa.INTEGER(), server_default=sa.text(u"nextval('email_id_seq'::regclass)"), nullable=False), sa.Column('value', sa.VARCHAR(length=120), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name=u'email_pkey'), sa.UniqueConstraint('value', name=u'email_value_key'), postgresql_ignore_search_path=False ) op.create_table('email_mailing_list', sa.Column('mailing_list_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('email_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['email_id'], [u'email.id'], name=u'email_mailing_list_email_id_fkey'), sa.ForeignKeyConstraint(['mailing_list_id'], [u'mailing_list.id'], name=u'email_mailing_list_mailing_list_id_fkey') ) # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('channels', 'owner_id', existing_type=sa.VARCHAR(), nullable=False) op.alter_column('disabled_channels', 'channel_id', existing_type=sa.VARCHAR(), nullable=False) op.alter_column('disabled_channels', 'last_vk_post_id', existing_type=sa.INTEGER(), nullable=False) op.alter_column('disabled_channels', 'owner_id', existing_type=sa.VARCHAR(), nullable=False) op.alter_column('disabled_channels', 'vk_group_id', existing_type=sa.VARCHAR(), nullable=False) # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('disabled_channels', 'vk_group_id', existing_type=sa.VARCHAR(), nullable=True) op.alter_column('disabled_channels', 'owner_id', existing_type=sa.VARCHAR(), nullable=True) op.alter_column('disabled_channels', 'last_vk_post_id', existing_type=sa.INTEGER(), nullable=True) op.alter_column('disabled_channels', 'channel_id', existing_type=sa.VARCHAR(), nullable=True) op.alter_column('channels', 'owner_id', existing_type=sa.VARCHAR(), nullable=True) # ### end Alembic commands ###
def downgrade(): """Downgrade the database to an older revision.""" # commands auto generated by Alembic - please adjust! ### op.drop_column('batches_versions', 'id') op.create_table('analysis_requests', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('job_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('submitted_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('fulfilled_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('analysis_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('version_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('parent_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['analysis_id'], ['analyses.id'], name='analysis_requests_analysis_id_fkey'), sa.ForeignKeyConstraint(['version_id'], ['versions.id'], name='analysis_requests_version_id_fkey'), sa.PrimaryKeyConstraint('id', name='analysis_requests_pkey')) # end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('issue', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('topic_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('serial', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('published_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=128), server_default=sa.text(u"''::character varying"), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['topic_id'], [u'topic.id'], name=u'fk_issue_topic'), sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'fk_issue_user'), sa.PrimaryKeyConstraint('id', name=u'issue_pkey'), sa.UniqueConstraint('topic_id', 'serial', name=u'ux_issue_topic_serial') ) op.add_column('link', sa.Column('issue_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.drop_constraint('fk_link_topic', 'link', type_='foreignkey') op.create_foreign_key(u'fk_link_issue', 'link', 'issue', ['issue_id'], ['id']) op.create_index('ix_issue', 'link', ['issue_id'], unique=False) op.drop_column('link', 'topic_id') ### end Alembic commands ###
def get_columns(self, connection, table_name, schema=None, **kw): q = "SELECT * FROM `%(table_id)s` LIMIT 0" % ({"table_id": table_name}) columns = connection.execute(q) result = [] for column_name in columns.keys(): # TODO Handle types better column = { "name": column_name, "type": VARCHAR, "default": None, "autoincrement": None, "nullable": False, } result.append(column) return result
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('roles', sa.Column('id', sa.INTEGER()), sa.Column('name', sa.VARCHAR()), sa.PrimaryKeyConstraint('id') ) op.create_table('users', sa.Column('id', sa.INTEGER()), sa.Column('name', sa.VARCHAR()), sa.Column('password', sa.VARCHAR()), sa.Column('role_id', sa.INTEGER()), sa.ForeignKeyConstraint(['role_id'], [u'roles.id'], ), sa.PrimaryKeyConstraint('id') ) ### end Alembic commands ###
def downgrade(): """Downgrade the database to an older revision.""" # ### commands auto generated by Alembic - please adjust! ### op.drop_column('batches_versions', 'id') op.create_table('analysis_requests', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('job_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('submitted_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('fulfilled_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('analysis_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('version_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('parent_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['analysis_id'], ['analyses.id'], name='analysis_requests_analysis_id_fkey'), sa.ForeignKeyConstraint(['version_id'], ['versions.id'], name='analysis_requests_version_id_fkey'), sa.PrimaryKeyConstraint('id', name='analysis_requests_pkey')) # ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('privatemessages', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('user_id', sa.INTEGER(), nullable=False), sa.Column('from_user_id', sa.INTEGER(), nullable=True), sa.Column('to_user_id', sa.INTEGER(), nullable=True), sa.Column('subject', sa.VARCHAR(length=255), nullable=True), sa.Column('message', sa.TEXT(), nullable=True), sa.Column('date_created', sa.DateTime(), nullable=True), sa.Column('trash', sa.BOOLEAN(), nullable=False), sa.Column('draft', sa.BOOLEAN(), nullable=False), sa.Column('unread', sa.BOOLEAN(), nullable=False), sa.ForeignKeyConstraint(['from_user_id'], [u'users.id'], ), sa.ForeignKeyConstraint(['to_user_id'], [u'users.id'], ), sa.ForeignKeyConstraint(['user_id'], [u'users.id'], ), sa.PrimaryKeyConstraint('id') ) op.drop_table('messages') op.drop_table('conversations') ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'results', sa.Column( 'sent_value', sa.String(), nullable=False, server_default='UPDATE results set sent_value = value' ), ) op.alter_column('results', 'value', existing_type=sa.VARCHAR(), nullable=True) op.alter_column('results', 'sent_value', server_default=None) # ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('programs_of_study', sa.Column('level', sa.VARCHAR(), autoincrement=False, nullable=True)) op.drop_column('programs_of_study', 'post_type') op.add_column('courses', sa.Column('code', sa.VARCHAR(), autoincrement=False, nullable=True)) op.create_table('users', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('fb_id', sa.VARCHAR(length=18), autoincrement=False, nullable=True), sa.Column('fb_first_name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('fb_last_name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('faculty', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('college_eng_type', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('year', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('commuter', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name=u'users_pkey'), sa.UniqueConstraint('fb_id', name=u'users_fb_id_key') ) ### end Alembic commands ###
def visit_VARCHAR(self, type_, **kw): return self._extend("VARCHAR", type_, length=type_.length or 'max')
def downgrade(): op.drop_table('inpatientlocation') op.drop_table('inpatientadmission') op.create_table('inpatientepisode', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('updated', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('datetime_of_admission', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.Column('datetime_of_discharge', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('visit_number', sa.VARCHAR(length=250), autoincrement=False, nullable=False), sa.Column('admission_diagnosis', sa.VARCHAR(length=250), autoincrement=False, nullable=True), sa.Column('gloss_reference_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['gloss_reference_id'], [u'glossolaliareference.id'], name=u'inpatientepisode_gloss_reference_id_fkey'), sa.PrimaryKeyConstraint('id', name=u'inpatientepisode_pkey') ) op.create_table('inpatientlocation', sa.Column('id', sa.Integer(), nullable=False), sa.Column('updated', sa.DateTime(), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('inpatient_episode_id', sa.Integer(), nullable=True), sa.Column('datetime_of_transfer', sa.DateTime(), nullable=True), sa.Column('ward_code', sa.String(length=250), nullable=True), sa.Column('room_code', sa.String(length=250), nullable=True), sa.Column('bed_code', sa.String(length=250), nullable=True), sa.ForeignKeyConstraint(['inpatient_episode_id'], ['inpatientepisode.id'], ), sa.PrimaryKeyConstraint('id') ) ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('bit_facebook_daily_ad_insights', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('ad_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('buying_type', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('unique_clicks', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('age', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('gender', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('date_stop', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('date_start', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['ad_id'], [u'bit_facebook_ad.id'], name=u'bit_facebook_daily_ad_insights_ad_id_fkey'), sa.PrimaryKeyConstraint('id', name=u'bit_facebook_daily_ad_insights_pkey') ) # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('bit_connectors_appsflyer', sa.Column('app_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('api_token', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('url_pat', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('connector_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['connector_id'], [u'bit_connectors.id'], name=u'bit_connectors_appsflyer_connector_id_fkey') ) op.drop_table('bit_appsflyer_connector') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('bit_facebook_daily_ad_insights', sa.Column('campaign_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.add_column('bit_facebook_daily_ad_insights', sa.Column('native_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.create_index('ix_bit_facebook_daily_ad_insights_native_id', 'bit_facebook_daily_ad_insights', ['native_id'], unique=True) op.drop_column('bit_facebook_daily_ad_insights', 'date_start') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('bit_chiter_connector', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('app_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('api_token', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('url_pat', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['id'], [u'bit_connectors.id'], name=u'bit_chiter_connector_id_fkey'), sa.PrimaryKeyConstraint('id', name=u'bit_chiter_connector_pkey') ) # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('event', 'description', existing_type=sa.VARCHAR(), nullable=False) op.create_unique_constraint(None, 'event', ['description']) # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'event', type_='unique') op.alter_column('event', 'description', existing_type=sa.VARCHAR(), nullable=True) # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('event', sa.Column('title', sa.VARCHAR(), autoincrement=False, nullable=False)) op.drop_constraint(None, 'event', type_='foreignkey') op.create_unique_constraint('event_title_key', 'event', ['title']) op.drop_column('event', 'location_id') op.drop_table('location') # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('person', 'email', existing_type=sa.VARCHAR(), nullable=True) # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('person', 'email', existing_type=sa.VARCHAR(), nullable=False) # ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('episode', 'title', existing_type=sa.VARCHAR(), nullable=True) ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('episode', 'title', existing_type=sa.VARCHAR(), nullable=False) ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('episode', 'title', existing_type=sa.VARCHAR(), nullable=False) op.create_index(op.f('ix_episode_link'), 'episode', ['link'], unique=True) op.drop_constraint('episode_link_key', 'episode', type_='unique') ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_unique_constraint('episode_link_key', 'episode', ['link']) op.drop_index(op.f('ix_episode_link'), table_name='episode') op.alter_column('episode', 'title', existing_type=sa.VARCHAR(), nullable=True) ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('podcast', sa.Column('language', sa.VARCHAR(length=5), autoincrement=False, nullable=True)) op.drop_constraint(None, 'podcast', type_='foreignkey') op.drop_column('podcast', 'language_id') op.drop_index(op.f('ix_podcast_language_id'), table_name='podcast_language') op.drop_table('podcast_language') ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('upload', 'hash', existing_type=sa.VARCHAR(), nullable=False) op.alter_column('upload', 'path', existing_type=sa.VARCHAR(), nullable=False) op.alter_column('upload', 'shorthash', existing_type=sa.VARCHAR(), nullable=False) ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('upload', 'shorthash', existing_type=sa.VARCHAR(), nullable=True) op.alter_column('upload', 'path', existing_type=sa.VARCHAR(), nullable=True) op.alter_column('upload', 'hash', existing_type=sa.VARCHAR(), nullable=True) ### end Alembic commands ###
def visit_VARCHAR(self, type_): return self._extend("VARCHAR", type_, length=type_.length or 'max')
def upgrade(): op.alter_column('oauth_tokens', 'token_secret', existing_type=sa.VARCHAR(), nullable=True)
def downgrade(): op.alter_column('oauth_tokens', 'token_secret', existing_type=sa.VARCHAR(), nullable=False)
def downgrade(): op.add_column('posts', sa.Column('body', sa.VARCHAR(), autoincrement=False, nullable=True))
def downgrade(): op.alter_column('package_kube', 'package_id', existing_type=sa.INTEGER(), nullable=True) op.alter_column('package_kube', 'kube_id', existing_type=sa.INTEGER(), nullable=True) op.alter_column('packages', 'suffix', existing_type=sa.String(length=16), nullable=True) op.alter_column('packages', 'prefix', existing_type=sa.String(length=16), nullable=True) op.alter_column('packages', 'name', existing_type=sa.VARCHAR(length=64), nullable=True) op.create_unique_constraint(u'kubes_is_default_key', 'kubes', ['is_default']) op.drop_index('one_default', table_name='kubes') op.alter_column('kubes', 'name', existing_type=sa.VARCHAR(length=64), nullable=True)
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('pages', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('ts', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('created_by_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('modified', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('modified_by_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('slug', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('title', sa.VARCHAR(length=255), autoincrement=False, nullable=False), sa.Column('content', sa.TEXT(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['created_by_id'], [u'users.id'], name=u'pages_created_by_id_fkey'), sa.ForeignKeyConstraint(['modified_by_id'], [u'users.id'], name=u'pages_modified_by_id_fkey'), sa.PrimaryKeyConstraint('id', name=u'pages_pkey') ) op.add_column('menus_items', sa.Column('is_public', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('roles', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('ts', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('page_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('is_group_label', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.add_column('menus_items', sa.Column('created_by_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.create_foreign_key(u'menus_items_page_id_fkey', 'menus_items', 'pages', ['page_id'], ['id']) op.create_foreign_key(u'menus_items_created_by_id_fkey', 'menus_items', 'users', ['created_by_id'], ['id']) op.add_column('menus', sa.Column('ts', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.add_column('menus', sa.Column('created_by_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.create_foreign_key(u'menus_created_by_id_fkey', 'menus', 'users', ['created_by_id'], ['id']) op.drop_table('menuitem_roles') ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('password', sa.VARCHAR(), autoincrement=False, nullable=False)) ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('languages', sa.Column('name', sa.VARCHAR(length=30), autoincrement=False, nullable=True)) # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('File', sa.Column('extension', sa.VARCHAR(), autoincrement=False, nullable=True)) # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('User', sa.Column('username', sa.Unicode(), nullable=False)) op.alter_column('User', 'email', existing_type=sa.VARCHAR(), nullable=False) op.create_index(op.f('ix_User_username'), 'User', ['username'], unique=True) op.drop_constraint('User_email_key', 'User', type_='unique') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_unique_constraint('User_email_key', 'User', ['email']) op.drop_index(op.f('ix_User_username'), table_name='User') op.alter_column('User', 'email', existing_type=sa.VARCHAR(), nullable=True) op.drop_column('User', 'username') # ### end Alembic commands ###