예제 #1
0
def test_foreign_key_index():
    tc = TableCreator('awesome')
    tc.foreign_key('int', 'user_id', references='user.id', on_delete='cascade', on_update='cascade')
    tc.add_index(('user_id',), False)

    assert isinstance(tc.model.user_id, peewee.ForeignKeyField)
    assert tc.model._meta.indexes == [(('user_id',), False)]
예제 #2
0
def test_foreign_key():
    tc = TableCreator('awesome')
    tc.foreign_key('int',
                   'user_id',
                   references='user.id',
                   on_delete='cascade',
                   on_update='cascade')

    assert isinstance(tc.model.user_id, peewee.ForeignKeyField)
예제 #3
0
def test_foreign_key_index():
    tc = TableCreator('awesome')
    tc.foreign_key('int',
                   'user_id',
                   references='user.id',
                   on_delete='cascade',
                   on_update='cascade')
    tc.add_index(('user_id', ), False)

    assert isinstance(tc.model.user_id, peewee.ForeignKeyField)
    assert tc.model._meta.indexes == [(('user_id', ), False)]
예제 #4
0
def test_foreign_key():
    tc = TableCreator('awesome')
    tc.foreign_key('int', 'user_id', references='user.id', on_delete='cascade', on_update='cascade')

    assert isinstance(tc.model.user_id, peewee.ForeignKeyField)