我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用alembic.op.reverse()。
def reverse(self): return DropConstraintOp.from_constraint(self.to_constraint())
def reverse(self): if self._orig_constraint is None: raise ValueError( "operation is not reversible; " "original constraint is not present") return AddConstraintOp.from_constraint(self._orig_constraint)
def reverse(self): return DropIndexOp.from_index(self.to_index())
def reverse(self): if self._orig_index is None: raise ValueError( "operation is not reversible; " "original index is not present") return CreateIndexOp.from_index(self._orig_index)
def reverse(self): return DropTableOp.from_table(self.to_table())
def reverse(self): kw = self.kw.copy() kw['existing_type'] = self.existing_type kw['existing_nullable'] = self.existing_nullable kw['existing_server_default'] = self.existing_server_default if self.modify_type is not None: kw['modify_type'] = self.modify_type if self.modify_nullable is not None: kw['modify_nullable'] = self.modify_nullable if self.modify_server_default is not False: kw['modify_server_default'] = self.modify_server_default # TODO: make this a little simpler all_keys = set(m.group(1) for m in [ re.match(r'^(?:existing_|modify_)(.+)$', k) for k in kw ] if m) for k in all_keys: if 'modify_%s' % k in kw: swap = kw['existing_%s' % k] kw['existing_%s' % k] = kw['modify_%s' % k] kw['modify_%s' % k] = swap return self.__class__( self.table_name, self.column_name, schema=self.schema, **kw )
def reverse(self): return DropColumnOp.from_column_and_tablename( self.schema, self.table_name, self.column)
def reverse(self): if self._orig_column is None: raise ValueError( "operation is not reversible; " "original column is not present") return AddColumnOp.from_column_and_tablename( self.schema, self.table_name, self._orig_column)
def reverse(self): return ModifyTableOps( self.table_name, ops=list(reversed( [op.reverse() for op in self.ops] )), schema=self.schema )
def reverse_into(self, downgrade_ops): downgrade_ops.ops[:] = list(reversed( [op.reverse() for op in self.ops] )) return downgrade_ops
def reverse(self): return UpgradeOps( ops=list(reversed( [op.reverse() for op in self.ops] )) )