You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.9 KiB
71 lines
1.9 KiB
import { PrismaClient } from "@prisma/client";
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const d1 = await prisma.measurement.upsert({
|
|
where: { id: 1 },
|
|
update: {},
|
|
create: {
|
|
name: "测量数据1",
|
|
railId: 1,
|
|
bureau: "北京铁路局",
|
|
line: "京沪线",
|
|
section: "路段一",
|
|
direction: "上行",
|
|
leftPoints: '[{"x":43,"y":22}]',
|
|
rightPoints: '[{"x":43,"y":22}]',
|
|
},
|
|
});
|
|
const d2 = await prisma.measurement.upsert({
|
|
where: { id: 2 },
|
|
update: {},
|
|
create: {
|
|
name: "测量数据2",
|
|
railId: 2,
|
|
bureau: "上海铁路局",
|
|
line: "京沪线",
|
|
section: "路段二",
|
|
direction: "下行",
|
|
leftPoints: '[{"x":43,"y":22}]',
|
|
rightPoints: '[{"x":43,"y":22}]',
|
|
},
|
|
});
|
|
const d3 = await prisma.measurement.upsert({
|
|
where: { id: 3 },
|
|
update: {},
|
|
create: {
|
|
name: "测量数据3",
|
|
railId: 2,
|
|
bureau: "上海铁路局",
|
|
line: "京九线",
|
|
section: "路段三",
|
|
direction: "下行",
|
|
leftPoints: '[{"x":43,"y":22}]',
|
|
rightPoints: '[{"x":43,"y":22}]',
|
|
},
|
|
});
|
|
const d4 = await prisma.measurement.upsert({
|
|
where: { id: 4 },
|
|
update: {},
|
|
create: {
|
|
name: "测量数据4",
|
|
railId: 3,
|
|
bureau: "南京铁路局",
|
|
line: "京九线",
|
|
section: "路段四",
|
|
direction: "上行",
|
|
leftPoints: '[{"x":43,"y":22}]',
|
|
rightPoints: '[{"x":43,"y":22}]',
|
|
},
|
|
});
|
|
console.log({ d1, d2, d3, d4 });
|
|
}
|
|
|
|
main()
|
|
.catch(e => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|