Example #1
0
    def test_add_column(self):
        t = self.table

        op = ops.AddColumnOp.from_column_and_tablename(None, 't', t.c.x)
        is_(op.to_column(), t.c.x)
        is_(op.reverse().to_column(), t.c.x)
        is_not_(None, op.to_column().table)
Example #2
0
    def test_drop_column(self):
        t = self.table

        op = ops.DropColumnOp.from_column_and_tablename(None, "t", t.c.x)
        is_(op.to_column(), t.c.x)
        is_(op.reverse().to_column(), t.c.x)
        is_not_(None, op.to_column().table)
Example #3
0
    def test_drop_column(self):
        t = self.table

        op = ops.DropColumnOp.from_column_and_tablename(None, "t", t.c.x)
        is_(op.to_column(), t.c.x)
        is_(op.reverse().to_column(), t.c.x)
        is_not_(None, op.to_column().table)
Example #4
0
    def test_add_column(self):
        t = self.table

        op = ops.AddColumnOp.from_column_and_tablename(None, 't', t.c.x)
        is_(op.to_column(), t.c.x)
        is_(op.reverse().to_column(), t.c.x)
        is_not_(None, op.to_column().table)
Example #5
0
    def test_create_unique_constraint_add_kw(self):
        schema_obj = schemaobj.SchemaObjects()
        const = schema_obj.unique_constraint("x", "foobar", ["a"])
        op = ops.AddConstraintOp.from_constraint(const)
        is_not_(op.to_constraint(), const)

        op.kw["sqlite_on_conflict"] = "IGNORE"

        eq_(op.to_constraint().dialect_kwargs["sqlite_on_conflict"], "IGNORE")
        eq_(
            op.reverse().to_constraint().dialect_kwargs["sqlite_on_conflict"],
            "IGNORE",
        )
Example #6
0
 def test_create_table(self):
     schema_obj = schemaobj.SchemaObjects()
     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)
Example #7
0
 def test_create_table(self):
     schema_obj = schemaobj.SchemaObjects()
     table = schema_obj.table("x", Column("q", Integer))
     op = ops.CreateTableOp.from_table(table)
     is_not_(op.to_table(), table)
Example #8
0
 def test_drop_pk(self):
     pk = self.pk
     op = ops.DropConstraintOp.from_constraint(pk)
     is_(op.to_constraint(), pk)
     is_(op.reverse().to_constraint(), pk)
     is_not_(None, op.to_constraint().table)
Example #9
0
 def test_drop_unique(self):
     uq = self.uq
     op = ops.DropConstraintOp.from_constraint(uq)
     is_(op.to_constraint(), uq)
     is_(op.reverse().to_constraint(), uq)
     is_not_(None, op.to_constraint().table)
Example #10
0
 def test_drop_check(self):
     ck = self.ck
     op = ops.DropConstraintOp.from_constraint(ck)
     is_(op.to_constraint(), ck)
     is_(op.reverse().to_constraint(), ck)
     is_not_(None, op.to_constraint().table)
Example #11
0
 def test_add_fk(self):
     fk = self.fk
     op = ops.AddConstraintOp.from_constraint(fk)
     is_(op.to_constraint(), fk)
     is_(op.reverse().to_constraint(), fk)
     is_not_(None, op.to_constraint().table)
Example #12
0
 def test_drop_unique_constraint(self):
     schema_obj = schemaobj.SchemaObjects()
     const = schema_obj.unique_constraint("x", "foobar", ["a"])
     op = ops.DropConstraintOp.from_constraint(const)
     is_not_(op.to_constraint(), const)
Example #13
0
 def test_add_fk(self):
     fk = self.fk
     op = ops.AddConstraintOp.from_constraint(fk)
     is_(op.to_constraint(), fk)
     is_(op.reverse().to_constraint(), fk)
     is_not_(None, op.to_constraint().table)
Example #14
0
    def test_create_index(self):
        schema_obj = schemaobj.SchemaObjects()
        idx = schema_obj.index("x", "y", ["z"])
        op = ops.CreateIndexOp.from_index(idx)

        is_not_(op.to_index(), idx)
Example #15
0
 def test_drop_pk(self):
     pk = self.pk
     op = ops.DropConstraintOp.from_constraint(pk)
     is_(op.to_constraint(), pk)
     is_(op.reverse().to_constraint(), pk)
     is_not_(None, op.to_constraint().table)
Example #16
0
 def test_drop_unique(self):
     uq = self.uq
     op = ops.DropConstraintOp.from_constraint(uq)
     is_(op.to_constraint(), uq)
     is_(op.reverse().to_constraint(), uq)
     is_not_(None, op.to_constraint().table)
Example #17
0
 def test_drop_check(self):
     ck = self.ck
     op = ops.DropConstraintOp.from_constraint(ck)
     is_(op.to_constraint(), ck)
     is_(op.reverse().to_constraint(), ck)
     is_not_(None, op.to_constraint().table)