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)]
Beispiel #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)
Beispiel #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)]
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)