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

  1. import { PrismaClient } from "@prisma/client";
  2. const prisma = new PrismaClient();
  3. async function main() {
  4. const d1 = await prisma.measurement.upsert({
  5. where: { id: 1 },
  6. update: {},
  7. create: {
  8. name: "测量数据1",
  9. railId: 1,
  10. bureau: "北京铁路局",
  11. line: "京沪线",
  12. section: "路段一",
  13. direction: "上行",
  14. leftPoints: '[{"x":43,"y":22}]',
  15. rightPoints: '[{"x":43,"y":22}]',
  16. },
  17. });
  18. const d2 = await prisma.measurement.upsert({
  19. where: { id: 2 },
  20. update: {},
  21. create: {
  22. name: "测量数据2",
  23. railId: 2,
  24. bureau: "上海铁路局",
  25. line: "京沪线",
  26. section: "路段二",
  27. direction: "下行",
  28. leftPoints: '[{"x":43,"y":22}]',
  29. rightPoints: '[{"x":43,"y":22}]',
  30. },
  31. });
  32. const d3 = await prisma.measurement.upsert({
  33. where: { id: 3 },
  34. update: {},
  35. create: {
  36. name: "测量数据3",
  37. railId: 2,
  38. bureau: "上海铁路局",
  39. line: "京九线",
  40. section: "路段三",
  41. direction: "下行",
  42. leftPoints: '[{"x":43,"y":22}]',
  43. rightPoints: '[{"x":43,"y":22}]',
  44. },
  45. });
  46. const d4 = await prisma.measurement.upsert({
  47. where: { id: 4 },
  48. update: {},
  49. create: {
  50. name: "测量数据4",
  51. railId: 3,
  52. bureau: "南京铁路局",
  53. line: "京九线",
  54. section: "路段四",
  55. direction: "上行",
  56. leftPoints: '[{"x":43,"y":22}]',
  57. rightPoints: '[{"x":43,"y":22}]',
  58. },
  59. });
  60. console.log({ d1, d2, d3, d4 });
  61. }
  62. main()
  63. .catch(e => {
  64. console.error(e);
  65. process.exit(1);
  66. })
  67. .finally(async () => {
  68. await prisma.$disconnect();
  69. });