- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在做一个小项目,我需要对以下场景进行建模:
场景
最佳答案
看起来您已经对这些事物中的每一个进行了建模——报价、订单、草稿、发票——在结构上与所有其他事物相同。如果是这种情况,那么您可以将所有类似的属性“推送”到一个表中。
create table statement (
stmt_id integer primary key,
stmt_type char(1) not null check (stmt_type in ('d', 'q', 'o', 'i')),
stmt_date date not null default current_date,
customer_id integer not null -- references customer (customer_id)
);
create table statement_line_items (
stmt_id integer not null references statement (stmt_id),
line_item_number integer not null,
-- other columns for line items
primary key (stmt_id, line_item_number)
);
-- "Supertype". Comments appear above the column they apply to.
create table statement (
-- Autoincrement or serial is ok here.
stmt_id integer primary key,
stmt_type char(1) unique check (stmt_type in ('d','q','o','i')),
-- Guarantees that only the order_st table can reference rows having
-- stmt_type = 'o', only the invoice_st table can reference rows having
-- stmt_type = 'i', etc.
unique (stmt_id, stmt_type),
stmt_date date not null default current_date,
cust_id integer not null -- references customers (cust_id)
);
-- order "subtype"
create table order_st (
stmt_id integer primary key,
stmt_type char(1) not null default 'o' check (stmt_type = 'o'),
-- Guarantees that this row references a row having stmt_type = 'o'
-- in the table "statement".
unique (stmt_id, stmt_type),
-- Don't cascade deletes. Don't even allow deletes. Every order given
-- an order number must be maintained for accountability, if not for
-- accounting.
foreign key (stmt_id, stmt_type) references statement (stmt_id, stmt_type)
on delete restrict,
-- Autoincrement or serial is *not* ok here, because they can have gaps.
-- Database must account for each order number.
order_num integer not null,
is_canceled boolean not null
default FALSE
);
-- Write triggers, rules, whatever to make this view updatable.
-- You build one view per subtype, joining the supertype and the subtype.
-- Application code uses the updatable views, not the base tables.
create view orders as
select t1.stmt_id, t1.stmt_type, t1.stmt_date, t1.cust_id,
t2.order_num, t2.is_canceled
from statement t1
inner join order_st t2 on (t1.stmt_id = t2.stmt_id);
关于sql - 数据建模草稿/报价/订单/发票,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5692924/
我一直在从事一个需要内容的草稿/实时版本的项目,并想到了如下设计: Article ID Creator CreationDate DraftContent(fk to
这是我的第一个问题,如果我做错了什么,请告诉我... 我目前正在用 Java 制作一个草稿游戏。事实上,除了 AI 之外,一切正常。AI 目前是单线程的,使用 minimax 和 alpha-beta
我一直在 Delphi 下使用 Indy 通过 gmail 帐户发送消息,使用 TIdSMTP 和 TIdMessage 组件。这绝对没问题。 但是,我的客户请求将消息保存到 DRAFTS 文件夹,以
我有一个简单的 IBackgroundTask执行查询然后根据特定项目是否存在执行插入或一个或多个更新的实现。但是,更新没有持久化,我不明白为什么。新项目按预期创建。 我正在更新的内容项有 Commo
我的部分应用程序功能是自动填写 Gmail 邮件主题、文本、收件人并附上照片。但是当我退出 gmail Intent 而不发送邮件时,我不想将此邮件保存为草稿。 如何禁止在从我的应用程序开始意向之前保
我正在尝试使用 facebook 的 Draft-JS 框架实现一个编辑器,该框架将被限制为 50 个字符的行。 我不希望使用 css 换行,我希望它们在达到 50 个字符的限制时真正分成单独的 bl
我正在编写一个应该同时支持 draft 17 的小型 WebSocket 服务器应用程序和较旧的变体,例如 draft 00 .我对最新的草稿没有任何问题,但我无法让草稿 00 的客户满意。 出于测试
我正在使用 Facebook 的 Draft.js 库创建富文本框,我需要将文本框的插入符号设为红色。可能吗? 我已阅读有关 -webkit-text-fill-color 属性的内容,但它使键入的文
我正在使用 Gmail API 在 Python 中自动创建 Gmail 草稿。我需要创建 HTML 格式的电子邮件,但我个人也需要创建纯文本回退,因为这是正确的做法。 我以为我已经完成了上述所有工作
从官方文档我知道了 2 种方法:通过键获取实体和获取最后创建的实体。就我而言,我还需要一种方法来访问当前 ContentState 中的所有实体。有什么方法可以执行此操作吗?如果没有,是否有一个可以提
我有一个难题要解决。 Here is my sample project 基本上我想创建一个可编辑的类似书本的容器,并且由于每个书页都是另一个容器,所以我不知道如何在页面充满文本后让编辑器从一个页面过
按此 SO thread我应该能够使用格式如下的超链接直接转到使用 Gmail REST API 创建的 Gmail 草稿邮件: https://mail.google.com/mail/#draft
我一直在尝试弄清楚如何自动将收件人添加到通过他们的 Ruby 库使用 Gmail API 创建的草稿电子邮件。我可以毫无问题地创建草稿,但设置收件人给我带来了麻烦,而且我一直无法找到任何好的示例来展示
是否有文档解释如何在将内容粘贴到 Draft.js 中时保留段落分隔符?其他格式看起来很合理,但粘贴时所有段落 block 都会折叠成单个段落 block 。 最佳答案 您可以使用编辑器的 Prop
我正在构建一个基于draft-js的扩展编辑器来添加脚注功能。在主编辑器中编写文本时,用户可以选择单击“添加脚注”,这会在当前选择处添加脚注标记(带有注释编号的徽章),并打开辅助编辑器,在其中编写文本
我总是使用 Gmail 来保存网页剪辑或笔记。我只需创建一封新邮件,对其进行编辑并另存为草稿。两年多来,我已将 1000 多封邮件转储到 Gmail 草稿文件夹中。我想以编程方式将它们全部发送给自己。
N4791 - 2018-12-07(这与 [basic.start.static]/2 的 current draft 中的措辞一致) Constant initialization is perf
我正在尝试使用 C# 在 winforms 应用程序中生成 Gmail 草稿邮件。消息草稿需要采用 HTML 格式并能够包含附件。 我能够使用 AE.Net.Mail 生成带有附件的草稿,但草稿邮件是
我正在使用来自 their website 的 paypal 创建发票样本 json 我得到了一个足够好的 token ,我将其与帖子一起提交,因为错误不是 401 Unauthorized 而是 4
我是一名优秀的程序员,十分优秀!