Python sqlalchemy.dialects.postgresql 模块,TIMESTAMP 实例源码

我们从Python开源项目中,提取了以下26个代码示例,用于说明如何使用sqlalchemy.dialects.postgresql.TIMESTAMP

项目:FlaskBackend    作者:iamrajhans    | 项目源码 | 文件源码
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 ###
项目:fabric8-analytics-server    作者:fabric8-analytics    | 项目源码 | 文件源码
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 ###
项目:fabric8-analytics-server    作者:fabric8-analytics    | 项目源码 | 文件源码
def downgrade():
    """Downgrade the database to an older revision."""
    # # commands auto generated by Alembic - please adjust! ###
    op.create_table('batches_versions',
                    sa.Column('version_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('batch_token', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False),
                    sa.ForeignKeyConstraint(['batch_token'], ['batch.token'],
                                            name='batches_versions_batch_token_fkey'),
                    sa.ForeignKeyConstraint(['version_id'], ['versions.id'],
                                            name='batches_versions_version_id_fkey'))
    op.create_table('batch',
                    sa.Column('token', sa.INTEGER(), nullable=False),
                    sa.Column('started_at', postgresql.TIMESTAMP(), autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('token', name='batch_pkey'))
    # # end Alembic commands ###
项目:hreftoday    作者:soasme    | 项目源码 | 文件源码
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 ###
项目:fabric8-analytics-worker    作者:fabric8-analytics    | 项目源码 | 文件源码
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 ###
项目:fabric8-analytics-worker    作者:fabric8-analytics    | 项目源码 | 文件源码
def downgrade():
    """Downgrade the database to an older revision."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('batches_versions',
                    sa.Column('version_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('batch_token', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False),
                    sa.ForeignKeyConstraint(['batch_token'], ['batch.token'],
                                            name='batches_versions_batch_token_fkey'),
                    sa.ForeignKeyConstraint(['version_id'], ['versions.id'],
                                            name='batches_versions_version_id_fkey'))
    op.create_table('batch',
                    sa.Column('token', sa.INTEGER(), nullable=False),
                    sa.Column('started_at', postgresql.TIMESTAMP(), autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('token', name='batch_pkey'))
    # ### end Alembic commands ###
项目:gloss    作者:openhealthcare    | 项目源码 | 文件源码
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 ###
项目:FRG-Crowdsourcing    作者:97amarnathk    | 项目源码 | 文件源码
def upgrade():
    op.create_table('counter',
                    sa.Column('id', sa.Integer, primary_key=True),
                    sa.Column('created', TIMESTAMP),
                    sa.Column('project_id', sa.Integer, 
                              sa.ForeignKey('project.id',
                                            ondelete='CASCADE'),
                              nullable=False),
                    sa.Column('task_id', sa.Integer,
                              sa.ForeignKey('task.id',
                                            ondelete='CASCADE'),
                              nullable=False),
                    sa.Column('n_task_runs', sa.Integer,
                              default=0, nullable=False),
                    )
项目:FRG-Crowdsourcing    作者:97amarnathk    | 项目源码 | 文件源码
def upgrade():
    op.create_table('helpingmaterial',
                    sa.Column('id', sa.Integer,
                              primary_key=True),
                    sa.Column('project_id', sa.Integer,
                              sa.ForeignKey('project.id',
                                            ondelete='CASCADE'),
                              nullable=False),
                    sa.Column('created', TIMESTAMP,
                              default=make_timestamp),
                    sa.Column('info', JSON, nullable=False),
                    sa.Column('media_url', sa.Text),
                    )
项目:bit    作者:codesmart-co    | 项目源码 | 文件源码
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 ###
项目:podigger    作者:perna    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('role',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('role_id_seq'::regclass)"), nullable=False),
    sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True),
    sa.Column('description', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='role_pkey'),
    sa.UniqueConstraint('name', name='role_name_key'),
    postgresql_ignore_search_path=False
    )
    op.create_table('user',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('user_id_seq'::regclass)"), nullable=False),
    sa.Column('email', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.Column('active', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('confirmed_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('password', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='user_pkey'),
    sa.UniqueConstraint('email', name='user_email_key'),
    postgresql_ignore_search_path=False
    )
    op.create_table('roles_users',
    sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('role_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['role.id'], name='roles_users_role_id_fkey'),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], name='roles_users_user_id_fkey')
    )
    ### end Alembic commands ###
项目:forget    作者:codl    | 项目源码 | 文件源码
def downgrade():
    op.add_column('accounts', sa.Column('last_delete', postgresql.TIMESTAMP(), server_default=sa.text("'1970-01-01 00:00:00'::timestamp without time zone"), autoincrement=False, nullable=True))
    op.execute('UPDATE accounts SET last__delete = next_delete - policy_delete_every;')
    op.create_index('ix_accounts_last_delete', 'accounts', ['last_delete'], unique=False)
    op.drop_index(op.f('ix_accounts_next_delete'), table_name='accounts')
    op.drop_column('accounts', 'next_delete')
项目:kuberdock-platform    作者:cloudlinux    | 项目源码 | 文件源码
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 ###
项目:FlaskBackend    作者:iamrajhans    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('request_referral',
    sa.Column('id', sa.String(length=255), nullable=False),
    sa.Column('user_id', sa.String(length=100), nullable=True),
    sa.Column('from_user', sa.String(length=255), nullable=False),
    sa.Column('to_user', sa.String(length=255), nullable=False),
    sa.Column('request_type', sa.String(length=255), nullable=False),
    sa.Column('referral_id', sa.String(length=255), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(), nullable=True),
    sa.Column('updated_at', sa.TIMESTAMP(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.alter_column(u'users', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False)
    op.alter_column(u'users', 'email',
               existing_type=sa.VARCHAR(length=150),
               nullable=False)
    op.alter_column(u'users', 'last_name',
               existing_type=sa.VARCHAR(length=200),
               nullable=False)
    op.alter_column(u'users', 'name',
               existing_type=sa.VARCHAR(length=100),
               nullable=False)
    op.alter_column(u'users', 'updated_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False)
    op.alter_column(u'users', 'user_id',
               existing_type=sa.VARCHAR(length=100),
               nullable=False)
    ### end Alembic commands ###
项目:fabric8-analytics-server    作者:fabric8-analytics    | 项目源码 | 文件源码
def downgrade():
    """Downgrade the database to an older revision."""
    # commands auto generated by Alembic - please adjust! ###
    op.add_column('stack_analyses_request', sa.Column('startTime', postgresql.TIMESTAMP(),
                  autoincrement=False, nullable=True))
    op.add_column('stack_analyses_request', sa.Column('endTime', postgresql.TIMESTAMP(),
                  autoincrement=False, nullable=True))
    # end Alembic commands ###
项目:fabric8-analytics-server    作者:fabric8-analytics    | 项目源码 | 文件源码
def downgrade():
    """Downgrade the database to an older revision."""
    # commands auto generated by Alembic - please adjust! ###
    op.create_table('review',
                    sa.Column('id', sa.INTEGER(), nullable=False),
                    sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=True),
                    sa.Column('user', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False,
                              nullable=True),
                    sa.Column('comment', sa.TEXT(), autoincrement=False, nullable=True),
                    sa.Column('epv', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
                    sa.ForeignKeyConstraint(['user'], ['user.id'], name='review_user_fkey'),
                    sa.PrimaryKeyConstraint('id', name='review_pkey'))
    # end Alembic commands ###
项目:pygameweb    作者:pygame    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_index('public_tags_value1_idx', 'tags', ['value'], unique=False)
    op.create_index('public_tags_project_id0_idx', 'tags', ['project_id'], unique=False)
    op.drop_index(op.f('ix_tags_value'), table_name='tags')
    op.drop_index(op.f('ix_tags_project_id'), table_name='tags')
    op.create_table('wikicomment',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('link', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.Column('users_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('datetimeon', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('content', sa.TEXT(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='wikicomment_pkey')
    )
    ### end Alembic commands ###
项目:pygameweb    作者:pygame    | 项目源码 | 文件源码
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('queue',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('enqueued_at', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
    sa.Column('dequeued_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('expected_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('schedule_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('q_name', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('data', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('priority_idx', 'queue', ['schedule_at', 'expected_at'], unique=False)
    # ### end Alembic commands ###
项目:hreftoday    作者:soasme    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('topic',
    sa.Column('id', sa.INTEGER(), server_default=sa.text(u"nextval('topic_id_seq'::regclass)"), nullable=False),
    sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('title', sa.VARCHAR(length=128), autoincrement=False, nullable=False),
    sa.Column('description', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('is_deleted', sa.BOOLEAN(), server_default=sa.text(u'false'), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'fk_topic_user'),
    sa.PrimaryKeyConstraint('id', name=u'topic_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('topic_follow',
    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('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['topic_id'], [u'topic.id'], name=u'fk_topic_follow_topic'),
    sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'fk_topic_follow_user'),
    sa.PrimaryKeyConstraint('id', name=u'topic_follow_pkey'),
    sa.UniqueConstraint('topic_id', 'user_id', name=u'ux_topic_follow_user_follow_topic')
    )
    op.add_column('link', sa.Column('topic_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.create_foreign_key(u'fk_link_topic', 'link', 'topic', ['topic_id'], ['id'])
    ### end Alembic commands ###
项目:fabric8-analytics-worker    作者:fabric8-analytics    | 项目源码 | 文件源码
def downgrade():
    """Downgrade the database to an older revision."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('stack_analyses_request', sa.Column('startTime', postgresql.TIMESTAMP(),
                  autoincrement=False, nullable=True))
    op.add_column('stack_analyses_request', sa.Column('endTime', postgresql.TIMESTAMP(),
                  autoincrement=False, nullable=True))
    # ### end Alembic commands ###
项目:fabric8-analytics-worker    作者:fabric8-analytics    | 项目源码 | 文件源码
def downgrade():
    """Downgrade the database to an older revision."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('review',
                    sa.Column('id', sa.INTEGER(), nullable=False),
                    sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=True),
                    sa.Column('user', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False,
                              nullable=True),
                    sa.Column('comment', sa.TEXT(), autoincrement=False, nullable=True),
                    sa.Column('epv', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
                    sa.ForeignKeyConstraint(['user'], ['user.id'], name='review_user_fkey'),
                    sa.PrimaryKeyConstraint('id', name='review_pkey'))
    # ### end Alembic commands ###
项目:pgawedge    作者:portfoliome    | 项目源码 | 文件源码
def test_non_default_value(self):
            expected = [('timezone', True)]
            result = list(get_type_attributes(TIMESTAMP(timezone=True)))

            self.assertEqual(expected, result)
项目:heroku-python-boilerplate    作者:chavli    | 项目源码 | 文件源码
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute(CreateSequence(Sequence("endpoint_log_id_seq")))
    op.execute(CreateSequence(Sequence("session_token_id_seq")))
    op.execute(CreateSequence(Sequence("system_log_id_seq")))
    op.execute(CreateSequence(Sequence("user_account_id_seq")))

    op.create_table('endpoint_log',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('endpoint_log_id_seq')"), nullable=False),
    sa.Column('start_utc', postgresql.TIMESTAMP(), nullable=False),
    sa.Column('duration_ms', sa.INTEGER(), nullable=False),
    sa.Column('endpoint', sa.TEXT(), nullable=True),
    sa.Column('username', sa.TEXT(), nullable=True),
    sa.Column('method', sa.TEXT(), nullable=True),
    sa.Column('http_code', sa.TEXT(), nullable=True),
    sa.Column('error_message', sa.TEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('session_token',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('session_token_id_seq')"), nullable=False),
    sa.Column('user_id', sa.TEXT(), nullable=True),
    sa.Column('token', sa.TEXT(), nullable=True),
    sa.Column('created_utc', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('system_log',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('system_log_id_seq')"), nullable=False),
    sa.Column('event_utc', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
    sa.Column('level', sa.TEXT(), nullable=True),
    sa.Column('message', sa.TEXT(), nullable=True),
    sa.Column('source', sa.TEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user_account',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('user_account_id_seq')"), nullable=False),
    sa.Column('user_id', sa.TEXT(), nullable=True),
    sa.Column('email', sa.TEXT(), nullable=True),
    sa.Column('secret', sa.TEXT(), nullable=True),
    sa.Column('creation_utc', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
    sa.Column('last_updated_utc', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###
项目:backend    作者:deinfoxication    | 项目源码 | 文件源码
def upgrade():
    """Upgrade instructions."""
    op.execute('CREATE EXTENSION IF NOT EXISTS "uuid-ossp"')
    op.create_table(
        'feed',
        sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
        sa.Column('name', sa.Unicode(), nullable=True),
        sa.Column('url', sa.Unicode(), nullable=False),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_feed')),
        sa.UniqueConstraint('url', name=op.f('uq_feed_url'))
    )
    op.create_table(
        'user',
        sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
        sa.Column('email', sa.Unicode(), nullable=False),
        sa.Column('password', sa.Unicode(), nullable=False),
        sa.Column('name', sa.Unicode(), nullable=False),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_user')),
        sa.UniqueConstraint('email', name=op.f('uq_user_email'))
    )
    op.create_table(
        'article',
        sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
        sa.Column('feed_id', postgresql.UUID(), nullable=False),
        sa.Column('title', sa.Unicode(), nullable=False),
        sa.Column('url', sa.Unicode(), nullable=False),
        sa.Column('html_text', sa.Unicode(), nullable=False),
        sa.Column('clean_text', sa.Unicode(), nullable=False),
        sa.Column('publication_date', postgresql.TIMESTAMP(timezone='UTC'), nullable=False),
        sa.ForeignKeyConstraint(['feed_id'], ['feed.id'], name=op.f('fk_article_feed_id_feed')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_article'))
    )
    op.create_table(
        'subscription',
        sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
        sa.Column('user_id', postgresql.UUID(), nullable=False),
        sa.Column('feed_id', postgresql.UUID(), nullable=False),
        sa.ForeignKeyConstraint(['feed_id'], ['feed.id'], name=op.f('fk_subscription_feed_id_feed')),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_subscription_user_id_user')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_subscription'))
    )
    op.create_table(
        'rating',
        sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
        sa.Column('user_id', postgresql.UUID(), nullable=False),
        sa.Column('article_id', postgresql.UUID(), nullable=False),
        sa.Column('feed_id', postgresql.UUID(), nullable=False),
        sa.Column('user_rating', sa.DECIMAL(precision=4, scale=2), nullable=True),
        sa.Column('machine_rating', sa.DECIMAL(precision=4, scale=2), nullable=True),
        sa.Column('read', sa.Boolean(), server_default=sa.text('FALSE'), nullable=False),
        sa.ForeignKeyConstraint(['article_id'], ['article.id'], name=op.f('fk_rating_article_id_article')),
        sa.ForeignKeyConstraint(['feed_id'], ['feed.id'], name=op.f('fk_rating_feed_id_feed')),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_rating_user_id_user')),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_rating'))
    )
项目:fabric8-analytics-worker    作者:fabric8-analytics    | 项目源码 | 文件源码
def downgrade():
    """Downgrade the database to an older revision."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('role',
                    sa.Column('id', sa.INTEGER(),
                              server_default=sa.text("nextval('role_id_seq'::regclass)"),
                              nullable=False),
                    sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True),
                    sa.Column('description', sa.VARCHAR(length=255), autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('id', name='role_pkey'),
                    sa.UniqueConstraint('name', name='role_name_key'),
                    postgresql_ignore_search_path=False)
    op.create_table('user',
                    sa.Column('id', sa.INTEGER(),
                              server_default=sa.text("nextval('user_id_seq'::regclass)"),
                              nullable=False),
                    sa.Column('login', sa.VARCHAR(length=255), autoincrement=False,
                              nullable=True),
                    sa.Column('email', sa.VARCHAR(length=255), autoincrement=False,
                              nullable=True),
                    sa.Column('password', sa.VARCHAR(length=255), autoincrement=False,
                              nullable=True),
                    sa.Column('active', sa.BOOLEAN(), autoincrement=False, nullable=True),
                    sa.Column('token', sa.VARCHAR(length=255), autoincrement=False,
                              nullable=True),
                    sa.Column('token_expires', postgresql.TIMESTAMP(), autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('id', name='user_pkey'),
                    sa.UniqueConstraint('login', name='user_login_key'),
                    postgresql_ignore_search_path=False)
    op.create_table('permissions_roles',
                    sa.Column('role_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('permission_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.ForeignKeyConstraint(['permission_id'], ['permission.id'],
                                            name='permissions_roles_permission_id_fkey'),
                    sa.ForeignKeyConstraint(['role_id'], ['role.id'],
                                            name='permissions_roles_role_id_fkey'))
    op.create_table('roles_users',
                    sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.Column('role_id', sa.INTEGER(), autoincrement=False, nullable=True),
                    sa.ForeignKeyConstraint(['role_id'], ['role.id'],
                                            name='roles_users_role_id_fkey'),
                    sa.ForeignKeyConstraint(['user_id'], ['user.id'],
                                            name='roles_users_user_id_fkey'))
    op.create_table('permission',
                    sa.Column('id', sa.INTEGER(), nullable=False),
                    sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True),
                    sa.PrimaryKeyConstraint('id', name='permission_pkey'),
                    sa.UniqueConstraint('name', name='permission_name_key'))
    # ### end Alembic commands ###
项目:provenance    作者:bmabey    | 项目源码 | 文件源码
def upgrade():
    op.create_table('artifact_set_members',
                    sa.Column('set_id', sa.VARCHAR(length=40), nullable=False),
                    sa.Column('artifact_id', sa.VARCHAR(length=40), nullable=False),
                    sa.PrimaryKeyConstraint('set_id', 'artifact_id'))

    op.create_table('artifact_sets',
                    sa.Column('id', sa.INTEGER(), nullable=False),
                    sa.Column('set_id', sa.VARCHAR(length=40), nullable=True),
                    sa.Column('name', sa.VARCHAR(length=1000), nullable=True),
                    sa.Column('created_at', pg.TIMESTAMP(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))

    op.create_table('runs',
                    sa.Column('id', sa.VARCHAR(length=40), nullable=False),
                    sa.Column('hostname', sa.VARCHAR(length=256), nullable=True),
                    sa.Column('info', pg.JSONB(), nullable=True),
                    sa.Column('created_at', pg.TIMESTAMP(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))

    op.create_table('artifacts',
                    sa.Column('id', sa.VARCHAR(length=40), nullable=False),
                    sa.Column('value_id', sa.VARCHAR(length=50), nullable=True),
                    sa.Column('run_id', sa.VARCHAR(length=40), nullable=True),
                    sa.Column('name', sa.VARCHAR(length=1000), nullable=True),
                    sa.Column('version', sa.INTEGER(), nullable=True),
                    sa.Column('fn_module', sa.VARCHAR(length=100), nullable=True),
                    sa.Column('fn_name', sa.VARCHAR(length=100), nullable=True),
                    sa.Column('composite', sa.BOOLEAN(), nullable=True),
                    sa.Column('value_id_duration', sa.FLOAT(), nullable=True),
                    sa.Column('compute_duration', sa.FLOAT(), nullable=True),
                    sa.Column('hash_duration', sa.FLOAT(), nullable=True),
                    sa.Column('computed_at', pg.TIMESTAMP(), nullable=True),
                    sa.Column('added_at', pg.TIMESTAMP(), nullable=True),
                    sa.Column('input_artifact_ids', pg.ARRAY(pg.VARCHAR(length=40)), nullable=True),
                    sa.Column('inputs_json', pg.JSONB(), nullable=True),
                    sa.Column('serializer', sa.VARCHAR(length=128), nullable=True),
                    sa.Column('load_kwargs', pg.JSONB(), nullable=True),
                    sa.Column('dump_kwargs', pg.JSONB(), nullable=True),
                    sa.Column('custom_fields', pg.JSONB(), nullable=True),
                    sa.ForeignKeyConstraint(['run_id'], ['runs.id'], ),
                    sa.PrimaryKeyConstraint('id'))