-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 24, 2026 at 07:18 PM
-- Wersja serwera: 10.4.32-MariaDB
-- Wersja PHP: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `atelier_20260227`
--

-- --------------------------------------------------------

--
-- Struktura tabeli dla tabeli `price_change_notification_item`
--

CREATE TABLE `price_change_notification_item` (
  `id` int(11) NOT NULL,
  `batch_id` int(11) NOT NULL,
  `supplier_product_price_list_id` int(11) NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `valid_from` date NOT NULL,
  `price_net` decimal(10,2) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Indeksy dla zrzutów tabel
--

--
-- Indeksy dla tabeli `price_change_notification_item`
--
ALTER TABLE `price_change_notification_item`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_pcn_item_price_list` (`supplier_product_price_list_id`),
  ADD KEY `idx_pcn_item_batch_id` (`batch_id`),
  ADD KEY `idx_pcn_item_product_id` (`product_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `price_change_notification_item`
--
ALTER TABLE `price_change_notification_item`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `price_change_notification_item`
--
ALTER TABLE `price_change_notification_item`
  ADD CONSTRAINT `fk_pcn_item_batch` FOREIGN KEY (`batch_id`) REFERENCES `price_change_notification_batch` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_pcn_item_price_list` FOREIGN KEY (`supplier_product_price_list_id`) REFERENCES `supplier_product_price_list` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `price_change_notification_item_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `supplier_catalog_product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
