我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用sqlalchemy.String()。
def info_table(base): class Info(base): __tablename__ = 'Info' id_ = Column(Integer, Sequence('trigger_id_seq'), primary_key=True) run_id=Column(String, nullable=False) name=Column(String, nullable=False) value=Column(String, nullable=True) __table_args__ = ( UniqueConstraint('run_id', 'name'), ) def __repr__(self): return "<Info(run_id='%s', name='%s', value='%s')>" % (self.run_id, self.name, self.value) return Info
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('topic_suggestion', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('title', sa.String(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('is_recorded', sa.Boolean(), nullable=False), sa.Column('podcast_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['podcast_id'], ['podcast.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_topic_suggestion_id'), 'topic_suggestion', ['id'], unique=False) op.create_index(op.f('ix_topic_suggestion_title'), 'topic_suggestion', ['title'], unique=False) op.create_index(op.f('ix_episode_id'), 'episode', ['id'], unique=False) op.create_index(op.f('ix_podcast_id'), 'podcast', ['id'], unique=False) op.create_index(op.f('ix_popular_term_id'), 'popular_term', ['id'], unique=False) op.create_index(op.f('ix_tag_id'), 'tag', ['id'], unique=False) ### end Alembic commands ###
def upgrade(): op.add_column('container', sa.Column('cpu', sa.Float(), nullable=True)) op.add_column('container', sa.Column('workdir', sa.String(length=255), nullable=True)) op.add_column('container', sa.Column('ports', zun.db.sqlalchemy.models.JSONEncodedList(), nullable=True)) op.add_column('container', sa.Column('hostname', sa.String(length=255), nullable=True)) op.add_column('container', sa.Column('labels', zun.db.sqlalchemy.models.JSONEncodedDict(), nullable=True))
def upgrade(): bind = op.get_bind() session = Session(bind=bind) ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('timezone', sa.String(length=64), server_default='UTC', nullable=False)) ### end Alembic commands ### key = 'timezone' for user in session.query(User): settings = json.loads(user.settings) if user.settings else {} if key in settings: user.timezone = settings[key] del settings[key] user.settings = json.dumps(settings) else: user.timezone = DEFAULT_TIMEZONE session.commit()
def define_tables(cls, metadata): Table('autoinc_pk', metadata, Column('id', Integer, primary_key=True, test_needs_autoincrement=True), Column('data', String(50)) ) Table('manual_pk', metadata, Column('id', Integer, primary_key=True, autoincrement=False), Column('data', String(50)) ) Table('includes_defaults', metadata, Column('id', Integer, primary_key=True, test_needs_autoincrement=True), Column('data', String(50)), Column('x', Integer, default=5), Column('y', Integer, default=literal_column("2", type_=Integer) + literal(2)))
def upgrade(): op.create_table( 'accelerators', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Integer(), nullable=False), sa.Column('uuid', sa.String(length=36), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('project_id', sa.String(length=36), nullable=True), sa.Column('user_id', sa.String(length=36), nullable=True), sa.Column('device_type', sa.Text(), nullable=False), sa.Column('acc_type', sa.Text(), nullable=False), sa.Column('acc_capability', sa.Text(), nullable=False), sa.Column('vendor_id', sa.Text(), nullable=False), sa.Column('product_id', sa.Text(), nullable=False), sa.Column('remotable', sa.Integer(), nullable=False), sa.PrimaryKeyConstraint('id'), mysql_ENGINE='InnoDB', mysql_DEFAULT_CHARSET='UTF8' )
def _get_field_value(column): """Get field value for resource creating returning None indicates that not setting this field in resource dict """ if column.nullable: # just skip nullable column return None if isinstance(column.type, sql.Text): return 'fake_text' elif isinstance(column.type, sql.Enum): return column.type.enums[0] elif isinstance(column.type, sql.String): return 'fake_str' elif isinstance(column.type, sql.Integer): return 1 elif isinstance(column.type, sql.Float): return 1.0 elif isinstance(column.type, sql.Boolean): return True elif isinstance(column.type, sql.DateTime): return datetime.datetime.utcnow() else: return None
def get_report_urls(self, report='', from_date='', to_date=''): # String: url by report name and dates if not (report or from_date or to_date): return False urls = [] if self.app_id: app_ids = self.app_id.split(',') for app_id in app_ids: if app_id: urls.append( self.url_pat.format( app_id=app_id, api_token=self.api_token, report=report, from_date=from_date, to_date=to_date ) ) return urls
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('bit_facebook_daily_ad_insights_impression_device', sa.Column('id', sa.Integer(), nullable=False), sa.Column('account_id', sa.String(length=255), nullable=True), sa.Column('campaign_id', sa.String(length=255), nullable=True), sa.Column('adset_id', sa.String(length=255), nullable=True), sa.Column('campaign_name', sa.String(length=255), nullable=True), sa.Column('spend', sa.Numeric(), nullable=True), sa.Column('cost_per_unique_click', sa.Numeric(), nullable=True), sa.Column('unique_clicks', sa.Integer(), nullable=True), sa.Column('unique_impressions', sa.Integer(), nullable=True), sa.Column('unique_social_clicks', sa.Integer(), nullable=True), sa.Column('unique_social_impressions', sa.Integer(), nullable=True), sa.Column('website_clicks', sa.Integer(), nullable=True), sa.Column('date_start', sa.DateTime(), nullable=True), sa.Column('date_stop', sa.DateTime(), nullable=True), sa.Column('impression_device', sa.String(length=255), nullable=True), sa.Column('ad_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['ad_id'], ['bit_facebook_ad.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_bit_facebook_daily_ad_insights_impression_device_impression_device'), 'bit_facebook_daily_ad_insights_impression_device', ['impression_device'], unique=False) # ### end Alembic commands ###
def _gen_sa_table(sectype, metadata=None): """Generate SQLAlchemy Table object by sectype. """ if metadata is None: metadata = MetaData() table = Table( sectype, metadata, Column('Symbol', String(20), primary_key=True), Column('DataType', String(20), primary_key=True), Column('BarSize', String(10), primary_key=True), Column('TickerTime', DateTime(), primary_key=True), Column('opening', Float(10, 2)), Column('high', Float(10, 2)), Column('low', Float(10, 2)), Column('closing', Float(10, 2)), Column('volume', mysqlINTEGER(unsigned=True)), Column('barcount', mysqlINTEGER(unsigned=True)), Column('average', Float(10, 2)) ) return table
def trigger_table(base): class Trigger(base): __tablename__ = 'Trigger' id_ = Column(Integer, Sequence('trigger_id_seq'), primary_key=True) run_id = Column(String, nullable=False, default='') event_id = Column(String, nullable=False) sequence = Column(Integer, nullable=False) recovery = Column(Integer, nullable=False, default=0) created = Column(DateTime(), default=datetime.utcnow) acted = Column(DateTime(), nullable=True) def __repr__(self): return "<Trigger(id='%s', run_id='%s', event_id='%s', sequence='%s', recovery='%s', created='%s', acted='%s')>" % ( self.id_, self.run_id, self.event_id, self.sequence, self.recovery, self.created, self.acted) return Trigger
def task_table(base): class Task(base): __tablename__ = 'Task' id_ = Column(Integer, Sequence('task_id_seq'), primary_key=True) run_id = Column(String, default='') step_id = Column(String,) sequence = Column(Integer,) recovery = Column(Integer, nullable=False) pid = Column(Integer, nullable=True) status = Column(SQLEnum(TaskStatus), ) result = Column(PickleType() , nullable=True,) created = Column(DateTime(), default=datetime.utcnow) updated = Column(DateTime(), nullable=True, ) __table_args__ = ( UniqueConstraint('run_id', 'step_id', 'sequence', 'recovery'), ) def __repr__(self): return "<Task(id='%s', run_id='%s', step_id='%s', sequence='%s', recovery='%s', pid='%s', status='%s', created='%s', updated='%s')>" % ( self.id_, self.run_id, self.step_id, self.sequence, self.recovery, self.pid, self.status, self.created, self.updated) return Task
def delay_table(base): class Delay(base): __tablename__ = 'Delay' id_=Column(Integer, Sequence('delay_id_seq'), primary_key=True) run_id = Column(String, default='') delay_id = Column(String,) sequence = Column(Integer,) recovery = Column(Integer,) seconds = Column(BigInteger, nullable=True) active = Column(Boolean, default=False) activated = Column(DateTime(), nullable=True,) updated = Column(DateTime(), default=datetime.utcnow) __table_args__ = ( UniqueConstraint('run_id', 'delay_id', 'sequence', 'recovery'), ) def __repr__(self): return "<Delay(id='%s', run_id='%s', delay_id='%s', delay='%s', active='%s', activated='%s')>" % ( self.id_, self.run_id, self.delay_id, self.seconds, self.active, self.activated) return Delay
def init_tables(): db_instance = Table("instance", dbmeta, Column("id", Integer, primary_key=True), Column("ip", String(20)), Column("name", String(90)), Column("uuid", String(40)), Column("state", String(90)), Column("dns_domain", String(90)), Column("created_at", DateTime), Column("updated_at", DateTime), Column("deleted_at", DateTime) ) db_event = Table("event", dbmeta, #will be used for synchronization Column("id", Integer, primary_key=True), Column("fk_instance_id", Integer, ForeignKey("instance.id")), Column("type", String(24)),#enum Column("description", String(90)), Column("date", DateTime) ) dbmeta.drop_all(dbengine) dbmeta.create_all(dbengine)
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('default', sa.Boolean(), nullable=True), sa.Column('permissions', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False) op.create_table('users', sa.Column('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=164), nullable=True), sa.Column('email', sa.String(length=164), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), sa.Column('password_hash', sa.String(length=164), nullable=True), sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True) ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('episode', sa.Column('id', sa.Integer(), nullable=False), sa.Column('title', sa.String(), nullable=False), sa.Column('link', sa.String(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('published', sa.DateTime(), nullable=True), sa.Column('enclosure', sa.String(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('podcast_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['podcast_id'], ['podcast.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('link'), sa.UniqueConstraint('title') ) op.create_index(op.f('ix_podcast_feed'), 'podcast', ['feed'], unique=True) op.create_index(op.f('ix_podcast_name'), 'podcast', ['name'], unique=True) ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('role', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=80), nullable=True), sa.Column('description', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('user', sa.Column('id', sa.Integer(), nullable=False), sa.Column('email', sa.String(length=255), nullable=True), sa.Column('active', sa.Boolean(), nullable=True), sa.Column('confirmed_at', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email') ) op.create_table('roles_users', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['role_id'], ['role.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ) ) ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('hot_books', sa.Column('book_id', sa.Integer(), nullable=False), sa.Column('book_author', sa.Text(), nullable=True), sa.Column('book_cover', sa.Text(), nullable=True), sa.Column('book_rate', sa.Integer(), nullable=True), sa.Column('book_content', sa.Text(), nullable=True), sa.Column('book_publish', sa.Text(), nullable=True), sa.Column('book_last_number', sa.Integer(), nullable=True), sa.Column('book_key', sa.String(length=13), nullable=True), sa.Column('book_db_id', sa.Integer(), nullable=True), sa.Column('book_title', sa.Text(), nullable=True), sa.Column('book_place', sa.Text(), nullable=True), sa.Column('detail_data', sa.Text(), nullable=True), sa.Column('hot_id', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('book_id'), sa.UniqueConstraint('book_db_id') ) op.create_index(op.f('ix_hot_books_book_key'), 'hot_books', ['book_key'], unique=False) # ### end Alembic commands ###
def upgrade(): op.create_table( 'volume_mapping', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Integer(), nullable=False), sa.Column('uuid', sa.String(36), nullable=False), sa.Column('project_id', sa.String(length=255), nullable=True), sa.Column('user_id', sa.String(length=255), nullable=True), sa.Column('volume_id', sa.String(36), nullable=False), sa.Column('volume_provider', sa.String(36), nullable=False), sa.Column('container_uuid', sa.String(36), nullable=False), sa.Column('container_path', sa.String(length=255), nullable=True), sa.Column('connection_info', MediumText(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uuid', name='uniq_volume0uuid'), )
def upgrade(): op.create_table( 'container_actions_events', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Integer(), nullable=False), sa.Column('event', sa.String(length=255), nullable=True), sa.Column('action_id', sa.Integer(), nullable=False), sa.Column('start_time', sa.DateTime(), nullable=True), sa.Column('finish_time', sa.DateTime(), nullable=True), sa.Column('result', sa.String(length=255), nullable=True), sa.Column('traceback', sa.Text(), nullable=True), sa.Column('details', sa.Text(), nullable=True), sa.ForeignKeyConstraint(['action_id'], ['container_actions.id'], ), sa.PrimaryKeyConstraint('id') )
def upgrade(): op.create_table( 'container', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Integer(), nullable=False), sa.Column('project_id', sa.String(length=255), nullable=True), sa.Column('user_id', sa.String(length=255), nullable=True), sa.Column('uuid', sa.String(length=36), nullable=True), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('image', sa.String(length=255), nullable=True), sa.Column('command', sa.String(length=255), nullable=True), sa.Column('status', sa.String(length=20), nullable=True), sa.Column('environment', zun.db.sqlalchemy.models.JSONEncodedDict(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uuid', name='uniq_container0uuid') )
def upgrade(): # commands auto generated by Alembic - please adjust! # op.create_table( 'image', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('id', sa.Integer(), nullable=False), sa.Column('project_id', sa.String(length=255), nullable=True), sa.Column('user_id', sa.String(length=255), nullable=True), sa.Column('uuid', sa.String(length=36), nullable=True), sa.Column('image_id', sa.String(length=255), nullable=True), sa.Column('repo', sa.String(length=255), nullable=True), sa.Column('tag', sa.String(length=255), nullable=True), sa.Column('size', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('repo', 'tag', name='uniq_image0repotag'), mysql_charset='utf8', mysql_engine='InnoDB' ) # end Alembic commands #
def upgrade(): op.create_table( 'capsule', sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('capsule_version', sa.String(length=255), nullable=True), sa.Column('kind', sa.String(length=36), nullable=True), sa.Column('project_id', sa.String(length=255), nullable=True), sa.Column('user_id', sa.String(length=255), nullable=True), sa.Column('restart_policy', sa.String(length=255), nullable=True), sa.Column('host_selector', sa.String(length=255), nullable=True), sa.Column('id', sa.Integer(), nullable=False), sa.Column('uuid', sa.String(length=36), nullable=False), sa.Column('status', sa.String(length=255), nullable=True), sa.Column('status_reason', sa.Text(), nullable=True), sa.Column('message', models.JSONEncodedDict(), nullable=True), sa.Column('spec', models.JSONEncodedDict(), nullable=True), sa.Column('cpu', sa.Float(), nullable=True), sa.Column('memory', sa.String(length=255), nullable=True), sa.Column('meta_name', sa.String(length=255), nullable=True), sa.Column('meta_labels', models.JSONEncodedList(), nullable=True), sa.Column('containers_uuids', models.JSONEncodedList(), nullable=True), sa.PrimaryKeyConstraint('id'), )
def upgrade(): op.create_table( 'zun_service', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('report_count', sa.Integer(), nullable=False), sa.Column('host', sa.String(length=255), nullable=True), sa.Column('binary', sa.String(length=255), nullable=True), sa.Column('disabled', sa.Boolean(), nullable=True), sa.Column('disabled_reason', sa.String(length=255), nullable=True), sa.Column('last_seen_up', sa.DateTime(), nullable=True), sa.Column('forced_down', sa.Boolean(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('host', 'binary', name='uniq_zun_service0host0binary') )
def _init_cls(cls): setattr(cls, '__tablename__', cls.__name__) setattr(cls, 'id', Column(Integer, primary_key=True, autoincrement=True)) for _str in getattr(cls, 'stringV', []): setattr(cls, _str, Column(String(DB_STRING_LENGTH))) for _int in getattr(cls, 'integerV', []): setattr(cls, _int, Column(Integer)) for _bool in getattr(cls, 'boolV', []): setattr(cls, _bool, Column(Boolean)) for _float in getattr(cls, 'floatV', []): setattr(cls, _float, Column(Float)) for _time in getattr(cls, 'timeV', []): setattr(cls, _time, Column(DateTime, default=datetime.utcnow)) for key, value in getattr(cls, 'foreignKeyV', {}).iteritems(): setattr(cls, key, Column(Integer, ForeignKey(value), primary_key=True)) setattr(cls, 'to_json', _convert_attr_to_dict)
def upgrade(): op.create_table( 'apps', sa.Column('id', sa.String(255), nullable=False), sa.Column('project_id', sa.String(255), nullable=False), sa.Column('description', sa.String(255), nullable=True), sa.Column('created_at', sa.String(255)), sa.Column('updated_at', sa.String(255)), sa.Column('name', sa.String(255), nullable=False, primary_key=True), ) op.create_table( 'routes', sa.Column('project_id', sa.String(255), nullable=False), sa.Column('path', sa.String(255), nullable=False, primary_key=True), sa.Column('is_public', sa.Boolean(create_constraint=False), nullable=False), sa.Column('app_name', sa.String(255), nullable=False, primary_key=True), sa.Column('created_at', sa.String(255), nullable=False), sa.Column('updated_at', sa.String(255), nullable=False), )
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('users', sa.Column('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=64), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index('ix_users_username', 'users', ['username'], unique=True) ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('users', sa.Column('id', sa.Integer(), nullable=False), sa.Column('email', sa.String(length=64), nullable=True), sa.Column('username', sa.String(length=64), nullable=True), sa.Column('password_hash', sa.String(length=128), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), sa.Column('confirmed', sa.Boolean(), nullable=True), sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True) op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True) op.drop_table('Products') ### end Alembic commands ###
def upgrade(): op.create_table('mastodon_instances', sa.Column('instance', sa.String(), nullable=False), sa.Column('popularity', sa.Float(), server_default='10', nullable=False), sa.PrimaryKeyConstraint('instance', name=op.f('pk_mastodon_instances')) ) op.execute(""" INSERT INTO mastodon_instances (instance, popularity) VALUES ('mastodon.social', 100), ('mastodon.cloud', 90), ('social.tchncs.de', 80), ('mastodon.xyz', 70), ('mstdn.io', 60), ('awoo.space', 50), ('cybre.space', 40), ('mastodon.art', 30) ; """)
def upgrade(): op.create_table('pd_states', sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('pd_name', sa.String(), nullable=False), sa.Column('size', sa.Integer(), nullable=False), sa.Column('start_time', sa.DateTime(), nullable=False), sa.Column('end_time', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id']), sa.PrimaryKeyConstraint('start_time')) op.create_table('ip_states', sa.Column('pod_id', postgresql.UUID(), nullable=False), sa.Column('ip_address', sa.BigInteger(), nullable=False), sa.Column('start_time', sa.DateTime(), nullable=False), sa.Column('end_time', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['pod_id'], ['pods.id']), sa.PrimaryKeyConstraint('pod_id', 'start_time'))
def upgrade(): table_prefix = context.config.get_main_option('table_prefix') op.create_table( table_prefix + 'repos', sa.Column('id', sa.Integer(), nullable=False, primary_key=True), sa.Column('repo_name', sa.Unicode(100), nullable=False), sa.Column('env_id', sa.Integer(), nullable=False), sa.Column('git_url', sa.String(255), server_default='', nullable=False), sa.Column('ref', sa.String(255), server_default='', nullable=False), sa.Column('user_key', sa.String(255), server_default='', nullable=False), sa.UniqueConstraint('env_id', name='_env_id_unique'))
def upgrade(): table_prefix = context.config.get_main_option('table_prefix') op.add_column( table_prefix + 'changes_whitelist', sa.Column('fuel_task', sa.String, server_default='', nullable=False) )
def upgrade(): table_prefix = context.config.get_main_option('table_prefix') op.create_unique_constraint('_repo_name_unique', table_prefix + 'repos', ['repo_name']) op.alter_column(table_prefix + 'repos', 'user_key', type_=sa.UnicodeText(), existing_type=sa.String(255))
def downgrade(): table_prefix = context.config.get_main_option('table_prefix') op.drop_constraint('_repo_name_unique', table_prefix + 'repos') op.alter_column(table_prefix + 'repos', 'user_key', existing_type=sa.UnicodeText(), type_=sa.String(255))
def upgrade(): table_prefix = context.config.get_main_option('table_prefix') op.create_table( table_prefix + 'changes_whitelist', sa.Column('id', sa.Integer(), nullable=False, primary_key=True), sa.Column('env_id', sa.Integer(), nullable=False), sa.Column('rule', sa.String(255), server_default='', nullable=False) )
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('users', sa.Column('id', sa.String(length=100), nullable=False), sa.Column('username', sa.String(length=100), nullable=False), sa.Column('telephone', sa.String(length=11), nullable=False), sa.Column('_password', sa.String(length=100), nullable=False), sa.PrimaryKeyConstraint('id') ) op.create_table('questions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('title', sa.String(length=100), nullable=False), sa.Column('content', sa.Text(), nullable=False), sa.Column('author_id', sa.String(length=100), nullable=True), sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('answers', sa.Column('id', sa.Integer(), nullable=False), sa.Column('content', sa.Text(), nullable=False), sa.Column('question_id', sa.Integer(), nullable=True), sa.Column('author_id', sa.String(length=100), nullable=True), sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), sa.ForeignKeyConstraint(['question_id'], ['questions.id'], ), sa.PrimaryKeyConstraint('id') ) # ### end Alembic commands ###
def define_tables(cls, metadata): Table('plain_pk', metadata, Column('id', Integer, primary_key=True), Column('data', String(50)) )
def define_tables(cls, metadata): Table("some_table", metadata, Column('id', Integer, primary_key=True), Column('x', Integer), Column('y', Integer), Column('q', String(50)), Column('p', String(50)) )
def define_tables(cls, metadata): Table('test_table', metadata, Column('id', Integer, primary_key=True), Column('data', String(50)) )
def define_tables(cls, metadata): Table('autoinc_pk', metadata, Column('id', Integer, primary_key=True, test_needs_autoincrement=True), Column('data', String(50)) ) Table('manual_pk', metadata, Column('id', Integer, primary_key=True, autoincrement=False), Column('data', String(50)) )
def define_tables(cls, metadata): Table('autoinc_pk', metadata, Column('id', Integer, primary_key=True, test_needs_autoincrement=True), Column('data', String(50)) )
def _simple_fixture(self): return Table('test_table', self.metadata, Column('id', Integer, primary_key=True, autoincrement=False), Column('data', String(50)) )
def define_tables(cls, metadata): Table('manual_pk', metadata, Column('id', Integer, primary_key=True, autoincrement=False), Column('data', String(50)) )
def define_tables(cls, metadata): Table('plain_pk', metadata, Column('id', Integer, primary_key=True), Column('data', String(50)) ) Table('has_dates', metadata, Column('id', Integer, primary_key=True), Column('today', DateTime) )
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('named_tag', sa.Column('file_regexp', sa.String(length=200), nullable=True)) # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('user', 'email', existing_type=mysql.VARCHAR(length=255), type_=sa.String(length=75), existing_nullable=False) # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('user', 'email', existing_type=sa.String(length=75), type_=mysql.VARCHAR(length=255), existing_nullable=False) # ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('subscription', sa.Column('end_point', sa.String(length=250), nullable=True)) ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('result', sa.Column('profile_description', sa.String(length=250), nullable=True)) ### end Alembic commands ###