Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

m200103_085550_module_devis_bl_facture.php 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. use yii\db\Migration;
  3. use yii\db\Schema;
  4. class m200103_085550_module_devis_bl_facture extends Migration
  5. {
  6. public function up()
  7. {
  8. // invoice
  9. $this->dropTable('invoice') ;
  10. $this->createTable('invoice', [
  11. 'id' => 'pk',
  12. 'name' => Schema::TYPE_STRING,
  13. 'reference' => Schema::TYPE_STRING,
  14. 'date' => Schema::TYPE_DATETIME,
  15. 'comment' => Schema::TYPE_TEXT,
  16. 'id_user' => Schema::TYPE_INTEGER,
  17. 'address' => Schema::TYPE_TEXT,
  18. 'city' => Schema::TYPE_STRING,
  19. 'postcode' => Schema::TYPE_STRING,
  20. ]);
  21. // quotation
  22. $this->createTable('quotation', [
  23. 'id' => 'pk',
  24. 'name' => Schema::TYPE_STRING,
  25. 'reference' => Schema::TYPE_STRING,
  26. 'date' => Schema::TYPE_DATETIME,
  27. 'comment' => Schema::TYPE_TEXT,
  28. 'id_user' => Schema::TYPE_INTEGER,
  29. 'address' => Schema::TYPE_TEXT,
  30. 'city' => Schema::TYPE_STRING,
  31. 'postcode' => Schema::TYPE_STRING,
  32. ]);
  33. // delivery_note
  34. $this->createTable('delivery_note', [
  35. 'id' => 'pk',
  36. 'name' => Schema::TYPE_STRING,
  37. 'reference' => Schema::TYPE_STRING,
  38. 'date' => Schema::TYPE_DATETIME,
  39. 'comment' => Schema::TYPE_TEXT,
  40. 'id_point_sale_distribution' => Schema::TYPE_INTEGER,
  41. 'id_user' => Schema::TYPE_INTEGER,
  42. 'address' => Schema::TYPE_TEXT,
  43. 'city' => Schema::TYPE_STRING,
  44. 'postcode' => Schema::TYPE_STRING,
  45. ]);
  46. // order
  47. $this->addColumn('order', 'id_status', Schema::TYPE_INTEGER) ;
  48. $this->addColumn('order', 'id_invoice', Schema::TYPE_INTEGER) ;
  49. $this->addColumn('order', 'id_quotation', Schema::TYPE_INTEGER) ;
  50. $this->addColumn('order', 'id_delivery_note', Schema::TYPE_INTEGER) ;
  51. // order_status
  52. $this->createTable('order_status', [
  53. 'id' => 'pk',
  54. 'name' => Schema::TYPE_STRING,
  55. ]);
  56. // order_order_status
  57. $this->createTable('order_order_status', [
  58. 'id' => 'pk',
  59. 'id_order' => Schema::TYPE_INTEGER,
  60. 'id_order_status' => Schema::TYPE_INTEGER,
  61. 'date' => Schema::TYPE_DATETIME,
  62. ]);
  63. // product
  64. $this->addColumn('product', 'id_tax_rate', Schema::TYPE_INTEGER) ;
  65. // product_order
  66. $this->addColumn('product_order', 'id_tax_rate', Schema::TYPE_INTEGER) ;
  67. $this->addColumn('product_order', 'description', Schema::TYPE_TEXT) ;
  68. // tax_rate
  69. $this->createTable('tax_rate', [
  70. 'id' => 'pk',
  71. 'name' => Schema::TYPE_STRING,
  72. 'pourcent' => Schema::TYPE_FLOAT,
  73. ]);
  74. // producer
  75. $this->addColumn('producer', 'status', Schema::TYPE_STRING) ;
  76. $this->addColumn('producer', 'id_tax_rate_default', Schema::TYPE_INTEGER) ;
  77. $this->addColumn('producer', 'document_quotation_prefix', Schema::TYPE_STRING) ;
  78. $this->addColumn('producer', 'document_quotation_first_reference', Schema::TYPE_STRING) ;
  79. $this->addColumn('producer', 'document_quotation_duration', Schema::TYPE_INTEGER) ;
  80. $this->addColumn('producer', 'document_invoice_prefix', Schema::TYPE_STRING) ;
  81. $this->addColumn('producer', 'document_invoice_first_reference', Schema::TYPE_STRING) ;
  82. $this->addColumn('producer', 'document_delivery_note_prefix', Schema::TYPE_STRING) ;
  83. $this->addColumn('producer', 'document_delivery_note_first_reference', Schema::TYPE_STRING) ;
  84. $this->addColumn('producer', 'document_infos_bottom', Schema::TYPE_TEXT) ;
  85. $this->addColumn('producer', 'document_infos_quotation', Schema::TYPE_TEXT) ;
  86. $this->addColumn('producer', 'document_infos_invoice', Schema::TYPE_TEXT) ;
  87. $this->addColumn('producer', 'document_infos_delivery_note', Schema::TYPE_TEXT) ;
  88. }
  89. public function down()
  90. {
  91. // invoice
  92. $this->dropTable('invoice') ;
  93. // quotation
  94. $this->dropTable('quotation') ;
  95. // delivery_note
  96. $this->dropTable('delivery_note') ;
  97. // order
  98. $this->dropColumn('order', 'id_status') ;
  99. $this->dropColumn('order', 'id_invoice') ;
  100. $this->dropColumn('order', 'id_quotation') ;
  101. $this->dropColumn('order', 'id_delivery_note') ;
  102. // order_status
  103. $this->dropTable('order_status') ;
  104. // order_order_status
  105. $this->dropTable('order_order_status') ;
  106. // product
  107. $this->dropColumn('product', 'id_tax_rate') ;
  108. // product_order
  109. $this->dropColumn('product_order', 'id_tax_rate') ;
  110. $this->dropColumn('product_order', 'description') ;
  111. // tax_rate
  112. $this->dropTable('tax_rate') ;
  113. // producer
  114. $this->dropColumn('producer', 'status') ;
  115. $this->dropColumn('producer', 'id_tax_rate_default') ;
  116. $this->dropColumn('producer', 'document_quotation_prefix') ;
  117. $this->dropColumn('producer', 'document_quotation_first_reference') ;
  118. $this->dropColumn('producer', 'document_quotation_duration') ;
  119. $this->dropColumn('producer', 'document_invoice_prefix') ;
  120. $this->dropColumn('producer', 'document_invoice_first_reference') ;
  121. $this->dropColumn('producer', 'document_delivery_note_prefix') ;
  122. $this->dropColumn('producer', 'document_delivery_note_first_reference') ;
  123. $this->dropColumn('producer', 'document_infos_bottom') ;
  124. $this->dropColumn('producer', 'document_infos_quotation') ;
  125. $this->dropColumn('producer', 'document_infos_invoice') ;
  126. $this->dropColumn('producer', 'document_infos_delivery_note') ;
  127. }
  128. }