class AnswersModel(models.Model): author = models.ForeignKey(FrontUserModel,null=True,related_name='answers_user') -- relay_to = models.ForeignKey(FrontUserModel,null=True,related_name='relay_to_user')当模型执行迁移时会报:HINT: Add or change a related_name arg…
GO --判断表是否存在方式1 if object_id(N'EF_User',N'U') is null --判断表是否存在方式2 --if not exists (select * from dbo.SysObjects WHERE id = object_id(N'[EF_User]') AND OBJECTPROPERTY(ID, 'IsTable') = 1) begin --直接创建自增且指定主键约束的表 CREATE TABLE [dbo].[EF_User]( ,) not nu…
创建用户和授权 1.创建用户: # 指定ip:192.118.1.1的mjj用户登录 create user 'mjj'@'192.118.1.1' identified by '123'; # 指定ip:192.118.1.开头的mjj用户登录 create user 'mjj'@'192.118.1.%' identified by '123'; # 指定任何ip的mjj用户登录 create user 'mjj'@'%' identified by '123'; 2.删除用户 drop u…
primary key 主键 notnull 不为空 unique 唯一 foreign key(外键) references t1(id) auto_increment 递增,数字必须为整数 字段的增删改查 : 增 insert into t1 values(XX) 删delete from t1 where id = 1 改update t1 set name = XX where id = 1 查 select * from t1 表格的增删改 增al…