7.6-update.sql 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. SET NAMES utf8;
  2. SET time_zone = '+00:00';
  3. SET foreign_key_checks = 0;
  4. SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
  5. ALTER TABLE `{%TABLE_PREFIX%}offers`
  6. ADD `receiver_id` INT(11) NULL
  7. AFTER `user_id`,
  8. ADD `topic_id` INT NULL
  9. AFTER `id`,
  10. CHANGE `status` `status` ENUM('pending', 'declined', 'accepted', 'withdrawn', 'counter')
  11. COLLATE 'utf8_general_ci' NOT NULL DEFAULT 'pending'
  12. AFTER `amount`;
  13. ALTER TABLE `{%TABLE_PREFIX%}offers`
  14. ADD INDEX `topic_id` (`topic_id`);
  15. ALTER TABLE `{%TABLE_PREFIX%}offers`
  16. ADD FOREIGN KEY (`topic_id`) REFERENCES `{%TABLE_PREFIX%}offers` (`id`)
  17. ON DELETE CASCADE
  18. ON UPDATE RESTRICT;
  19. ALTER TABLE `{%TABLE_PREFIX%}offers`
  20. ADD INDEX `receiver_id` (`receiver_id`);
  21. ALTER TABLE `{%TABLE_PREFIX%}offers`
  22. ADD FOREIGN KEY (`receiver_id`) REFERENCES `{%TABLE_PREFIX%}users` (`id`)
  23. ON DELETE SET NULL
  24. ON UPDATE RESTRICT;
  25. UPDATE `{%TABLE_PREFIX%}offers`
  26. SET `receiver_id` = (SELECT `user_id`
  27. FROM `{%TABLE_PREFIX%}listings`
  28. WHERE `{%TABLE_PREFIX%}listings`.`id` = `{%TABLE_PREFIX%}offers`.`listing_id`)
  29. WHERE `receiver_id` IS NULL;
  30. INSERT INTO `{%TABLE_PREFIX%}settings`
  31. (`name`, `value`) VALUES
  32. ('character_length', ''),
  33. ('enable_auctions_in_stores', ''),
  34. ('stores_force_list_in_both', '');