1.設置為null 2.建表時其他參數的設置 3.set的使用 4.ManyToMany參數(through,db_constraint) 5.db_constraint 5.總結 ...
django數據模型中關於on delete, db constraint的參數說明 .設置為null .建表時其他參數的設置 .set的使用 .ManyToMany參數 through,db constraint .db constraint 總結 ...
2019-10-06 23:52 0 394 推薦指數:
1.設置為null 2.建表時其他參數的設置 3.set的使用 4.ManyToMany參數(through,db_constraint) 5.db_constraint 5.總結 ...
一、外鍵的刪除 關於on_delete的總結 1、常見的使用方式(設置為null) class BookModel(models.Model): """ 書籍表 """ book_name = models.CharField ...
一、外鍵、OneToOne字段等on_delete為必須參數 - 如下ForeignKey字段源碼,to、on_delete為必須參數 to:關聯的表 on_delete:當該表中的某條數據刪除后,關聯外鍵的操作 related_name:反查參數,設置后可以在被關聯表中通過該字段反查外 ...
例如上面on_delete=models.CASCADE代表的是當關聯表中的數據刪除時,該外鍵也刪除 還有幾種情況: on_delete=models.SET_NULL,代表當關聯表中的數據刪除時,該外鍵置空,當然,你的這個外鍵字段得允許為空,null=True ...
1.索引: 普通索引:加快查找速度 唯一索引:加快查找速度,唯一約束 主鍵索引:加快查找速度,唯一索引,不為空 元類使用: 用於生成聯合索引,以及設置個別參數 2.一對多外鍵建立: 外鍵關聯表 ...
1、SQLiteDataBase對象的query()接口: public Cursor query (String table, String ...
on_delete=None, # 刪除關聯表中的數據時,當前表與其關聯的field的行為on_delete=models.CASCADE, # 刪除關聯數據,與之關聯也刪除on_delete=models.DO_NOTHING, # 刪除關聯數據,什么也不做on_delete ...