m181220_080234_translate_database.php 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <?php
  2. use yii\db\Migration;
  3. class m181220_080234_translate_database extends Migration
  4. {
  5. public function up()
  6. {
  7. $this->renameTable('commande', 'order') ;
  8. $this->renameColumn('order', 'id_point_vente', 'id_point_sale') ;
  9. $this->renameColumn('order', 'id_production', 'id_distribution') ;
  10. $this->renameColumn('order', 'commentaire', 'comment') ;
  11. $this->renameColumn('order', 'commentaire_point_vente', 'comment_point_sale') ;
  12. $this->renameColumn('order', 'paiement_automatique', 'auto_payment') ;
  13. $this->renameTable('commande_auto', 'subscription') ;
  14. $this->renameColumn('subscription', 'id_etablissement', 'id_producer') ;
  15. $this->renameColumn('subscription', 'date_debut', 'date_debin') ;
  16. $this->renameColumn('subscription', 'date_fin', 'date_end') ;
  17. $this->renameColumn('subscription', 'lundi', 'monday') ;
  18. $this->renameColumn('subscription', 'mardi', 'tuesday') ;
  19. $this->renameColumn('subscription', 'mercredi', 'wednesday') ;
  20. $this->renameColumn('subscription', 'jeudi', 'thursday') ;
  21. $this->renameColumn('subscription', 'vendredi', 'friday') ;
  22. $this->renameColumn('subscription', 'samedi', 'saterday') ;
  23. $this->renameColumn('subscription', 'dimanche', 'sunday') ;
  24. $this->renameColumn('subscription', 'periodicite_semaine', 'week_frequency') ;
  25. $this->renameColumn('subscription', 'id_point_vente', 'id_point_sale') ;
  26. $this->renameColumn('subscription', 'paiement_automatique', 'auto_payment') ;
  27. $this->renameTable('commande_auto_produit', 'product_subscription') ;
  28. $this->renameColumn('product_subscription', 'id_commande_auto', 'id_subscription') ;
  29. $this->renameColumn('product_subscription', 'id_produit', 'id_product') ;
  30. $this->renameColumn('product_subscription', 'quantite', 'quantity') ;
  31. $this->renameTable('commande_produit', 'product_order') ;
  32. $this->renameColumn('product_order', 'id_commande', 'id_order') ;
  33. $this->renameColumn('product_order', 'id_produit', 'id_product') ;
  34. $this->renameColumn('product_order', 'quantite', 'quantity') ;
  35. $this->renameColumn('product_order', 'prix', 'price') ;
  36. $this->renameColumn('product_order', 'mode_vente', 'sale_mode') ;
  37. $this->renameTable('credit_historique', 'credit_history') ;
  38. $this->renameColumn('credit_history', 'id_commande', 'id_order') ;
  39. $this->renameColumn('credit_history', 'montant', 'amount') ;
  40. $this->renameColumn('credit_history', 'id_etablissement', 'id_producer') ;
  41. $this->renameColumn('credit_history', 'moyen_paiement', 'mean_payment') ;
  42. $this->renameColumn('credit_history', 'commentaire', 'comment') ;
  43. $this->renameTable('developpement', 'development') ;
  44. $this->renameColumn('development', 'objet', 'subject') ;
  45. $this->renameColumn('development', 'avancement', 'progress') ;
  46. $this->renameColumn('development', 'statut', 'status') ;
  47. $this->renameColumn('development', 'estimation_temps', 'time_estimate') ;
  48. $this->renameColumn('development', 'date_livraison', 'date_delivery') ;
  49. $this->renameTable('developpement_priorite', 'development_priority') ;
  50. $this->renameColumn('development_priority', 'id_developpement', 'id_development') ;
  51. $this->renameColumn('development_priority', 'id_etablissement', 'id_producer') ;
  52. $this->renameColumn('development_priority', 'priorite', 'priority') ;
  53. $this->renameTable('etablissement', 'producer') ;
  54. $this->dropColumn('producer', 'gratuit') ;
  55. $this->renameColumn('producer', 'nom', 'name') ;
  56. $this->renameColumn('producer', 'code_postal', 'postcode') ;
  57. $this->renameColumn('producer', 'ville', 'city') ;
  58. $this->renameColumn('producer', 'date_paiement', 'date_payment') ;
  59. $this->renameColumn('producer', 'heure_limite_commande', 'order_deadline') ;
  60. $this->renameColumn('producer', 'delai_commande', 'order_delay') ;
  61. $this->renameColumn('producer', 'solde_negatif', 'negative_balance') ;
  62. $this->renameColumn('producer', 'credit_pain', 'credit') ;
  63. $this->renameColumn('producer', 'actif', 'active') ;
  64. $this->renameColumn('producer', 'prix_libre', 'free_price') ;
  65. $this->renameColumn('producer', 'infos_commande', 'order_infos') ;
  66. $this->renameTable('facture', 'invoice') ;
  67. $this->renameColumn('invoice', 'id_etablissement', 'id_producer') ;
  68. $this->renameColumn('invoice', 'libelle', 'wording') ;
  69. $this->renameColumn('invoice', 'texte', 'text') ;
  70. $this->renameColumn('invoice', 'montant_ht', 'amount_without_tax') ;
  71. $this->renameColumn('invoice', 'paye', 'paid') ;
  72. $this->renameColumn('invoice', 'date_paiement', 'date_payment') ;
  73. $this->renameColumn('invoice', 'methode_paiement', 'mean_payment') ;
  74. $this->renameColumn('invoice', 'periode', 'period') ;
  75. $this->renameColumn('invoice', 'ca', 'turnover') ;
  76. $this->renameTable('point_vente', 'point_sale') ;
  77. $this->dropColumn('point_sale', 'pain') ;
  78. $this->dropColumn('point_sale', 'vrac') ;
  79. $this->renameColumn('point_sale', 'nom', 'name') ;
  80. $this->renameColumn('point_sale', 'adresse', 'address') ;
  81. $this->renameColumn('point_sale', 'horaires_lundi', 'infos_monday') ;
  82. $this->renameColumn('point_sale', 'horaires_mardi', 'infos_tuesday') ;
  83. $this->renameColumn('point_sale', 'horaires_mercredi', 'infos_wednesday') ;
  84. $this->renameColumn('point_sale', 'horaires_jeudi', 'infos_thursday') ;
  85. $this->renameColumn('point_sale', 'horaires_vendredi', 'infos_friday') ;
  86. $this->renameColumn('point_sale', 'horaires_samedi', 'infos_saterday') ;
  87. $this->renameColumn('point_sale', 'horaires_dimanche', 'infos_sunday') ;
  88. $this->renameColumn('point_sale', 'localite', 'locality') ;
  89. $this->renameColumn('point_sale', 'point_fabrication', 'point_production') ;
  90. $this->renameColumn('point_sale', 'id_etablissement', 'id_producer') ;
  91. $this->renameColumn('point_sale', 'acces_restreint', 'restricted_access') ;
  92. $this->renameColumn('point_sale', 'credit_pain', 'credit') ;
  93. $this->renameColumn('point_sale', 'livraison_lundi', 'delivery_monday') ;
  94. $this->renameColumn('point_sale', 'livraison_mardi', 'delivery_tuesday') ;
  95. $this->renameColumn('point_sale', 'livraison_mercredi', 'delivery_wednesday') ;
  96. $this->renameColumn('point_sale', 'livraison_jeudi', 'delivery_thursday') ;
  97. $this->renameColumn('point_sale', 'livraison_vendredi', 'delivery_friday') ;
  98. $this->renameColumn('point_sale', 'livraison_samedi', 'delivery_saterday') ;
  99. $this->renameColumn('point_sale', 'livraison_dimanche', 'delivery_sunday') ;
  100. $this->renameTable('point_vente_user', 'user_point_sale') ;
  101. $this->renameColumn('user_point_sale', 'id_point_vente', 'id_point_sale') ;
  102. $this->renameColumn('user_point_sale', 'commentaire', 'comment') ;
  103. $this->renameTable('production', 'distribution') ;
  104. $this->renameColumn('distribution', 'actif', 'active') ;
  105. $this->renameColumn('distribution', 'livraison', 'delivery') ;
  106. $this->renameColumn('distribution', 'id_etablissement', 'id_producer') ;
  107. $this->renameTable('production_point_vente', 'point_sale_distribution') ;
  108. $this->renameColumn('point_sale_distribution', 'id_production', 'id_distribution') ;
  109. $this->renameColumn('point_sale_distribution', 'id_point_vente', 'id_point_sale') ;
  110. $this->renameColumn('point_sale_distribution', 'livraison', 'delivery') ;
  111. $this->renameTable('production_produit', 'product_distribution') ;
  112. $this->renameColumn('product_distribution', 'id_production', 'id_distribution') ;
  113. $this->renameColumn('product_distribution', 'id_produit', 'id_product') ;
  114. $this->renameColumn('product_distribution', 'actif', 'active') ;
  115. $this->renameColumn('product_distribution', 'quantite_max', 'quantity_max') ;
  116. $this->renameTable('produit', 'product') ;
  117. $this->dropColumn('product', 'illustration') ;
  118. $this->dropColumn('product', 'saison') ;
  119. $this->dropColumn('product', 'diminutif') ;
  120. $this->dropColumn('product', 'vrac') ;
  121. $this->renameColumn('product', 'nom', 'name') ;
  122. $this->renameColumn('product', 'actif', 'active') ;
  123. $this->renameColumn('product', 'prix', 'price') ;
  124. $this->renameColumn('product', 'poids', 'weight') ;
  125. $this->renameColumn('product', 'recette', 'recipe') ;
  126. $this->renameColumn('product', 'lundi', 'monday') ;
  127. $this->renameColumn('product', 'mardi', 'tuesday') ;
  128. $this->renameColumn('product', 'mercredi', 'wednesday') ;
  129. $this->renameColumn('product', 'jeudi', 'thursday') ;
  130. $this->renameColumn('product', 'vendredi', 'friday') ;
  131. $this->renameColumn('product', 'samedi', 'saterday') ;
  132. $this->renameColumn('product', 'dimanche', 'sunday') ;
  133. $this->renameColumn('product', 'quantite_max', 'quantity_max') ;
  134. $this->renameColumn('product', 'epuise', 'unavailable') ;
  135. $this->renameColumn('product', 'id_etablissement', 'id_producer') ;
  136. $this->renameColumn('product', 'mode_vente', 'sale_mode') ;
  137. $this->dropColumn('user', 'confiance') ;
  138. $this->renameColumn('user', 'nom', 'lastname') ;
  139. $this->renameColumn('user', 'prenom', 'name') ;
  140. $this->renameColumn('user', 'telephone', 'phone') ;
  141. $this->renameColumn('user', 'adresse', 'address') ;
  142. $this->renameColumn('user', 'mail_prod_lundi', 'mail_distribution_monday') ;
  143. $this->renameColumn('user', 'mail_prod_mardi', 'mail_distribution_tuesday') ;
  144. $this->renameColumn('user', 'mail_prod_mercredi', 'mail_distribution_wednesday') ;
  145. $this->renameColumn('user', 'mail_prod_jeudi', 'mail_distribution_thursday') ;
  146. $this->renameColumn('user', 'mail_prod_vendredi', 'mail_distribution_friday') ;
  147. $this->renameColumn('user', 'mail_prod_samedi', 'mail_distribution_saterday') ;
  148. $this->renameColumn('user', 'mail_prod_dimanche', 'mail_distribution_sunday') ;
  149. $this->renameColumn('user', 'id_etablissement', 'id_producer') ;
  150. $this->renameColumn('user', 'date_derniere_connexion', 'date_last_connection') ;
  151. $this->renameTable('user_etablissement', 'user_producer') ;
  152. $this->renameColumn('user_producer', 'id_etablissement', 'id_producer') ;
  153. $this->renameColumn('user_producer', 'actif', 'active') ;
  154. $this->renameColumn('user_producer', 'favoris', 'bookmark') ;
  155. }
  156. public function down()
  157. {
  158. $this->renameTable('order', 'commande') ;
  159. $this->renameColumn('commande', 'id_point_sale', 'id_point_vente') ;
  160. $this->renameColumn('commande', 'id_distribution', 'id_production') ;
  161. $this->renameColumn('commande', 'comment', 'commentaire') ;
  162. $this->renameColumn('commande', 'comment_point_sale', 'commentaire_point_vente') ;
  163. $this->renameColumn('commande', 'auto_payment', 'paiement_automatique') ;
  164. $this->renameTable('subscription', 'commande_auto') ;
  165. $this->renameColumn('commande_auto', 'id_producer', 'id_etablissement') ;
  166. $this->renameColumn('commande_auto', 'date_debin', 'date_debut') ;
  167. $this->renameColumn('commande_auto', 'date_end', 'date_fin') ;
  168. $this->renameColumn('commande_auto', 'monday', 'lundi') ;
  169. $this->renameColumn('commande_auto', 'tuesday', 'mardi') ;
  170. $this->renameColumn('commande_auto', 'wednesday', 'mercredi') ;
  171. $this->renameColumn('commande_auto', 'thursday', 'jeudi') ;
  172. $this->renameColumn('commande_auto', 'friday', 'vendredi') ;
  173. $this->renameColumn('commande_auto', 'saterday', 'samedi') ;
  174. $this->renameColumn('commande_auto', 'sunday', 'dimanche') ;
  175. $this->renameColumn('commande_auto', 'week_frequency', 'periodicite_semaine') ;
  176. $this->renameColumn('commande_auto', 'id_point_sale', 'id_point_vente') ;
  177. $this->renameColumn('commande_auto', 'auto_payment', 'paiement_automatique') ;
  178. $this->renameTable('product_subscription', 'commande_auto_produit') ;
  179. $this->renameColumn('commande_auto_produit', 'id_subscription', 'id_commande_auto') ;
  180. $this->renameColumn('commande_auto_produit', 'id_product', 'id_produit') ;
  181. $this->renameColumn('commande_auto_produit', 'quantity', 'quantite') ;
  182. $this->renameTable('product_order', 'commande_produit') ;
  183. $this->renameColumn('commande_produit', 'id_order', 'id_commande') ;
  184. $this->renameColumn('commande_produit', 'id_product', 'id_produit') ;
  185. $this->renameColumn('commande_produit', 'quantity', 'quantite') ;
  186. $this->renameColumn('commande_produit', 'price', 'prix') ;
  187. $this->renameColumn('commande_produit', 'sale_mode', 'mode_vente') ;
  188. $this->renameTable('credit_history', 'credit_historique') ;
  189. $this->renameColumn('credit_historique', 'id_order', 'id_commande') ;
  190. $this->renameColumn('credit_historique', 'amount', 'montant') ;
  191. $this->renameColumn('credit_historique', 'id_producer', 'id_etablissement') ;
  192. $this->renameColumn('credit_historique', 'mean_payment', 'moyen_paiement') ;
  193. $this->renameColumn('credit_historique', 'comment', 'commentaire') ;
  194. $this->renameTable('development', 'developpement') ;
  195. $this->renameColumn('developpement', 'subject', 'objet') ;
  196. $this->renameColumn('developpement', 'progress', 'avancement') ;
  197. $this->renameColumn('developpement', 'status', 'statut') ;
  198. $this->renameColumn('developpement', 'time_estimate', 'estimation_temps') ;
  199. $this->renameColumn('developpement', 'date_delivery', 'date_livraison') ;
  200. $this->renameTable('development_priority', 'developpement_priorite') ;
  201. $this->renameColumn('developpement_priorite', 'id_development', 'id_developpement') ;
  202. $this->renameColumn('developpement_priorite', 'id_producer', 'id_etablissement') ;
  203. $this->renameColumn('developpement_priorite', 'priority', 'priorite') ;
  204. $this->renameTable('producer', 'etablissement') ;
  205. $this->addColumn('etablissement', 'gratuit', 'boolean') ;
  206. $this->renameColumn('etablissement', 'name', 'nom') ;
  207. $this->renameColumn('etablissement', 'postcode', 'code_postal') ;
  208. $this->renameColumn('etablissement', 'city', 'ville') ;
  209. $this->renameColumn('etablissement', 'date_payment', 'date_paiement') ;
  210. $this->renameColumn('etablissement', 'order_deadline', 'heure_limite_commande') ;
  211. $this->renameColumn('etablissement', 'order_delay', 'delai_commande') ;
  212. $this->renameColumn('etablissement', 'negative_balance', 'solde_negatif') ;
  213. $this->renameColumn('etablissement', 'credit', 'credit_pain') ;
  214. $this->renameColumn('etablissement', 'active', 'actif') ;
  215. $this->renameColumn('etablissement', 'free_price', 'prix_libre') ;
  216. $this->renameColumn('etablissement', 'order_infos', 'infos_commande') ;
  217. $this->renameTable('invoice', 'facture') ;
  218. $this->renameColumn('facture', 'id_producer', 'id_etablissement') ;
  219. $this->renameColumn('facture', 'wording', 'libelle') ;
  220. $this->renameColumn('facture', 'text', 'texte') ;
  221. $this->renameColumn('facture', 'amount_without_tax', 'montant_ht') ;
  222. $this->renameColumn('facture', 'paid', 'paye') ;
  223. $this->renameColumn('facture', 'date_payment', 'date_paiement') ;
  224. $this->renameColumn('facture', 'mean_payment', 'methode_paiement') ;
  225. $this->renameColumn('facture', 'period', 'periode') ;
  226. $this->renameColumn('facture', 'turnover', 'ca') ;
  227. $this->renameTable('point_sale', 'point_vente') ;
  228. $this->addColumn('point_vente', 'pain', 'boolean') ;
  229. $this->addColumn('point_vente', 'vrac', 'boolean') ;
  230. $this->renameColumn('point_vente', 'name', 'nom') ;
  231. $this->renameColumn('point_vente', 'address', 'adresse') ;
  232. $this->renameColumn('point_vente', 'infos_monday', 'horaires_lundi') ;
  233. $this->renameColumn('point_vente', 'infos_tuesday', 'horaires_mardi') ;
  234. $this->renameColumn('point_vente', 'infos_wednesday', 'horaires_mercredi') ;
  235. $this->renameColumn('point_vente', 'infos_thursday', 'horaires_jeudi') ;
  236. $this->renameColumn('point_vente', 'infos_friday', 'horaires_vendredi') ;
  237. $this->renameColumn('point_vente', 'infos_saterday', 'horaires_samedi') ;
  238. $this->renameColumn('point_vente', 'infos_sunday', 'horaires_dimanche') ;
  239. $this->renameColumn('point_vente', 'locality', 'localite') ;
  240. $this->renameColumn('point_vente', 'point_production', 'point_fabrication') ;
  241. $this->renameColumn('point_vente', 'id_producer', 'id_etablissement') ;
  242. $this->renameColumn('point_vente', 'restricted_access', 'access_restreint') ;
  243. $this->renameColumn('point_vente', 'credit', 'credit_pain') ;
  244. $this->renameColumn('point_vente', 'delivery_monday', 'livraison_lundi') ;
  245. $this->renameColumn('point_vente', 'delivery_tuesday', 'livraison_mardi') ;
  246. $this->renameColumn('point_vente', 'delivery_wednesday', 'livraison_mercredi') ;
  247. $this->renameColumn('point_vente', 'delivery_thursday', 'livraison_jeudi') ;
  248. $this->renameColumn('point_vente', 'delivery_friday', 'livraison_vendredi') ;
  249. $this->renameColumn('point_vente', 'delivery_saterday', 'livraison_samedi') ;
  250. $this->renameColumn('point_vente', 'delivery_sunday', 'livraison_dimanche') ;
  251. $this->renameTable('user_point_sale', 'point_vente_user') ;
  252. $this->renameColumn('point_vente_user', 'id_point_sale', 'id_point_vente') ;
  253. $this->renameColumn('point_vente_user', 'comment', 'commentaire') ;
  254. $this->renameTable('distribution', 'production') ;
  255. $this->renameColumn('production', 'active', 'actif') ;
  256. $this->renameColumn('production', 'delivery', 'livraison') ;
  257. $this->renameColumn('production', 'id_producer', 'id_etablissement') ;
  258. $this->renameTable('point_sale_distribution', 'production_point_vente') ;
  259. $this->renameColumn('production_point_vente', 'id_distribution', 'id_production') ;
  260. $this->renameColumn('production_point_vente', 'id_point_sale', 'id_point_vente') ;
  261. $this->renameColumn('production_point_vente', 'delivery', 'livraison') ;
  262. $this->renameTable('product_distribution', 'production_produit') ;
  263. $this->renameColumn('production_produit', 'id_distribution', 'id_production') ;
  264. $this->renameColumn('production_produit', 'id_product', 'id_produit') ;
  265. $this->renameColumn('production_produit', 'active', 'actif') ;
  266. $this->renameColumn('production_produit', 'quantity_max', 'quantite_max') ;
  267. $this->renameTable('product', 'produit') ;
  268. $this->addColumn('produit', 'illustration', 'varchar(255)') ;
  269. $this->addColumn('produit', 'saison', 'varchar(255)') ;
  270. $this->addColumn('produit', 'diminutif', 'varchar(255)') ;
  271. $this->addColumn('produit', 'vrac', 'boolean') ;
  272. $this->renameColumn('produit', 'name', 'nom') ;
  273. $this->renameColumn('produit', 'active', 'actif') ;
  274. $this->renameColumn('produit', 'price', 'prix') ;
  275. $this->renameColumn('produit', 'weight', 'poids') ;
  276. $this->renameColumn('produit', 'recipe', 'recette') ;
  277. $this->renameColumn('produit', 'monday', 'lundi') ;
  278. $this->renameColumn('produit', 'tuesday', 'mardi') ;
  279. $this->renameColumn('produit', 'wednesday', 'mercredi') ;
  280. $this->renameColumn('produit', 'thursday', 'jeudi') ;
  281. $this->renameColumn('produit', 'friday', 'vendredi') ;
  282. $this->renameColumn('produit', 'saterday', 'samedi') ;
  283. $this->renameColumn('produit', 'sunday', 'dimanche') ;
  284. $this->renameColumn('produit', 'quantity_max', 'quantite_max') ;
  285. $this->renameColumn('produit', 'unavailable', 'epuise') ;
  286. $this->renameColumn('produit', 'id_producer', 'id_etablissement') ;
  287. $this->renameColumn('produit', 'sale_mode', 'mode_vente') ;
  288. $this->addColumn('user', 'confiance', 'boolean') ;
  289. $this->renameColumn('user', 'lastname', 'nom') ;
  290. $this->renameColumn('user', 'name', 'prenom') ;
  291. $this->renameColumn('user', 'phone', 'telephone') ;
  292. $this->renameColumn('user', 'address', 'adresse') ;
  293. $this->renameColumn('user', 'mail_distribution_monday', 'mail_prod_lundi') ;
  294. $this->renameColumn('user', 'mail_distribution_tuesday', 'mail_prod_mardi') ;
  295. $this->renameColumn('user', 'mail_distribution_wednesday', 'mail_prod_mercredi') ;
  296. $this->renameColumn('user', 'mail_distribution_thursday', 'mail_prod_jeudi') ;
  297. $this->renameColumn('user', 'mail_distribution_friday', 'mail_prod_vendredi') ;
  298. $this->renameColumn('user', 'mail_distribution_saterday', 'mail_prod_samedi') ;
  299. $this->renameColumn('user', 'mail_distribution_sunday', 'mail_prod_dimanche') ;
  300. $this->renameColumn('user', 'id_producer', 'id_etablissement') ;
  301. $this->renameColumn('user', 'date_last_connection', 'date_derniere_connexion') ;
  302. $this->renameTable('user_producer', 'user_etablissement') ;
  303. $this->renameColumn('user_etablissement', 'id_producer', 'id_etablissement') ;
  304. $this->renameColumn('user_etablissement', 'active', 'actif') ;
  305. $this->renameColumn('user_etablissement', 'bookmark', 'favoris') ;
  306. }
  307. }