-- https://www.phpmyadmin.net/
--
-- Gép: 127.0.0.1
-- Létrehozás ideje: 2025. Feb 15. 14:39
-- Kiszolgáló verziója: 10.4.32-MariaDB
-- PHP verzió: 8.2.12

START TRANSACTION;



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

--
-- Tábla szerkezet ehhez a táblához `clients`
--

CREATE TABLE `clients` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `teljes_nev` varchar(255) NOT NULL,
  `vezeteknev` varchar(255) NOT NULL,
  `keresztnev` varchar(255) NOT NULL,
  `megszolitas` varchar(255) NOT NULL,
  `vallalkozas_neve_cegnev` varchar(255) DEFAULT NULL,
  `kategoria` varchar(255) NOT NULL DEFAULT 'Új/egyszeri',
  `milyen` varchar(255) DEFAULT NULL,
  `viszony` varchar(255) NOT NULL DEFAULT 'Magázó',
  `telefon` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `megjegyzes` text DEFAULT NULL,
  `hirlevel` tinyint(1) NOT NULL DEFAULT 0,
  `kedvezmeny` tinyint(1) NOT NULL DEFAULT 0,
  `szerzodes_nev` varchar(255) NOT NULL,
  `szerzodes_anyja_neve` varchar(255) NOT NULL,
  `szerzodes_lakcim` varchar(255) NOT NULL,
  `szerzodes_szem_ig` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `contracts`
--

CREATE TABLE `contracts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `ugyfel` varchar(255) NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `ceg` tinyint(1) NOT NULL DEFAULT 0,
  `ajanlat` varchar(255) DEFAULT NULL,
  `csomag` bigint(20) UNSIGNED NOT NULL,
  `futamido_start` date NOT NULL,
  `futamido_end` date NOT NULL,
  `eloleg` int(11) DEFAULT NULL,
  `tipus` varchar(255) NOT NULL,
  `utikoltseg` int(11) DEFAULT NULL,
  `teljes_ar` int(11) NOT NULL,
  `megjegyzes` varchar(255) DEFAULT NULL,
  `erintett_diviziok` varchar(255) NOT NULL,
  `allapot` varchar(255) NOT NULL DEFAULT 'Előkészítés alatt',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `discounts`
--

CREATE TABLE `discounts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `kedvezmeny` varchar(255) NOT NULL,
  `mertek` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `invoices`
--

CREATE TABLE `invoices` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `szamla_szam` varchar(255) NOT NULL,
  `ugyfel` varchar(255) NOT NULL,
  `jelleg` varchar(255) NOT NULL,
  `tipus` varchar(255) NOT NULL,
  `fizetesi_mod` varchar(255) NOT NULL,
  `hatarido` date NOT NULL,
  `vegosszeg` int(11) NOT NULL,
  `kifizetve` tinyint(1) NOT NULL DEFAULT 0,
  `szerzodes_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- A tábla adatainak kiíratása `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '0001_01_01_000000_create_users_table', 1),
(2, '0001_01_01_000001_create_cache_table', 1),
(3, '0001_01_01_000002_create_jobs_table', 1),
(4, '2024_09_04_103648_add_two_factor_columns_to_users_table', 1),
(5, '2024_09_04_103731_create_personal_access_tokens_table', 1),
(6, '2024_09_04_110518_create_offers', 2),
(7, '2024_09_04_111127_create_clients', 3),
(8, '2024_09_04_111328_create_sales', 4),
(9, '2024_09_04_111620_create_tasks', 5),
(10, '2024_09_04_111742_update_users', 5),
(12, '2024_09_04_111901_create_discounts', 6),
(13, '2024_09_04_112241_create_workers', 7),
(14, '2024_09_04_112444_create_newsfeeds', 8),
(15, '2024_09_04_112526_create_projects', 9),
(16, '2024_09_04_112617_create_projectfeeds', 10),
(17, '2024_09_04_112721_create_invoices', 11),
(18, '2024_09_04_112809_create_contracts', 12),
(19, '2024_09_04_113301_create_packs', 12),
(20, '2024_09_04_113347_create_contracts', 13),
(21, '2024_09_04_113444_create_transactions', 14),
(22, '2024_09_06_155849_update_sales', 15);

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

--
-- Tábla szerkezet ehhez a táblához `newsfeeds`
--

CREATE TABLE `newsfeeds` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `cim` varchar(255) NOT NULL,
  `leiras` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `offers`
--

CREATE TABLE `offers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `sales_id` bigint(20) UNSIGNED DEFAULT NULL,
  `megnevezes` varchar(255) NOT NULL,
  `csomag` bigint(20) UNSIGNED NOT NULL,
  `arajanlat_ervenyessege` date NOT NULL,
  `eloleg` int(11) NOT NULL,
  `munkadij` int(11) NOT NULL,
  `utazasi_koltseg` int(11) NOT NULL,
  `teljes_ar` int(11) NOT NULL,
  `budget_ar` int(11) NOT NULL,
  `pro_ar` int(11) NOT NULL,
  `esedekesseg` varchar(255) NOT NULL,
  `leiras` text NOT NULL,
  `szerzodes_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `packs`
--

CREATE TABLE `packs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `csomagnev` varchar(255) NOT NULL,
  `ar` int(11) NOT NULL,
  `leiras` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `projectfeeds`
--

CREATE TABLE `projectfeeds` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `projekt_id` varchar(255) NOT NULL,
  `cim` varchar(255) NOT NULL,
  `leiras` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `projects`
--

CREATE TABLE `projects` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `projektcim` varchar(255) NOT NULL,
  `ugyfel_id` bigint(20) UNSIGNED NOT NULL,
  `allapot` varchar(255) NOT NULL,
  `indulasi_idopont` date NOT NULL,
  `projektzaras_becs_datum` date NOT NULL,
  `tipus` varchar(255) NOT NULL,
  `megjegyzes` varchar(255) DEFAULT NULL,
  `aktiv` tinyint(1) NOT NULL DEFAULT 1,
  `erintett_diviziok` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `sales`
--

CREATE TABLE `sales` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `ugyfel_id` bigint(20) UNSIGNED NOT NULL,
  `belso_megnevezes` varchar(255) DEFAULT NULL,
  `csomag` bigint(20) UNSIGNED NOT NULL,
  `leiras` text NOT NULL,
  `statusz` varchar(255) DEFAULT NULL,
  `kezdes_datum` date NOT NULL,
  `befejezes_datum` date NOT NULL,
  `jellege` text DEFAULT NULL,
  `erintett_diviziok` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- A tábla adatainak kiíratása `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('4OYrTgiSlcNi8uyZ1fNzqoLEEQ7WWbtfrCMn64Bt', 5, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 OPR/116.0.0.0', 'YTo2OntzOjM6InVybCI7YTowOnt9czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fXM6NjoiX3Rva2VuIjtzOjQwOiJvNTlHOWZXZkZnODdyclBwd2lQNnh5M2l3blhtZmVBODNOdVNrY1U0IjtzOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aTo1O3M6MjE6InBhc3N3b3JkX2hhc2hfc2FuY3R1bSI7czo2MDoiJDJ5JDEyJHRuc3JnSzlmaWFqbDhVRS9mblRidXVWOWhDTG45aW40TldwM1dseW9DL21EbnNMaHp1eW9XIjt9', 1739626527);

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

--
-- Tábla szerkezet ehhez a táblához `tasks`
--

CREATE TABLE `tasks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `feladat` varchar(255) NOT NULL,
  `leiras` text DEFAULT NULL,
  `felelos_id` bigint(20) UNSIGNED NOT NULL,
  `dependencia` bigint(20) UNSIGNED DEFAULT NULL,
  `kezdo_datum` date DEFAULT NULL,
  `befejezes_datum` date NOT NULL,
  `keses_napokban` int(11) DEFAULT NULL,
  `projekt_id` bigint(20) UNSIGNED DEFAULT NULL,
  `szerzodes_id` bigint(20) UNSIGNED DEFAULT NULL,
  `completed_by` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `transactions`
--

CREATE TABLE `transactions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tranzakcio` varchar(255) NOT NULL,
  `ugyfel_id` bigint(20) UNSIGNED DEFAULT NULL,
  `munkatars_id` bigint(20) UNSIGNED DEFAULT NULL,
  `tranzakcio_datum` date NOT NULL,
  `szamla_szam` varchar(255) NOT NULL,
  `szerzodes_id` bigint(20) UNSIGNED DEFAULT NULL,
  `irany` varchar(255) NOT NULL,
  `jellege` varchar(255) NOT NULL,
  `modja` varchar(255) NOT NULL,
  `osszeg` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Tábla szerkezet ehhez a táblához `workers`
--

CREATE TABLE `workers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `nev` varchar(255) NOT NULL,
  `telefonszam` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `anyja_neve` varchar(255) NOT NULL,
  `lakcim` varchar(255) NOT NULL,
  `szemelyi_szam` varchar(255) NOT NULL,
  `adoszam` varchar(255) NOT NULL,
  `szul_hely` varchar(255) NOT NULL,
  `szul_datum` date NOT NULL,
  `tajszam` varchar(255) NOT NULL,
  `bankszamlaszam` varchar(255) DEFAULT NULL,
  `rev_tag` varchar(255) DEFAULT NULL,
  `divizio` varchar(255) DEFAULT NULL,
  `munkakor` varchar(255) DEFAULT NULL,
  `elerhetoseg` varchar(255) NOT NULL DEFAULT 'Munkán kívűl',
  `jogosultsag` varchar(255) NOT NULL DEFAULT 'Operatív',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- A tábla indexei `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `clients_telefon_unique` (`telefon`),
  ADD UNIQUE KEY `clients_email_unique` (`email`),
  ADD UNIQUE KEY `clients_szerzodes_szem_ig_unique` (`szerzodes_szem_ig`);

--
-- A tábla indexei `contracts`
--
ALTER TABLE `contracts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contracts_client_id_foreign` (`client_id`),
  ADD KEY `contracts_csomag_foreign` (`csomag`);

--
-- A tábla indexei `discounts`
--
ALTER TABLE `discounts`
  ADD PRIMARY KEY (`id`);

--
-- A tábla indexei `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- A tábla indexei `invoices`
--
ALTER TABLE `invoices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `invoices_szamla_szam_unique` (`szamla_szam`),
  ADD KEY `invoices_szerzodes_id_foreign` (`szerzodes_id`);

--
-- A tábla indexei `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- A tábla indexei `job_batches`
--
ALTER TABLE `job_batches`
  ADD PRIMARY KEY (`id`);

--
-- A tábla indexei `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- A tábla indexei `newsfeeds`
--
ALTER TABLE `newsfeeds`
  ADD PRIMARY KEY (`id`);

--
-- A tábla indexei `offers`
--
ALTER TABLE `offers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `offers_sales_id_foreign` (`sales_id`),
  ADD KEY `offers_szerzodes_id_foreign` (`szerzodes_id`),
  ADD KEY `csomag` (`csomag`);

--
-- A tábla indexei `packs`
--
ALTER TABLE `packs`
  ADD PRIMARY KEY (`id`);

--
-- A tábla indexei `projectfeeds`
--
ALTER TABLE `projectfeeds`
  ADD PRIMARY KEY (`id`);

--
-- A tábla indexei `projects`
--
ALTER TABLE `projects`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ugyfel_id` (`ugyfel_id`);

--
-- A tábla indexei `sales`
--
ALTER TABLE `sales`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ugyfel_id` (`ugyfel_id`),
  ADD KEY `csomag` (`csomag`);

--
-- A tábla indexei `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- A tábla indexei `tasks`
--
ALTER TABLE `tasks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tasks_felelos_id_foreign` (`felelos_id`),
  ADD KEY `tasks_projekt_id_foreign` (`projekt_id`),
  ADD KEY `tasks_szerzodes_id_foreign` (`szerzodes_id`),
  ADD KEY `tasks_dependencia_foreign` (`dependencia`);

--
-- A tábla indexei `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `transactions_szamla_szam_unique` (`szamla_szam`),
  ADD KEY `transactions_ugyfel_id_foreign` (`ugyfel_id`),
  ADD KEY `transactions_munkatars_id_foreign` (`munkatars_id`),
  ADD KEY `transactions_szerzodes_id_foreign` (`szerzodes_id`);

--
-- A tábla indexei `workers`
--
ALTER TABLE `workers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `workers_telefonszam_unique` (`telefonszam`),
  ADD UNIQUE KEY `workers_email_unique` (`email`),
  ADD UNIQUE KEY `workers_szemelyi_szam_unique` (`szemelyi_szam`),
  ADD UNIQUE KEY `workers_adoszam_unique` (`adoszam`),
  ADD UNIQUE KEY `workers_tajszam_unique` (`tajszam`),
  ADD UNIQUE KEY `workers_bankszamlaszam_unique` (`bankszamlaszam`),
  ADD UNIQUE KEY `workers_rev_tag_unique` (`rev_tag`);

--
-- A kiírt táblák AUTO_INCREMENT értéke
--

--
-- AUTO_INCREMENT a táblához `clients`
--
ALTER TABLE `clients`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT a táblához `contracts`
--
ALTER TABLE `contracts`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT a táblához `discounts`
--
ALTER TABLE `discounts`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT a táblához `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT a táblához `invoices`
--
ALTER TABLE `invoices`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT a táblához `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT a táblához `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT a táblához `newsfeeds`
--
ALTER TABLE `newsfeeds`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT a táblához `offers`
--
ALTER TABLE `offers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT a táblához `packs`
--
ALTER TABLE `packs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT a táblához `projectfeeds`
--
ALTER TABLE `projectfeeds`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT a táblához `projects`
--
ALTER TABLE `projects`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT a táblához `sales`
--
ALTER TABLE `sales`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT a táblához `tasks`
--
ALTER TABLE `tasks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT a táblához `transactions`
--
ALTER TABLE `transactions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT a táblához `workers`
--
ALTER TABLE `workers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- Megkötések a kiírt táblákhoz
--

--
-- Megkötések a táblához `contracts`
--
ALTER TABLE `contracts`
  ADD CONSTRAINT `contracts_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `contracts_csomag_foreign` FOREIGN KEY (`csomag`) REFERENCES `packs` (`id`) ON DELETE CASCADE;

--
-- Megkötések a táblához `invoices`
--
ALTER TABLE `invoices`
  ADD CONSTRAINT `invoices_szerzodes_id_foreign` FOREIGN KEY (`szerzodes_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE;

--
-- Megkötések a táblához `offers`
--
ALTER TABLE `offers`
  ADD CONSTRAINT `offers_csomag_foreign` FOREIGN KEY (`csomag`) REFERENCES `packs` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `offers_sales_id_foreign` FOREIGN KEY (`sales_id`) REFERENCES `sales` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `offers_szerzodes_id_foreign` FOREIGN KEY (`szerzodes_id`) REFERENCES `contracts` (`id`) ON DELETE SET NULL;

--
-- Megkötések a táblához `projects`
--
ALTER TABLE `projects`
  ADD CONSTRAINT `projects_ugyfel_id_foreign` FOREIGN KEY (`ugyfel_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE;

--
-- Megkötések a táblához `sales`
--
ALTER TABLE `sales`
  ADD CONSTRAINT `sales_csomag_foreign` FOREIGN KEY (`csomag`) REFERENCES `packs` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `sales_ugyfel_id_foreign` FOREIGN KEY (`ugyfel_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE;

--
-- Megkötések a táblához `tasks`
--
ALTER TABLE `tasks`
  ADD CONSTRAINT `tasks_dependencia_foreign` FOREIGN KEY (`dependencia`) REFERENCES `tasks` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_felelos_id_foreign` FOREIGN KEY (`felelos_id`) REFERENCES `workers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `tasks_projekt_id_foreign` FOREIGN KEY (`projekt_id`) REFERENCES `projects` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_szerzodes_id_foreign` FOREIGN KEY (`szerzodes_id`) REFERENCES `contracts` (`id`) ON DELETE SET NULL;

--
-- Megkötések a táblához `transactions`
--
ALTER TABLE `transactions`
  ADD CONSTRAINT `transactions_munkatars_id_foreign` FOREIGN KEY (`munkatars_id`) REFERENCES `workers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `transactions_szerzodes_id_foreign` FOREIGN KEY (`szerzodes_id`) REFERENCES `contracts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `transactions_ugyfel_id_foreign` FOREIGN KEY (`ugyfel_id`) REFERENCES `clients` (`id`) ON DELETE SET NULL;

--
-- Megkötések a táblához `workers`
--
ALTER TABLE `workers`
  ADD CONSTRAINT `workers_email_foreign` FOREIGN KEY (`email`) REFERENCES `users` (`email`) ON DELETE CASCADE;
COMMIT;

