-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 19, 2026 at 03:02 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 `open_material_params`
--

CREATE TABLE `open_material_params` (
  `id` int(10) UNSIGNED NOT NULL,
  `material_id` int(11) NOT NULL COMMENT 'FK do materials – surowiec typu OPEN',
  `recommended_purchase_price` decimal(10,2) DEFAULT NULL COMMENT 'Rekomendowana cena zakupu brutto za opakowanie (waluta systemowa)',
  `package_size` decimal(12,4) DEFAULT NULL COMMENT 'Wielkość opakowania w jednostce bazowej surowca (g, ml, szt)',
  `package_description` varchar(255) DEFAULT NULL COMMENT 'Opis opakowania – pomocniczy tekst dla franczyzobiorcy',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Data utworzenia rekordu',
  `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Data ostatniej aktualizacji',
  `created_by` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID użytkownika, który utworzył rekord',
  `updated_by` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID użytkownika, który zaktualizował rekord'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Parametry referencyjne surowców OPEN: cena, wielkość i opis opakowania';

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

--
-- Indeksy dla tabeli `open_material_params`
--
ALTER TABLE `open_material_params`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uk_open_material_params_material` (`material_id`),
  ADD KEY `idx_omp_price` (`recommended_purchase_price`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `open_material_params`
--
ALTER TABLE `open_material_params`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `open_material_params`
--
ALTER TABLE `open_material_params`
  ADD CONSTRAINT `fk_omp_material` FOREIGN KEY (`material_id`) REFERENCES `material` (`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 */;
