'Tests that the value constraint of PositiveIntegerField is enforced on
the database level.'

@skipUnless(db.has_check_constraints, 'Only    applies    to    databases    that    support    CHECK    constraints.')
def test_column_constraint(self):

    db.create_table('test_column_constraint', [('spam', models.PositiveIntegerField())])
    db.execute_deferred_sql()
    db.commit_transaction()
    db.start_transaction()
    try:
        db.execute('INSERT    INTO    test_column_constraint    VALUES    (-42)')
    except:
        pass
    else:
        self.fail('Could    insert    a    negative    value    into    a    PositiveIntegerField.')
    db.rollback_transaction()
    db.alter_column('test_column_constraint', 'spam', models.IntegerField())
    db.execute_deferred_sql()
    db.execute('INSERT    INTO    test_column_constraint    VALUES    (-42)')
    db.execute('DELETE    FROM    test_column_constraint')
    db.alter_column('test_column_constraint', 'spam', models.PositiveIntegerField())
    db.execute_deferred_sql()
    db.start_transaction()
    try:
        db.execute('INSERT    INTO    test_column_constraint    VALUES    (-42)')
    except:
        pass
    else:
        self.fail('Could    insert    a    negative    value    after    changing    an    IntegerField    to    a    PositiveIntegerField.')
    db.rollback_transaction()
    db.delete_table('test_column_constraint')
    db.start_transaction()
