-- 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_batch`
--

CREATE TABLE `price_change_notification_batch` (
  `id` int(11) NOT NULL,
  `shop_id` int(11) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `notification_id` int(11) DEFAULT NULL,
  `status` enum('open','read','locked') NOT NULL DEFAULT 'open',
  `first_price_change_at` datetime NOT NULL DEFAULT current_timestamp(),
  `last_price_change_at` datetime NOT NULL DEFAULT current_timestamp(),
  `locked_at` datetime DEFAULT NULL,
  `read_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Indeksy dla tabeli `price_change_notification_batch`
--
ALTER TABLE `price_change_notification_batch`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_pcn_batch_shop_supplier_status` (`shop_id`,`supplier_id`,`status`),
  ADD KEY `idx_pcn_batch_notification_id` (`notification_id`),
  ADD KEY `idx_pcn_batch_last_price_change_at` (`last_price_change_at`);

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `price_change_notification_batch`
--
ALTER TABLE `price_change_notification_batch`
  ADD CONSTRAINT `fk_pcn_batch_notification` FOREIGN KEY (`notification_id`) REFERENCES `notification` (`id`) ON DELETE SET NULL 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 */;
