我正在更改数据库中的约束,我需要删除其中的一些约束.我知道对于单个约束,命令如下:
ALTER TABLE tblApplication DROP CONSTRAINT constraint1_name;
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试
ALTER TABLE tblApplication DROP (
CONSTRAINT constraint1_name,
CONSTRAINT constraint2_name,
CONSTRAINT constraint3_name
);
Run Code Online (Sandbox Code Playgroud)
它不起作用,我需要这样做:
ALTER TABLE tblApplication DROP CONSTRAINT constraint1_name;
ALTER TABLE tblApplication DROP CONSTRAINT constraint2_name;
ALTER TABLE tblApplication DROP CONSTRAINT constraint3_name;
Run Code Online (Sandbox Code Playgroud)
有没有办法在单个命令中删除多个约束?我想避免重复ALTER TABLE tblApplication,就像ADD命令一样:
ALTER TABLE tblApplication ADD (
CONSTRAINT contraint1_name FOREIGN KEY ... ENABLE,
CONSTRAINT contraint2_name FOREIGN KEY ... ENABLE,
CONSTRAINT contraint3_name FOREIGN KEY ... ENABLE
);
Run Code Online (Sandbox Code Playgroud) 考虑外部 (npm) 模块extmod在其声明文件中公开以下接口:
interface Options {
somevar?: string;
suboptions?: {
somesubvar?: string;
};
}
Run Code Online (Sandbox Code Playgroud)
如何通过模块增强somesubvar2在内部添加属性?suboptions
我在文件中尝试了以下操作extmod.d.ts:
declare module 'extmod' {
interface Options {
suboptions?: {
somesubvar2?: string;
};
}
}
Run Code Online (Sandbox Code Playgroud)
但它会引发以下错误:
error TS2687: All declarations of 'suboptions' must have identical modifiers.
Run Code Online (Sandbox Code Playgroud)
error TS2717: Subsequent property declarations must have the same type. Property 'suboptions' must be of type '<SNIP>', but here has type '{ somesubvar2: string; }'.
Run Code Online (Sandbox Code Playgroud)