示例#1
0
文件: mssql.py 项目: 13917547121/me
def visit_column_nullable(element, compiler, **kw):
    return "%s %s %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        alter_column(compiler, element.column_name),
        format_type(compiler, element.existing_type),
        "NULL" if element.nullable else "NOT NULL"
    )
示例#2
0
def visit_column_default(element, compiler, **kw):
    # TODO: there can also be a named constraint
    # with ADD CONSTRAINT here
    return "%s ADD DEFAULT %s FOR %s" % (
        alter_table(compiler, element.table_name, element.schema),
        format_server_default(compiler, element.default),
        format_column_name(compiler, element.column_name))
示例#3
0
def visit_column_type(element: "ColumnType", compiler: "SpannerDDLCompiler",
                      **kw) -> str:
    return "%s %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        alter_column(compiler, element.column_name),
        "%s" % format_type(compiler, element.type_),
    )
示例#4
0
文件: mssql.py 项目: 13917547121/me
def visit_column_default(element, compiler, **kw):
    # TODO: there can also be a named constraint
    # with ADD CONSTRAINT here
    return "%s ADD DEFAULT %s FOR %s" % (
        alter_table(compiler, element.table_name, element.schema),
        format_server_default(compiler, element.default),
        format_column_name(compiler, element.column_name)
    )
示例#5
0
def visit_column_nullable(element: "ColumnNullable",
                          compiler: "SpannerDDLCompiler", **kw) -> str:
    return "%s %s %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        alter_column(compiler, element.column_name),
        format_type(compiler, element.existing_type),
        "" if element.nullable else "NOT NULL",
    )
示例#6
0
文件: oracle.py 项目: zky001/me
def visit_column_default(element, compiler, **kw):
    return "%s %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        alter_column(compiler, element.column_name),
        "DEFAULT %s" %
            format_server_default(compiler, element.default)
        if element.default is not None
        else "DEFAULT NULL"
    )
示例#7
0
def visit_column_default(element, compiler, **kw):
    return "%s %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        alter_column(compiler, element.column_name),
        "DEFAULT %s" %
            format_server_default(compiler, element.default)
        if element.default is not None
        else "DEFAULT NULL"
    )
示例#8
0
文件: mysql.py 项目: zky001/me
def _mysql_alter_column(element, compiler, **kw):
    return "%s CHANGE %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        element.column_name,
        _mysql_colspec(
            compiler,
            name=element.newname,
            nullable=element.nullable,
            server_default=element.default,
            type_=element.type_,
            autoincrement=element.autoincrement
        ),
    )
示例#9
0
def visit_column_type(element, compiler, **kw):
    return "%s %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        alter_column(compiler, element.column_name),
        "%s" % format_type(compiler, element.type_)
    )
示例#10
0
def visit_add_column(element, compiler, **kw):
    return "%s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        add_column(compiler, element.column, **kw),
    )
示例#11
0
def visit_column_type(element, compiler, **kw):
    return "%s %s %s" % (
        base.alter_table(compiler, element.table_name, element.schema),
        base.alter_column(compiler, element.column_name),
        "SET DATA TYPE %s" % base.format_type(compiler, element.type_)
    )
示例#12
0
def visit_column_nullable(element, compiler, **kw):
    return "%s %s %s %s" % (alter_table(
        compiler, element.table_name,
        element.schema), alter_column(compiler, element.column_name),
                            format_type(compiler, element.existing_type),
                            "NULL" if element.nullable else "NOT NULL")
示例#13
0
def visit_add_column(element, compiler, **kw):
    return "%s %s" % (alter_table(
        compiler, element.table_name,
        element.schema), mssql_add_column(compiler, element.column, **kw))
示例#14
0
文件: oracle.py 项目: zky001/me
def visit_column_name(element, compiler, **kw):
    return "%s RENAME COLUMN %s TO %s" % (
        alter_table(compiler, element.table_name, element.schema),
        format_column_name(compiler, element.column_name),
        format_column_name(compiler, element.newname)
    )
示例#15
0
def visit_column_name(element, compiler, **kw):
    return "%s RENAME COLUMN %s TO %s" % (
        alter_table(compiler, element.table_name, element.schema),
        format_column_name(compiler, element.column_name),
        format_column_name(compiler, element.newname)
    )
示例#16
0
def visit_column_type(element, compiler, **kw):
    return "%s %s %s" % (alter_table(
        compiler, element.table_name,
        element.schema), alter_column(compiler, element.column_name),
                         format_type(compiler, element.type_))
示例#17
0
def visit_column_type(element, compiler, **kw):
    return "%s %s %s" % (
        base.alter_table(compiler, element.table_name, element.schema),
        base.alter_column(compiler, element.column_name),
        "SET DATA TYPE %s" % base.format_type(compiler, element.type_))