constraint_table.name,
constraint.columns.keys(),
schema=constraint_table.schema,
- **constraint.dialect_kwargs
+ **constraint.dialect_kwargs,
)
def to_constraint(self, migration_context=None):
self.table_name,
self.columns,
schema=self.schema,
- **self.kw
+ **self.kw,
)
@classmethod
constraint_table.name,
[c.name for c in constraint.columns],
schema=constraint_table.schema,
- **kw
+ **kw,
)
def to_constraint(self, migration_context=None):
self.table_name,
self.columns,
schema=self.schema,
- **self.kw
+ **self.kw,
)
@classmethod
target_table,
source_columns,
target_columns,
- **kw
+ **kw,
)
def to_constraint(self, migration_context=None):
self.referent_table,
self.local_cols,
self.remote_cols,
- **self.kw
+ **self.kw,
)
@classmethod
referent_schema=referent_schema,
initially=initially,
match=match,
- **dialect_kw
+ **dialect_kw,
)
return operations.invoke(op)
referent_schema=referent_schema,
initially=initially,
match=match,
- **dialect_kw
+ **dialect_kw,
)
return operations.invoke(op)
constraint_table.name,
constraint.sqltext,
schema=constraint_table.schema,
- **constraint.dialect_kwargs
+ **constraint.dialect_kwargs,
)
def to_constraint(self, migration_context=None):
self.table_name,
self.condition,
schema=self.schema,
- **self.kw
+ **self.kw,
)
@classmethod
operations.impl.table_name,
condition,
schema=operations.impl.schema,
- **kw
+ **kw,
)
return operations.invoke(op)
sqla_compat._get_index_expressions(index),
schema=index.table.schema,
unique=index.unique,
- **index.kwargs
+ **index.kwargs,
)
def to_index(self, migration_context=None):
self.columns,
schema=self.schema,
unique=self.unique,
- **self.kw
+ **self.kw,
)
return idx
operations.impl.table_name,
columns,
schema=operations.impl.schema,
- **kw
+ **kw,
)
return operations.invoke(op)
index.table.name,
schema=index.table.schema,
_reverse=CreateIndexOp.from_index(index),
- **index.kwargs
+ **index.kwargs,
)
def to_index(self, migration_context=None):
self.table_name,
self._reverse.columns if self._reverse else ["x"],
schema=self.schema,
- **self.kw
+ **self.kw,
)
@classmethod
index_name,
table_name=operations.impl.table_name,
schema=operations.impl.schema,
- **kw
+ **kw,
)
return operations.invoke(op)
self.table_name = table_name
self.columns = columns
self.schema = schema
+ self.info = kw.pop("info", {})
self.comment = kw.pop("comment", None)
self.prefixes = kw.pop("prefixes", None)
self.kw = kw
# not doubled up. see #844 #848
_constraints_included=True,
comment=table.comment,
- prefixes=table._prefixes,
- **table.kwargs
+ info=table.info.copy(),
+ prefixes=list(table._prefixes),
+ **table.kwargs,
)
def to_table(self, migration_context=None):
self.table_name,
*self.columns,
schema=self.schema,
- prefixes=self.prefixes,
+ prefixes=list(self.prefixes) if self.prefixes else [],
comment=self.comment,
+ info=self.info.copy() if self.info else {},
_constraints_included=self._constraints_included,
- **self.kw
+ **self.kw,
)
@classmethod
self.table_name = table_name
self.schema = schema
self.table_kw = table_kw or {}
+ self.comment = self.table_kw.pop("comment", None)
+ self.info = self.table_kw.pop("info", None)
+ self.prefixes = self.table_kw.pop("prefixes", None)
self._reverse = _reverse
def to_diff_tuple(self):
return cls(
table.name,
schema=table.schema,
- table_kw=table.kwargs,
+ table_kw={
+ "comment": table.comment,
+ "info": table.info.copy(),
+ "prefixes": list(table._prefixes),
+ **table.kwargs,
+ },
_reverse=CreateTableOp.from_table(
table, _namespace_metadata=_namespace_metadata
),
t = schema_obj.table(
self.table_name,
*cols_and_constraints,
+ comment=self.comment,
+ info=self.info.copy() if self.info else {},
+ prefixes=list(self.prefixes) if self.prefixes else [],
schema=self.schema,
_constraints_included=bool(self._reverse)
and self._reverse._constraints_included,
- **self.table_kw
+ **self.table_kw,
)
return t
modify_server_default=server_default,
modify_nullable=nullable,
modify_comment=comment,
- **kw
+ **kw,
)
return operations.invoke(alt)
modify_server_default=server_default,
modify_nullable=nullable,
modify_comment=comment,
- **kw
+ **kw,
)
return operations.invoke(alt)
operations.impl.table_name,
column,
schema=operations.impl.schema,
- **kw
+ **kw,
)
return operations.invoke(op)
operations.impl.table_name,
column_name,
schema=operations.impl.schema,
- **kw
+ **kw,
)
return operations.invoke(op)
def test_drop_table(self):
schema_obj = schemaobj.SchemaObjects()
- table = schema_obj.table("x", Column("q", Integer))
+ table = schema_obj.table(
+ "x",
+ Column("q", Integer),
+ info={"custom": "value"},
+ prefixes=["FOREIGN"],
+ postgresql_partition_by="x",
+ comment="some comment",
+ )
op = ops.DropTableOp.from_table(table)
is_not_(op.to_table(), table)
+ eq_(op.to_table().comment, table.comment)
+ eq_(op.to_table().info, table.info)
+ eq_(op.to_table()._prefixes, table._prefixes)
def test_drop_table_add_kw(self):
schema_obj = schemaobj.SchemaObjects()
def test_create_table(self):
schema_obj = schemaobj.SchemaObjects()
- table = schema_obj.table("x", Column("q", Integer))
+ table = schema_obj.table(
+ "x",
+ Column("q", Integer),
+ postgresql_partition_by="x",
+ prefixes=["FOREIGN"],
+ info={"custom": "value"},
+ comment="some comment",
+ )
op = ops.CreateTableOp.from_table(table)
is_not_(op.to_table(), table)
+ eq_(op.to_table().comment, table.comment)
+ eq_(op.to_table().info, table.info)
+ eq_(op.to_table()._prefixes, table._prefixes)
def test_create_table_add_kw(self):
schema_obj = schemaobj.SchemaObjects()