我以不同的可能方式尝试了这个命令,但我的命令的基本结构是。
yarn typeorm migration:generate -n=consent-record -d=\"./src/db/CliDataSource.ts\"
Run Code Online (Sandbox Code Playgroud)
这是我在 package.json 中针对yarn berry 的 typeorm 命令
"typeorm": "ts-node -P ./tsconfig.typeorm.json $(yarn bin typeorm) -d ./src/db/CliDataSource.ts",
Run Code Online (Sandbox Code Playgroud)
我还尝试在本地安装 typeorm 作为 npm。并尝试使用 npx。但他们都给出以下错误。“没有足够的非选项参数:得到 0,至少需要 1”这个错误显然没有提到缺少什么。
我的 CliDataSource 是这样的。
export const CliDataSource = new DataSource({
type: 'postgres',
host: 'localhost',
port: 5436,
username: '****',
password: '******',
database: 'consent',
synchronize: false,
logging: false,
entities,
migrations,
migrationsRun: true,
subscribers: [],
});
Run Code Online (Sandbox Code Playgroud)
我正在使用 typeorm“^0.3.6”
我Order
在我的datamodel.prisma
文件中创建了一个实体。在那里它应该自动生成名为orderRef
. createOrder
对于每个突变调用,它应该为Order 实体的字段自动生成增量值。
对于第一个订单,“orderRef”字段的值应为 OD1,第二个订单的“orderRef”字段的值应为 OD2,依此类推。例如:
(OD1, OD2, .... OD124, ..... )
实现这一目标的最简单方法是什么?是的,值应该是字符串,而不是数字。
我有一个文本字段,其中包含占位符“日期自”。我想要做的是将焦点事件的输入框类型更改为日期类型。但
但下面提到的解决方案不适用于 JSX。
<input placeholder="Date" type="text" onFocus="(this.type='date')" id="date">
Run Code Online (Sandbox Code Playgroud)
如何使这个东西在 ReactJs 上工作或如何实现相同的目标?
以下有什么区别。何时使用其中一种而不是另一种?
zones: [Zone]
zones: [Zone!]
zones: [Zone]!
zones: [Zone!]!
Run Code Online (Sandbox Code Playgroud) 这是我的 datamodel.prisma 文件的相关部分。
type Driver {
id: ID! @unique
zones: [Zone!] @relation(name: "DriverZones")
shifts: [Shift!] @relation(name: "DriverShifts")
preferredZone: Zone
preferredShift: Shift
}
type Shift {
id: ID! @unique
drivers: [Driver! ] @relation(name: "DriverShifts")
}
type Zone {
id: ID! @unique
drivers: [Driver! ] @relation(name: "DriverZones")
}
Run Code Online (Sandbox Code Playgroud)
在这里,我想根据我创建的数据模型为preferredZone 和preferredShift 创建类型为Zone 和Shift 的关系。这是一种单向关系。
关系字段preferredShift
必须指定一个@relation
指令:@relation(name: "MyRelation")
,关系字段preferredZone
必须指定一个@relation
指令:@relation(name: "MyRelation")
我的 prisma 数据库使用 PostgreSQL。如何建立preferredZone到Zone之间的关系。并将首选Shift 改为Shift。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GMP APP</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
<link rel="stylesheet" href="css/custom.css" type="text/css"/>
</head>
<body>
<div class="container">
<div class="panel panel-default">
<div class="panel-heading"> SignUp to the system </div>
<div class="panel-body">
<<panel content goes here>>
</div>
<div class="panel-footer"> You have 3 More attempts left! </div>
</div>
<script src="javascript/jquery.js"> </script>
<script src="javascript/bootstrap.js"> </script>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
引导程序已正确链接。但是面板不工作。!我尝试了一切。我确实假设我已经正确链接了相关库。这是浏览器页面源的输出...
这些是我正在使用的依赖项
"dependencies": {
"express": "^4.16.3",
"express-graphql": "^0.6.12",
"graphql": "^0.13.2",
"lodash": "^4.17.10"
Run Code Online (Sandbox Code Playgroud)
}
这是我的schema.js文件看起来像
这是我的server.js文件中的代码