| id | bigint | identity(1,1) | primary key, | |
| created | datetime | default getdate | not null | |
| modified | datetime | default getdate | not null | |
| varchar(200) | not null | ,--邮件,unique index | ||
| pwd | varchar(100) | not null | ,--密码MD5加密 | |
| mode | tinyint | default 0 | not null | |
| nickname | varchar(100) | |||
| sex | tinyint | default 0 | not null | ,--0未知1男2女 |
| id | bigint | identity(1,1) | primary key, | |
| created | datetime | default getdate | not null | |
| modified | datetime | default getdate | not null | |
| title | varchar(200) | not null | ,--名称 | |
| father_id | bigint | default 0 | not null | ,--父ID |
| mode | tinyint | default 0 | not null | |
| UserName | nvarchar(256) | not null | ,--引用非FK | |
| edible | decimal(8,5) | default 100 | not null | ,--食部 |
| id | bigint | identity(1,1) | primary key, | |
| created | datetime | default getdate | not null | |
| modified | datetime | default getdate | not null | |
| title | varchar(200) | not null | ,--名称 | |
| mode | tinyint | default 0 | not null | |
| UserName | nvarchar(256) | default 0 | not null | ,--引用非主键 |
| unit | tinyint | not null | ,--计量单位 0:千卡/100克(热量) 1:克/100克 2:毫克/100克 3:微克/100克 |
|
| pri | int | default 0 | not null | ,--排序 order by acs |
| id | bigint | identity(1,1) | primary key, | |
| created | datetime | default getdate | not null | |
| modified | datetime | default getdate | not null | |
| nutriment_id | bigint | not null | ,--FK | |
| food_id | bigint | not null | ,--FK,with nutriment_id unique index | |
| UserName | nvarchar(256) | not null | ,--引用非主键 | |
| mode | tinyint | default 0 | not null | ,--状态0任意1引用 |
| detail | decimal(12,6) | not null | ,--含量 |
单人床
二人食街
乖乖小宝贝
老少皆宜
大团圆
菜谱(烹饪时间,步骤)
原料(储藏、营养价值、配伍)
厨房窍门
主食
菜肴
甜点
水果
药膳
早中晚宵夜
冰箱管家
营养计算
膳食建议
偏食 禁忌 饮食偏好
厨房设备 小工具
邮件问题
编辑以上内容 删除以上内容 追加资源if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[customs]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table customs
create table customs(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
email varchar(200) not null ,--邮件
pwd varchar(400) not null ,--密码MD5加密
mode tinyint default 0 not null ,--0:正常1:停用
nickname varchar(100),
sex tinyint default 0 not null,--0未知1男2女
);
create unique index idx_customs_email on customs(email)
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[foods]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table foods
create table foods(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
title varchar(200) not null ,
father_id bigint not null,--父ID
mode tinyint default 0 not null ,
custom_id bigint not null ,--引用非主键
edible decimal(8,5) default 100 not null,
);
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[nutriments]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table nutriments
create table nutriments(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
title varchar(200) not null,
mode tinyint default 0 not null ,
custom_id bigint not null ,
unit tinyint not null,
pri int default 0 not null,
);
create unique index idx_nutriments_title on nutriments(title)
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[nutriment2foods]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table nutriment2foods
create table nutriment2foods(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
nutriment_id bigint not null,
food_id bigint not null,
custom_id bigint not null,
mode tinyint default 0 not null ,
detail decimal(12,6) not null,
foreign key (nutriment_id) references nutriments(id) on delete cascade,
foreign key (food_id) references foods(id) on delete cascade,
);
create unique index idx_nutriment2foods_3_id on nutriment2foods(nutriment_id,food_id,custom_id)