Advertisement
akozhomka

Untitled

Apr 20th, 2021
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. #
  2. # alter table wms.wms_in
  3. # drop foreign key wms_in_ibfk_1;
  4. #
  5. #
  6. #
  7. # create index idx_wms_in_supplier_id_document_id_create_date
  8. # on wms.wms_in (supplier_id, document_id, create_date);
  9. #
  10. #
  11. # ALTER TABLE wms.wms_product_in
  12. # drop foreign key wms_product_in_ibfk_2
  13. # , drop foreign key wms_product_in_ibfk_3
  14. # , drop foreign key wms_product_in_ibfk_4;
  15. #
  16. # UPDATE wms.wms_product_in
  17. # SET invoice_id = -1
  18. # WHERE invoice_id IS NULL;
  19. #
  20. # UPDATE wms.wms_product_in
  21. # SET fin_in_id = -1
  22. # WHERE fin_in_id IS NULL;
  23. #
  24. # ALTER TABLE wms.wms_product_in
  25. # modify document_id varchar(100) default '' not null
  26. # , modify invoice_id int default -1 not null
  27. # , modify fin_in_id int default -1 not null
  28. # , add index idx_wms_product_in_id (document_id, fin_in_id, invoice_id);
  29. #
  30. #
  31. #
  32. # create table if not exists wms.wms_in_new
  33. # (
  34. # id int(11) unsigned auto_increment
  35. # primary key,
  36. # document_id varchar(100) default '' not null,
  37. # supplier_id int default -1 not null,
  38. # create_date datetime default CURRENT_TIMESTAMP not null,
  39. # constraint unique (document_id)
  40. # , index (document_id, supplier_id, create_date)
  41. # )
  42. # charset = utf8;
  43. #
  44. #
  45. #
  46. # create table wms.wms_product_in_new
  47. # (
  48. # id int(11) unsigned auto_increment
  49. # primary key,
  50. # document_id varchar(100) default '' not null,
  51. # pa_id int null,
  52. # invoice_id int default -1 not null,
  53. # fin_in_id int default -1 not null,
  54. # cost decimal(10, 2) null,
  55. # remark varchar(255) null,
  56. # date_prihod datetime null,
  57. # name varchar(255) null,
  58. # foreign key (pa_id) references yii_doc.prices_all (id)
  59. # , index (document_id, fin_in_id, invoice_id)
  60. # , index (fin_in_id)
  61. # , index (invoice_id)
  62. # )
  63. # charset = utf8;
  64.  
  65. # create index idx_wms_product_new_in_id
  66. # on wms.wms_product_in (document_id, fin_in_id, invoice_id);
  67. #
  68. # create index fin_in_id_new
  69. # on wms.wms_product_in (fin_in_id);
  70. #
  71. # create index invoice_id_new
  72. # on wms.wms_product_in (invoice_id);
  73. #
  74. # create index pa_id_new
  75. # on wms.wms_product_in (pa_id);
  76. #
  77. # grant insert, select, update on table wms.wms_product_in to developer_anton@localhost;
  78. #
  79. # INSERT INTO wms.wms_product_in_new
  80. # SELECT *
  81. # FROM wms.wms_product_in;
  82. #
  83. # RENAME TABLE wms.wms_product_in TO wms.wms_product_in_TO_REMOVE_2;
  84. # RENAME TABLE wms.wms_product_in_new TO wms.wms_product_in;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement