-- ----------------------------
-- 协议信息表
-- ----------------------------
create table sys_agreement
(
    id          bigint        NOT NULL,
    title       nvarchar(100) NOT NULL,
    content     nvarchar(MAX) DEFAULT ('') NULL,
    create_dept bigint,
    create_by   bigint,
    create_time datetime2(7),
    update_by   bigint,
    update_time datetime2(7),
    CONSTRAINT PK__sys_agreement__id PRIMARY KEY CLUSTERED (id)
    WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
    ON [PRIMARY]
)
ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty 'MS_Description', N'协议ID', 'SCHEMA', N'dbo', 'TABLE', N'sys_agreement', 'COLUMN', N'id'
GO
EXEC sys.sp_addextendedproperty 'MS_Description', N'协议标题', 'SCHEMA', N'dbo', 'TABLE', N'sys_agreement', 'COLUMN', N'title'
GO
EXEC sys.sp_addextendedproperty 'MS_Description', N'协议内容（富文本HTML）', 'SCHEMA', N'dbo', 'TABLE', N'sys_agreement', 'COLUMN', N'content'
GO

-- ----------------------------
-- 客户表
-- ----------------------------
create table sys_customer
(
    id                 bigint            NOT NULL,
    user_name          nvarchar(30)      NOT NULL,
    phone              nvarchar(11)      DEFAULT ('') NULL,
    wechat_openid      nvarchar(255)     DEFAULT ('') NULL,
    wechat_unionid     nvarchar(255)     DEFAULT ('') NULL,
    auth_customer_id   nvarchar(255)     DEFAULT ('') NULL,
    avatar             bigint            DEFAULT (NULL) NULL,
    tenant_id          nvarchar(20)      DEFAULT ('000000') NULL,
    create_dept        bigint,
    create_by          bigint,
    create_time        datetime2(7),
    update_by          bigint,
    update_time        datetime2(7),
    del_flag           nchar             DEFAULT ('0') NULL,
    CONSTRAINT PK__sys_customer__id PRIMARY KEY CLUSTERED (id)
    WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
    ON [PRIMARY]
)
ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty
    'MS_Description', N'客户ID' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'id'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'用户名' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'user_name'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'手机号' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'phone'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'微信OpenID' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'wechat_openid'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'微信UnionID' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'wechat_unionid'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'授权客户ID' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'auth_customer_id'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'头像OSS ID' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'avatar'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'租户ID' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'tenant_id'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'创建部门' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'create_dept'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'创建者' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'create_by'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'创建时间' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'create_time'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'更新者' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'update_by'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'更新时间' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'update_time'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'删除标志（0代表存在 1代表删除）' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer',
    'COLUMN', N'del_flag'
GO
EXEC sys.sp_addextendedproperty
    'MS_Description', N'客户表' ,
    'SCHEMA', N'dbo',
    'TABLE', N'sys_customer'
GO
