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" )
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))
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_), )
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) )
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", )
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" )
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 ), )
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_) )
def visit_add_column(element, compiler, **kw): return "%s %s" % ( alter_table(compiler, element.table_name, element.schema), add_column(compiler, element.column, **kw), )
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_) )
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")
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))
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) )
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_))
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_))