update.sql 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. ALTER TABLE `tmrwatch2`.`feedlaid`
  2. ADD COLUMN `status` int(1) NOT NULL DEFAULT 0 COMMENT '0 已出库 \r\n1 未出库 \r\n2 已撤销\r\n' AFTER `pricenew`;
  3. alter table feedtemplet
  4. add updatetime datetime default CURRENT_TIMESTAMP null;
  5. ALTER TABLE `tmrwatch`.`tmr`
  6. ADD COLUMN `lastinorout` int(1) NULL DEFAULT 0 AFTER `autosecondname`
  7. alter table fpdetail
  8. alter column ptuse set default 0;
  9. alter table fpdetail
  10. alter column ptsuse set default 0;
  11. alter table fpdetail
  12. alter column supplement set default 0;
  13. alter table fpdetail
  14. alter column ptsrate set default 0;
  15. alter table fpdetail
  16. alter column weight set default 0;
  17. update fpdetail set ptsrate = 0 where ptsrate is null ;
  18. update fpdetail set supplement = 0 where supplement is null ;
  19. alter table feedp
  20. alter column supplyweight set default 0;
  21. -- 修改饲料表顺序
  22. -- update
  23. -- (SELECT @rownum:=0)r ,feed fn
  24. -- set fn.sort = @rownum := @rownum+1
  25. -- WHERE fn.pastureid = 1647917519
  26. -- ORDER BY fn.sort DESC
  27. update
  28. (SELECT @rownum:=0)r ,bar fn
  29. set fn.sort = @rownum := @rownum+1
  30. WHERE fn.pastureid = 1648637190
  31. ORDER BY fn.id DESC
  32. -- 宾州筛bug
  33. -- `barid`, `times`, `operatetime` 唯一索引
  34. -- 宾州筛历史记录表
  35. -- CREATE TABLE `pennsieve_history` (
  36. -- `id` bigint(20) NOT NULL AUTO_INCREMENT,
  37. -- `barname` varchar(50) DEFAULT NULL COMMENT '栏舍名称',
  38. -- `times` varchar(50) DEFAULT NULL COMMENT '班次',
  39. -- `onerate` decimal(20,2) DEFAULT NULL COMMENT '第一层比例',
  40. -- `oneweight` decimal(20,2) DEFAULT NULL COMMENT '第一层重量',
  41. -- `tworate` decimal(20,2) DEFAULT NULL COMMENT '第二层比列',
  42. -- `twoweight` decimal(20,2) DEFAULT NULL COMMENT '第二层重量',
  43. -- `threerate` decimal(20,2) DEFAULT NULL COMMENT '第三层比列',
  44. -- `threeweight` decimal(20,2) DEFAULT NULL COMMENT '第三层重量',
  45. -- `fourrate` decimal(20,2) DEFAULT NULL COMMENT '第四层比列',
  46. -- `fourweight` decimal(20,2) DEFAULT NULL COMMENT '第四层重量',
  47. -- `operatetime` datetime DEFAULT NULL COMMENT '操作时间',
  48. -- `barid` bigint(20) DEFAULT NULL COMMENT '栏舍id',
  49. -- `pastureid` bigint(20) DEFAULT NULL COMMENT '牧场id',
  50. -- `species` varchar(50) DEFAULT NULL COMMENT '种类',
  51. -- PRIMARY KEY (`id`)
  52. -- ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
  53. -- 配方干物质
  54. -- 到体况评分bug
  55. CREATE TABLE `ftdry_history` (
  56. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  57. `barname` varchar(50) DEFAULT NULL COMMENT '栏舍名称',
  58. `times` varchar(50) DEFAULT NULL COMMENT '班次',
  59. `freshweight` decimal(20,2) DEFAULT NULL COMMENT '新鲜重量',
  60. `dryweight` decimal(20,2) DEFAULT NULL COMMENT '烘干重量',
  61. `thoweight` decimal(20,0) DEFAULT NULL COMMENT '理论干物质',
  62. `actweight` decimal(20,0) DEFAULT NULL COMMENT '实际干物质',
  63. `barid` bigint(20) DEFAULT NULL COMMENT '栏舍id',
  64. `changeTime` datetime DEFAULT NULL COMMENT '操作时间',
  65. `pastureid` bigint(20) DEFAULT NULL COMMENT '牧场id',
  66. PRIMARY KEY (`id`)
  67. ) ENGINE=InnoDB
  68. CREATE TABLE `dungandbodyhistory` (
  69. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  70. `barname` varchar(50) DEFAULT NULL COMMENT '栏舍名称',
  71. `standardscore` varchar(50) DEFAULT NULL COMMENT '标准分数',
  72. `barid` bigint(20) DEFAULT NULL COMMENT '栏舍id',
  73. `cowsum` varchar(50) DEFAULT NULL COMMENT '牛头数',
  74. `onescore` varchar(50) DEFAULT NULL COMMENT '1',
  75. `twoscore` varchar(50) DEFAULT NULL COMMENT '2',
  76. `threescore` varchar(50) DEFAULT NULL COMMENT '3',
  77. `fourscore` varchar(50) DEFAULT NULL COMMENT '4',
  78. `fivescore` varchar(50) DEFAULT NULL COMMENT '5',
  79. `pastureid` bigint(20) DEFAULT NULL COMMENT '牧场id',
  80. `species` varchar(50) DEFAULT NULL COMMENT '种类',
  81. `changetime` datetime DEFAULT NULL COMMENT '操作时间',
  82. `sixscore` varchar(50) DEFAULT NULL COMMENT '6',
  83. `sevenscore` varchar(50) DEFAULT NULL COMMENT '7',
  84. PRIMARY KEY (`id`)
  85. ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
  86. -- 增加牲畜类别其他
  87. INSERT INTO `tmrwatch2`.`dictlist`(`pid`, `label`, `value`, `orderby`) VALUES (17, '其他', '6', 6)
  88. downloadplandtl2 `pastureid`, `pid` 索引
  89. feedpdate 调整索引顺序 `pastureid`, `date`, `barid`
  90. feedpdate 索引 pastureid, date, ftid
  91. fpdetaildate 调整索引顺序 `date`, `barid`, `pastureid`, `times`
  92. pennsieve,dungsieve,dungscore,bodyscore
  93. CREATE TABLE `log` (
  94. `id` int(11) NOT NULL AUTO_INCREMENT,
  95. `method` varchar(255) DEFAULT NULL,
  96. `status` varchar(255) DEFAULT NULL,
  97. `data` longtext DEFAULT NULL,
  98. `date` datetime DEFAULT NULL,
  99. PRIMARY KEY (`id`)
  100. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;