Files
orderPRO/database/migrations/20260305_000031_allegro_per_environment_credentials.sql
Jacek Pyziak 1b5e403c31 Add Allegro shipment service and related components
- Implement AllegroShipmentService for managing shipment creation and status checks.
- Create ShipmentController to handle shipment preparation and label downloading.
- Introduce ShipmentPackageRepository for database interactions related to shipment packages.
- Add methods for retrieving delivery services, creating shipments, checking creation status, and downloading labels.
- Implement address validation and token management for Allegro API integration.
2026-03-06 01:06:59 +01:00

27 lines
1.2 KiB
SQL

-- Rozdzielenie credentials Allegro per environment (sandbox / production).
-- Dotychczas jeden wiersz (id=1) przechowywał dane obu środowisk.
-- Po migracji: po jednym wierszu na environment, UNIQUE KEY na environment.
-- Repository odpytuje wiersze po `WHERE environment = :env` zamiast `WHERE id = 1`.
-- 1. Zmien PK na AUTO_INCREMENT, dodaj UNIQUE KEY na environment
ALTER TABLE allegro_integration_settings
MODIFY id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
ADD UNIQUE KEY allegro_integration_settings_env_unique (environment);
-- 2. Wstaw brakujący wiersz dla drugiego środowiska (puste credentials)
INSERT INTO allegro_integration_settings (environment, orders_fetch_enabled, created_at, updated_at)
SELECT
CASE WHEN environment = 'sandbox' THEN 'production' ELSE 'sandbox' END,
0,
NOW(),
NOW()
FROM allegro_integration_settings
WHERE id = 1
ON DUPLICATE KEY UPDATE updated_at = VALUES(updated_at);
-- 3. Zapisz aktywne srodowisko w app_settings (na podstawie istniejacego wiersza)
INSERT INTO app_settings (setting_key, setting_value, updated_at)
SELECT 'allegro_active_environment', environment, NOW()
FROM allegro_integration_settings WHERE id = 1
ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value), updated_at = NOW();