Exemplo n.º 1
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"
    )
Exemplo n.º 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))
Exemplo n.º 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_),
    )
Exemplo n.º 4
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)
    )
Exemplo n.º 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",
    )
Exemplo n.º 6
0
Arquivo: oracle.py Projeto: 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"
    )
Exemplo n.º 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"
    )
Exemplo n.º 8
0
Arquivo: mysql.py Projeto: 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
        ),
    )
Exemplo n.º 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_)
    )
Exemplo n.º 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),
    )
Exemplo n.º 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_)
    )
Exemplo n.º 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")
Exemplo n.º 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))
Exemplo n.º 14
0
Arquivo: oracle.py Projeto: 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)
    )
Exemplo n.º 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)
    )
Exemplo n.º 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_))
Exemplo n.º 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_))