-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: May 04, 2026 at 06:36 PM
-- Server version: 11.8.6-MariaDB-log
-- PHP Version: 7.2.34

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: `farmlink`
--

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

--
-- Table structure for table `admin_logs`
--

CREATE TABLE `admin_logs` (
  `id` bigint(20) NOT NULL,
  `admin_id` bigint(20) DEFAULT NULL,
  `user_id` bigint(20) DEFAULT NULL,
  `action` varchar(255) DEFAULT NULL,
  `reason` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `admin_logs`
--

INSERT INTO `admin_logs` (`id`, `admin_id`, `user_id`, `action`, `reason`, `created_at`, `updated_at`) VALUES
(1, 7, 1, 'KYC Approved', 'Aadhaar document verified and approved.', '2026-01-01 11:00:00', '2026-01-01 11:00:00'),
(2, 7, 2, 'KYC Approved', 'PAN document verified and approved.', '2026-01-02 11:00:00', '2026-01-02 11:00:00'),
(3, 7, 3, 'KYC Approved', 'Driving License verified and approved.', '2026-01-03 11:00:00', '2026-01-03 11:00:00'),
(4, 7, 4, 'KYC Approved', 'Aadhaar document verified and approved.', '2026-01-04 11:00:00', '2026-01-04 11:00:00'),
(5, 7, 5, 'KYC Approved', 'PAN document verified and approved.', '2026-01-05 11:00:00', '2026-01-05 11:00:00'),
(6, 7, 6, 'KYC Approved', 'Aadhaar document verified and approved.', '2026-01-06 11:00:00', '2026-01-06 11:00:00'),
(7, 7, 2, 'Report Resolved', 'Reviewed complaint from Anita Sharma. Issued formal warning to Suresh.', '2026-01-18 14:00:00', '2026-01-18 14:00:00'),
(8, 7, 1, 'Deal Flagged', 'Temporary flag on deal #6 for price dispute investigation. Resolved.', '2026-01-29 10:00:00', '2026-01-30 10:00:00'),
(9, 1, 3, 'Deal Flagged', 'Deal #5', '2026-04-02 11:44:17', '2026-04-02 11:44:17');

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

--
-- Table structure for table `chats`
--

CREATE TABLE `chats` (
  `id` bigint(20) NOT NULL,
  `sender_id` bigint(20) DEFAULT NULL,
  `receiver_id` bigint(20) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `chats`
--

INSERT INTO `chats` (`id`, `sender_id`, `receiver_id`, `message`, `created_at`, `updated_at`) VALUES
(1, 4, 1, 'Hi Ramesh ji, can you deliver the tomatoes by February 5th?', '2026-01-13 12:00:00', '2026-01-13 12:00:00'),
(2, 1, 4, 'Yes Anita madam, I will deliver 100kg by Feb 5 morning, fresh from farm.', '2026-01-13 12:10:00', '2026-01-13 12:10:00'),
(3, 4, 1, 'Perfect. Please pack them properly so they do not get damaged.', '2026-01-13 12:15:00', '2026-01-13 12:15:00'),
(4, 1, 4, 'Sure, all Grade A quality guaranteed. Will use proper crates.', '2026-01-13 12:20:00', '2026-01-13 12:20:00'),
(5, 4, 1, 'Thank you Ramesh ji. Payment will be done within 7 days of delivery.', '2026-01-13 12:25:00', '2026-01-13 12:25:00'),
(6, 5, 2, 'Suresh bhai, potato delivery confirmed for Feb 10?', '2026-02-01 09:00:00', '2026-02-01 09:00:00'),
(7, 2, 5, 'Yes Vikram ji, 200kg will be delivered by Feb 10 to your warehouse.', '2026-02-01 09:15:00', '2026-02-01 09:15:00'),
(8, 5, 2, 'Good. Make sure quality is consistent with what you showed during offer.', '2026-02-01 09:20:00', '2026-02-01 09:20:00'),
(9, 2, 5, 'Bilkul guaranteed. Same farm, same quality every month.', '2026-02-01 09:30:00', '2026-02-01 09:30:00'),
(10, 6, 3, 'Manoj ji, is the spinach available for immediate delivery?', '2026-01-17 14:00:00', '2026-01-17 14:00:00'),
(11, 3, 6, 'Yes Priya madam, fresh spinach harvested today. Can deliver tomorrow.', '2026-01-17 14:10:00', '2026-01-17 14:10:00'),
(12, 6, 3, 'Perfect! Please confirm the delivery address: Nagpur warehouse, Civil Lines.', '2026-01-17 14:15:00', '2026-01-17 14:15:00'),
(13, 3, 6, 'Noted. I will be there by 10am on Jan 22nd.', '2026-01-17 14:20:00', '2026-01-17 14:20:00');

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

--
-- Table structure for table `contracts`
--

CREATE TABLE `contracts` (
  `id` bigint(20) NOT NULL,
  `deal_id` bigint(20) DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `fixed_price` decimal(10,2) DEFAULT NULL,
  `monthly_quantity` decimal(10,2) DEFAULT NULL,
  `terms` text DEFAULT NULL,
  `status` enum('active','completed') DEFAULT 'active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `farmer_signature_url` text DEFAULT NULL,
  `farmer_signed` tinyint(1) DEFAULT 0,
  `buyer_signature_url` text DEFAULT NULL,
  `buyer_signed` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `contracts`
--

INSERT INTO `contracts` (`id`, `deal_id`, `start_date`, `end_date`, `fixed_price`, `monthly_quantity`, `terms`, `status`, `created_at`, `updated_at`, `farmer_signature_url`, `farmer_signed`, `buyer_signature_url`, `buyer_signed`) VALUES
(1, 1, '2026-02-01', '2026-07-31', 28.00, 100.00, 'Monthly delivery of 100kg tomatoes at fixed Rs.28/kg. Payment within 7 days of delivery. Grade A quality required. Damaged goods to be replaced within 48 hours.', 'active', '2026-01-13 11:00:00', '2026-01-13 11:00:00', NULL, 0, NULL, 0),
(2, 3, '2026-02-01', '2026-08-31', 16.00, 200.00, 'Monthly delivery of 200kg potatoes at Rs.16/kg. Delivery to Aurangabad warehouse. Damaged goods replaced within 3 days. Payment via UPI within 5 days.', 'active', '2026-01-15 11:00:00', '2026-01-15 11:00:00', NULL, NULL, NULL, NULL),
(3, 5, '2026-04-04', '2027-04-03', 50.00, 1200.00, NULL, 'active', '2026-04-03 02:42:15', '2026-04-03 02:42:15', NULL, NULL, NULL, NULL),
(4, 6, '2026-04-05', '2027-04-04', 90.00, 1000.00, NULL, 'active', '2026-04-04 06:19:19', '2026-04-04 06:19:19', NULL, NULL, NULL, NULL),
(5, 4, '2026-04-07', '2027-04-06', 30.00, 200.00, NULL, 'active', '2026-04-06 04:46:27', '2026-04-06 04:46:27', NULL, 0, NULL, NULL);

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

--
-- Table structure for table `contract_documents`
--

CREATE TABLE `contract_documents` (
  `id` bigint(20) NOT NULL,
  `contract_id` bigint(20) DEFAULT NULL,
  `file_url` text DEFAULT NULL,
  `uploaded_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `contract_documents`
--

INSERT INTO `contract_documents` (`id`, `contract_id`, `file_url`, `uploaded_at`, `created_at`, `updated_at`) VALUES
(1, 1, 'https://dummyimage.com/800x600/228B22/fff&text=Contract+Tomato+Deal+1', '2026-01-13 12:00:00', '2026-01-13 12:00:00', '2026-01-13 12:00:00'),
(2, 1, 'https://dummyimage.com/800x600/228B22/fff&text=Tomato+Terms+Signed', '2026-01-13 12:30:00', '2026-01-13 12:30:00', '2026-01-13 12:30:00'),
(3, 2, 'https://dummyimage.com/800x600/4169E1/fff&text=Contract+Potato+Deal+2', '2026-01-15 12:00:00', '2026-01-15 12:00:00', '2026-01-15 12:00:00');

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

--
-- Table structure for table `deals`
--

CREATE TABLE `deals` (
  `id` bigint(20) NOT NULL,
  `requirement_id` bigint(20) DEFAULT NULL,
  `farmer_id` bigint(20) DEFAULT NULL,
  `buyer_id` bigint(20) DEFAULT NULL,
  `final_price` decimal(10,2) DEFAULT NULL,
  `quantity` decimal(10,2) DEFAULT NULL,
  `deal_type` enum('one_time','contract') DEFAULT NULL,
  `status` enum('active','completed') DEFAULT 'active',
  `is_flagged` tinyint(1) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `deals`
--

INSERT INTO `deals` (`id`, `requirement_id`, `farmer_id`, `buyer_id`, `final_price`, `quantity`, `deal_type`, `status`, `is_flagged`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 4, 28.00, 500.00, 'contract', 'active', 0, '2026-01-13 10:00:00', '2026-01-13 10:00:00'),
(2, 2, 1, 4, 20.00, 300.00, 'one_time', 'completed', 0, '2026-01-14 10:00:00', '2026-01-20 10:00:00'),
(3, 3, 2, 5, 16.00, 1000.00, 'contract', 'active', 0, '2026-01-15 10:00:00', '2026-01-15 10:00:00'),
(4, 4, 1, 5, 40.00, 200.00, 'one_time', 'completed', 0, '2026-01-16 10:00:00', '2026-01-22 10:00:00'),
(5, 6, 3, 6, 30.00, 150.00, 'one_time', 'active', 1, '2026-01-18 10:00:00', '2026-04-02 11:44:17'),
(6, 8, 3, 5, 95.00, 100.00, 'one_time', 'completed', 0, '2026-01-20 10:00:00', '2026-01-26 10:00:00');

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

--
-- Table structure for table `deliveries`
--

CREATE TABLE `deliveries` (
  `id` bigint(20) NOT NULL,
  `deal_id` bigint(20) DEFAULT NULL,
  `delivery_date` date DEFAULT NULL,
  `quantity_delivered` decimal(10,2) DEFAULT NULL,
  `status` enum('pending','delivered') DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `deliveries`
--

INSERT INTO `deliveries` (`id`, `deal_id`, `delivery_date`, `quantity_delivered`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, '2026-02-05', 100.00, 'delivered', '2026-02-01 08:00:00', '2026-02-05 16:00:00'),
(2, 1, '2026-03-05', 100.00, 'delivered', '2026-03-01 08:00:00', '2026-03-05 16:00:00'),
(3, 1, '2026-04-05', 100.00, 'pending', '2026-04-01 08:00:00', '2026-04-01 08:00:00'),
(4, 2, '2026-01-15', 300.00, 'delivered', '2026-01-14 08:00:00', '2026-01-15 16:00:00'),
(5, 3, '2026-02-10', 200.00, 'delivered', '2026-02-05 08:00:00', '2026-02-10 16:00:00'),
(6, 3, '2026-03-10', 200.00, 'delivered', '2026-03-05 08:00:00', '2026-03-10 16:00:00'),
(7, 3, '2026-04-10', 200.00, 'pending', '2026-04-01 08:00:00', '2026-04-01 08:00:00'),
(8, 4, '2026-01-18', 200.00, 'delivered', '2026-01-17 08:00:00', '2026-01-18 16:00:00'),
(9, 5, '2026-01-22', 150.00, 'delivered', '2026-01-21 08:00:00', '2026-01-22 14:00:00'),
(10, 6, '2026-01-25', 100.00, 'delivered', '2026-01-24 08:00:00', '2026-01-25 16:00:00');

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

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` bigint(20) NOT NULL,
  `user_id` bigint(20) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `is_read` tinyint(1) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `notifications`
--

INSERT INTO `notifications` (`id`, `user_id`, `title`, `message`, `is_read`, `created_at`, `updated_at`) VALUES
(1, 1, 'Offer Accepted', 'Your offer for Tomato (Req #1) has been accepted by Anita Sharma.', 1, '2026-01-12 09:30:00', '2026-01-12 09:30:00'),
(2, 1, 'Deal Created', 'Contract deal for 500kg Tomatoes has been created. Check contract details.', 1, '2026-01-13 10:30:00', '2026-01-13 10:30:00'),
(3, 1, 'Offer Accepted', 'Your offer for Onion (Req #2) has been accepted by Anita Sharma.', 1, '2026-01-13 09:30:00', '2026-01-13 09:30:00'),
(4, 1, 'Payment Received', 'Payment of Rs.2800 received for Tomato delivery - February.', 1, '2026-02-07 10:30:00', '2026-02-07 10:30:00'),
(5, 1, 'Delivery Reminder', 'Upcoming Tomato delivery of 100kg due on April 5th. Please prepare.', 1, '2026-03-28 08:00:00', '2026-04-03 02:05:37'),
(6, 2, 'Offer Rejected', 'Your offer for Tomato (Req #1) was not selected this time. Try again!', 1, '2026-01-12 11:00:00', '2026-01-12 11:00:00'),
(7, 2, 'Offer Accepted', 'Your offer for Potato (Req #3) has been accepted by Vikram Mehta.', 1, '2026-01-14 09:30:00', '2026-01-14 09:30:00'),
(8, 2, 'Contract Active', 'Your contract for 1000kg Potatoes is now active. First delivery: Feb 10.', 1, '2026-01-15 11:30:00', '2026-01-15 11:30:00'),
(9, 2, 'Delivery Reminder', 'Potato delivery of 200kg is due on April 10th. Please arrange transport.', 0, '2026-04-01 08:00:00', '2026-04-01 08:00:00'),
(10, 3, 'Offer Accepted', 'Your offer for Spinach (Req #6) has been accepted by Priya Desai.', 1, '2026-01-17 09:30:00', '2026-01-17 09:30:00'),
(11, 3, 'Payment Received', 'Payment of Rs.4500 received for Spinach delivery.', 1, '2026-01-23 11:00:00', '2026-01-23 11:00:00'),
(12, 4, 'New Offer Received', 'Ramesh Patil sent an offer of Rs.28/kg for your Tomato requirement.', 1, '2026-01-12 09:05:00', '2026-01-12 09:05:00'),
(13, 4, 'Delivery Completed', 'Onion delivery of 300kg has been marked as delivered. Please rate the farmer.', 1, '2026-01-15 16:30:00', '2026-01-15 16:30:00'),
(14, 4, 'Payment Released', 'Payment of Rs.6000 for Onion deal has been released to farmer.', 1, '2026-01-16 12:30:00', '2026-01-16 12:30:00'),
(15, 5, 'Contract Active', 'Potato contract with Suresh Jadhav is now active. Delivery starts Feb 10.', 1, '2026-01-15 11:30:00', '2026-01-15 11:30:00'),
(16, 5, 'Delivery Completed', 'Potato delivery of 200kg for March has been delivered successfully.', 0, '2026-03-10 17:00:00', '2026-03-10 17:00:00'),
(17, 6, 'New Offer Received', 'Manoj Kulkarni sent an offer of Rs.30/kg for your Spinach requirement.', 1, '2026-01-17 09:15:00', '2026-01-17 09:15:00'),
(18, 6, 'Deal Completed', 'Your Garlic deal with Manoj Kulkarni has been completed. Please leave a rating.', 0, '2026-01-26 17:00:00', '2026-01-26 17:00:00'),
(19, 1, 'Test', '?Hello', 1, '2026-04-02 11:44:47', '2026-04-03 02:05:37'),
(20, 2, 'Test', '?Hello', 0, '2026-04-02 11:44:47', '2026-04-02 11:44:47'),
(21, 3, 'Test', '?Hello', 0, '2026-04-02 11:44:47', '2026-04-02 11:44:47'),
(22, 4, 'Test', '?Hello', 0, '2026-04-02 11:44:47', '2026-04-02 11:44:47'),
(23, 5, 'Test', '?Hello', 0, '2026-04-02 11:44:47', '2026-04-02 11:44:47'),
(24, 6, 'Test', '?Hello', 0, '2026-04-02 11:44:47', '2026-04-02 11:44:47'),
(25, 7, 'Test', '?Hello', 0, '2026-04-02 11:44:47', '2026-04-02 11:44:47'),
(26, 1, 'Send', 'Hello', 1, '2026-04-02 11:44:58', '2026-04-03 02:05:37'),
(27, 2, 'Send', 'Hello', 0, '2026-04-02 11:44:58', '2026-04-02 11:44:58'),
(28, 3, 'Send', 'Hello', 0, '2026-04-02 11:44:58', '2026-04-02 11:44:58'),
(29, 4, 'Send', 'Hello', 0, '2026-04-02 11:44:58', '2026-04-02 11:44:58'),
(30, 5, 'Send', 'Hello', 0, '2026-04-02 11:44:58', '2026-04-02 11:44:58'),
(31, 6, 'Send', 'Hello', 0, '2026-04-02 11:44:58', '2026-04-02 11:44:58'),
(32, 7, 'Send', 'Hello', 0, '2026-04-02 11:44:58', '2026-04-02 11:44:58'),
(33, 4, 'New Offer Received', 'Farmer Ramesh Patil made an offer of ₹2100 for your requirement.', 0, '2026-04-03 02:30:16', '2026-04-03 02:30:16');

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

--
-- Table structure for table `offers`
--

CREATE TABLE `offers` (
  `id` bigint(20) NOT NULL,
  `requirement_id` bigint(20) DEFAULT NULL,
  `farmer_id` bigint(20) DEFAULT NULL,
  `offered_price` decimal(10,2) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `status` enum('pending','accepted','rejected') DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `offers`
--

INSERT INTO `offers` (`id`, `requirement_id`, `farmer_id`, `offered_price`, `message`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 28.00, 'Fresh Grade A tomatoes from Nashik, can deliver within 2 days.', 'accepted', '2026-01-12 09:00:00', '2026-01-12 09:00:00'),
(2, 1, 2, 30.00, 'Premium tomatoes, bulk discount available for 500kg+.', 'rejected', '2026-01-12 10:00:00', '2026-01-12 10:00:00'),
(3, 2, 1, 20.00, 'Fresh red onions, harvested this week from Nashik.', 'accepted', '2026-01-13 09:00:00', '2026-01-13 09:00:00'),
(4, 2, 3, 22.00, 'Quality onions from Solapur, ready to ship.', 'rejected', '2026-01-13 10:00:00', '2026-01-13 10:00:00'),
(5, 3, 2, 16.00, 'Fresh Pune potatoes, guaranteed delivery within 3 days.', 'accepted', '2026-01-14 09:00:00', '2026-01-14 09:00:00'),
(6, 4, 1, 40.00, 'Organic cauliflower, top quality, pesticide-free.', 'accepted', '2026-01-15 09:00:00', '2026-01-15 09:00:00'),
(7, 5, 2, 1800.00, 'Best wheat from Pune farms, 50 quintal ready.', 'pending', '2026-01-16 09:00:00', '2026-01-16 09:00:00'),
(8, 6, 3, 30.00, 'Fresh spinach from Solapur, daily harvest.', 'accepted', '2026-01-17 09:00:00', '2026-01-17 09:00:00'),
(9, 7, 1, 38.00, 'Basmati rice from Nashik, premium quality.', 'pending', '2026-01-18 09:00:00', '2026-01-18 09:00:00'),
(10, 8, 3, 95.00, 'Fresh garlic, strong aroma, direct from farm.', 'accepted', '2026-01-19 09:00:00', '2026-01-19 09:00:00'),
(11, 5, 1, 2100.00, NULL, 'pending', '2026-04-03 02:30:16', '2026-04-03 02:30:16');

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

--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` bigint(20) NOT NULL,
  `deal_id` bigint(20) DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `status` enum('pending','held','released','failed') DEFAULT NULL,
  `payment_method` varchar(50) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `payments`
--

INSERT INTO `payments` (`id`, `deal_id`, `amount`, `status`, `payment_method`, `created_at`, `updated_at`) VALUES
(1, 1, 2800.00, 'released', 'UPI', '2026-02-07 10:00:00', '2026-02-07 10:00:00'),
(2, 1, 2800.00, 'released', 'UPI', '2026-03-07 10:00:00', '2026-03-07 10:00:00'),
(3, 1, 2800.00, 'held', 'UPI', '2026-04-05 10:00:00', '2026-04-05 10:00:00'),
(4, 2, 6000.00, 'released', 'Bank Transfer', '2026-01-16 12:00:00', '2026-01-16 12:00:00'),
(5, 3, 3200.00, 'released', 'UPI', '2026-02-12 10:00:00', '2026-02-12 10:00:00'),
(6, 3, 3200.00, 'released', 'UPI', '2026-03-12 10:00:00', '2026-03-12 10:00:00'),
(7, 3, 3200.00, 'held', 'UPI', '2026-04-10 10:00:00', '2026-04-10 10:00:00'),
(8, 4, 8000.00, 'released', 'Bank Transfer', '2026-01-19 10:00:00', '2026-01-19 10:00:00'),
(9, 5, 4500.00, 'released', 'UPI', '2026-01-23 10:00:00', '2026-01-23 10:00:00'),
(10, 6, 9500.00, 'released', 'Bank Transfer', '2026-01-26 10:00:00', '2026-01-26 10:00:00');

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

--
-- Table structure for table `personal_access_tokens`
--

CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `personal_access_tokens`
--


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

--
-- Table structure for table `price_history`
--

CREATE TABLE `price_history` (
  `id` bigint(20) NOT NULL,
  `product_id` bigint(20) DEFAULT NULL,
  `market_price` decimal(10,2) DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `recorded_at` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `price_history`
--

INSERT INTO `price_history` (`id`, `product_id`, `market_price`, `location`, `recorded_at`, `created_at`, `updated_at`) VALUES
(1, 1, 22.00, 'Nashik', '2026-01-01', '2026-01-01 06:00:00', '2026-01-01 06:00:00'),
(2, 1, 24.00, 'Nashik', '2026-01-08', '2026-01-08 06:00:00', '2026-01-08 06:00:00'),
(3, 1, 28.00, 'Nashik', '2026-01-15', '2026-01-15 06:00:00', '2026-01-15 06:00:00'),
(4, 1, 31.00, 'Nashik', '2026-01-22', '2026-01-22 06:00:00', '2026-01-22 06:00:00'),
(5, 1, 29.00, 'Nashik', '2026-01-29', '2026-01-29 06:00:00', '2026-01-29 06:00:00'),
(6, 2, 18.00, 'Pune', '2026-01-01', '2026-01-01 06:00:00', '2026-01-01 06:00:00'),
(7, 2, 19.00, 'Pune', '2026-01-08', '2026-01-08 06:00:00', '2026-01-08 06:00:00'),
(8, 2, 21.00, 'Pune', '2026-01-15', '2026-01-15 06:00:00', '2026-01-15 06:00:00'),
(9, 2, 20.00, 'Pune', '2026-01-22', '2026-01-22 06:00:00', '2026-01-22 06:00:00'),
(10, 3, 14.00, 'Aurangabad', '2026-01-01', '2026-01-01 06:00:00', '2026-01-01 06:00:00'),
(11, 3, 15.00, 'Aurangabad', '2026-01-08', '2026-01-08 06:00:00', '2026-01-08 06:00:00'),
(12, 3, 16.00, 'Aurangabad', '2026-01-15', '2026-01-15 06:00:00', '2026-01-15 06:00:00'),
(13, 3, 17.00, 'Aurangabad', '2026-01-22', '2026-01-22 06:00:00', '2026-01-22 06:00:00'),
(14, 4, 35.00, 'Nashik', '2026-01-01', '2026-01-01 06:00:00', '2026-01-01 06:00:00'),
(15, 4, 38.00, 'Nashik', '2026-01-08', '2026-01-08 06:00:00', '2026-01-08 06:00:00'),
(16, 4, 40.00, 'Nashik', '2026-01-15', '2026-01-15 06:00:00', '2026-01-15 06:00:00'),
(17, 5, 25.00, 'Solapur', '2026-01-01', '2026-01-01 06:00:00', '2026-01-01 06:00:00'),
(18, 5, 28.00, 'Solapur', '2026-01-08', '2026-01-08 06:00:00', '2026-01-08 06:00:00'),
(19, 5, 30.00, 'Solapur', '2026-01-15', '2026-01-15 06:00:00', '2026-01-15 06:00:00'),
(20, 6, 1600.00, 'Pune', '2026-01-01', '2026-01-01 06:00:00', '2026-01-01 06:00:00'),
(21, 6, 1700.00, 'Pune', '2026-01-08', '2026-01-08 06:00:00', '2026-01-08 06:00:00'),
(22, 6, 1800.00, 'Pune', '2026-01-15', '2026-01-15 06:00:00', '2026-01-15 06:00:00'),
(23, 7, 35.00, 'Nashik', '2026-01-01', '2026-01-01 06:00:00', '2026-01-01 06:00:00'),
(24, 7, 37.00, 'Nashik', '2026-01-08', '2026-01-08 06:00:00', '2026-01-08 06:00:00'),
(25, 7, 40.00, 'Nashik', '2026-01-15', '2026-01-15 06:00:00', '2026-01-15 06:00:00'),
(26, 8, 85.00, 'Solapur', '2026-01-01', '2026-01-01 06:00:00', '2026-01-01 06:00:00'),
(27, 8, 90.00, 'Solapur', '2026-01-08', '2026-01-08 06:00:00', '2026-01-08 06:00:00'),
(28, 8, 95.00, 'Solapur', '2026-01-15', '2026-01-15 06:00:00', '2026-01-15 06:00:00');

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

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` bigint(20) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `unit` varchar(50) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `products`
--

INSERT INTO `products` (`id`, `name`, `unit`, `created_at`, `updated_at`) VALUES
(1, 'Tomato', 'kg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(2, 'Onion', 'kg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(3, 'Potato', 'kg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(4, 'Cauliflower', 'piece', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(5, 'Spinach', 'kg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(6, 'Wheat', 'quintal', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(7, 'Rice', 'kg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(8, 'Garlic', 'kg', '2026-01-01 09:00:00', '2026-01-01 09:00:00');

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

--
-- Table structure for table `product_images`
--

CREATE TABLE `product_images` (
  `id` bigint(20) NOT NULL,
  `product_id` bigint(20) DEFAULT NULL,
  `image_url` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `product_images`
--

INSERT INTO `product_images` (`id`, `product_id`, `image_url`, `created_at`, `updated_at`) VALUES
(1, 1, 'https://upload.wikimedia.org/wikipedia/commons/8/89/Tomato_je.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(2, 1, 'https://upload.wikimedia.org/wikipedia/commons/4/44/Tomato_garden.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(3, 2, 'https://upload.wikimedia.org/wikipedia/commons/2/28/Onions.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(4, 2, 'https://upload.wikimedia.org/wikipedia/commons/a/a3/Onions_-_Flickr_-_USDAgov.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(5, 3, 'https://upload.wikimedia.org/wikipedia/commons/a/ab/Potato_and_cross_section.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(6, 3, 'https://upload.wikimedia.org/wikipedia/commons/c/cd/Potato_-_Solanum_tuberosum.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(7, 4, 'https://upload.wikimedia.org/wikipedia/commons/6/6c/Cauliflower_flowerhead.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(8, 4, 'https://upload.wikimedia.org/wikipedia/commons/6/64/Cauliflower_-_florescence.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(9, 5, 'https://upload.wikimedia.org/wikipedia/commons/d/d3/Spinach_leaves.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(10, 5, 'https://upload.wikimedia.org/wikipedia/commons/9/9a/Spinach_%281%29.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(11, 6, 'https://upload.wikimedia.org/wikipedia/commons/6/6e/WheatField.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(12, 6, 'https://upload.wikimedia.org/wikipedia/commons/a/a7/Wheat_close-up.JPG', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(13, 7, 'https://upload.wikimedia.org/wikipedia/commons/7/7b/Rice_plant.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(14, 7, 'https://upload.wikimedia.org/wikipedia/commons/5/5e/Oryza_sativa_-_Köhler%27s_Medizinal-Pflanzen-232.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(15, 8, 'https://upload.wikimedia.org/wikipedia/commons/1/1e/Garlic_growing.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00'),
(16, 8, 'https://upload.wikimedia.org/wikipedia/commons/b/bb/Garlic_bulbs_and_cloves.jpg', '2026-01-01 09:00:00', '2026-01-01 09:00:00');

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

--
-- Table structure for table `ratings`
--

CREATE TABLE `ratings` (
  `id` bigint(20) NOT NULL,
  `from_user_id` bigint(20) DEFAULT NULL,
  `to_user_id` bigint(20) DEFAULT NULL,
  `rating` int(11) DEFAULT NULL CHECK (`rating` >= 1 and `rating` <= 5),
  `review` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `ratings`
--

INSERT INTO `ratings` (`id`, `from_user_id`, `to_user_id`, `rating`, `review`, `created_at`, `updated_at`) VALUES
(1, 4, 1, 5, 'Excellent tomatoes! Very fresh and delivered on time. Will order again.', '2026-02-06 10:00:00', '2026-02-06 10:00:00'),
(2, 4, 1, 4, 'Good quality onions, packaging could be better but overall satisfied.', '2026-01-16 10:00:00', '2026-01-16 10:00:00'),
(3, 5, 2, 4, 'Potatoes were fresh and delivery was exactly on schedule.', '2026-02-11 10:00:00', '2026-02-11 10:00:00'),
(4, 5, 1, 5, 'Outstanding cauliflower quality. Best I have seen this season.', '2026-01-19 10:00:00', '2026-01-19 10:00:00'),
(5, 6, 3, 4, 'Spinach was very fresh, great deal for the price.', '2026-01-23 10:00:00', '2026-01-23 10:00:00'),
(6, 5, 3, 5, 'Garlic was top quality, strong aroma. Very happy with the purchase.', '2026-01-27 10:00:00', '2026-01-27 10:00:00'),
(7, 1, 4, 5, 'Anita ji always pays on time and communicates well. Great buyer!', '2026-02-07 10:00:00', '2026-02-07 10:00:00'),
(8, 2, 5, 4, 'Vikram bhai is a reliable buyer, clear requirements and timely payment.', '2026-02-12 10:00:00', '2026-02-12 10:00:00'),
(9, 3, 6, 4, 'Priya madam is professional and responsive. Good experience overall.', '2026-01-24 10:00:00', '2026-01-24 10:00:00');

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

--
-- Table structure for table `reports`
--

CREATE TABLE `reports` (
  `id` bigint(20) NOT NULL,
  `reported_by` bigint(20) DEFAULT NULL,
  `reported_user_id` bigint(20) DEFAULT NULL,
  `reason` text DEFAULT NULL,
  `status` enum('pending','resolved') DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `reports`
--

INSERT INTO `reports` (`id`, `reported_by`, `reported_user_id`, `reason`, `status`, `created_at`, `updated_at`) VALUES
(1, 4, 2, 'Farmer sent poor quality produce despite assuring Grade A quality. Very disappointed.', 'resolved', '2026-01-16 15:00:00', '2026-01-18 11:00:00'),
(2, 5, 2, 'Suresh did not respond for 2 days after offer was accepted. Caused delivery delay.', 'pending', '2026-01-22 11:00:00', '2026-01-22 11:00:00'),
(3, 6, 1, 'Ramesh quoted one price but demanded higher at time of delivery. Unprofessional behavior.', 'pending', '2026-01-28 10:00:00', '2026-01-28 10:00:00');

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

--
-- Table structure for table `requirements`
--

CREATE TABLE `requirements` (
  `id` bigint(20) NOT NULL,
  `buyer_id` bigint(20) DEFAULT NULL,
  `product_id` bigint(20) DEFAULT NULL,
  `quantity` decimal(10,2) DEFAULT NULL,
  `min_price` decimal(10,2) DEFAULT NULL,
  `max_price` decimal(10,2) DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `status` enum('open','closed') DEFAULT 'open',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `requirements`
--

INSERT INTO `requirements` (`id`, `buyer_id`, `product_id`, `quantity`, `min_price`, `max_price`, `location`, `status`, `created_at`, `updated_at`) VALUES
(1, 4, 1, 500.00, 20.00, 35.00, 'Mumbai, Maharashtra', 'open', '2026-01-10 10:00:00', '2026-01-10 10:00:00'),
(2, 4, 2, 300.00, 15.00, 25.00, 'Mumbai, Maharashtra', 'open', '2026-01-11 10:00:00', '2026-01-11 10:00:00'),
(3, 5, 3, 1000.00, 12.00, 20.00, 'Aurangabad, Maharashtra', 'open', '2026-01-12 10:00:00', '2026-01-12 10:00:00'),
(4, 5, 4, 200.00, 30.00, 50.00, 'Aurangabad, Maharashtra', 'closed', '2026-01-13 10:00:00', '2026-01-20 10:00:00'),
(5, 4, 6, 50.00, 1500.00, 2200.00, 'Mumbai, Maharashtra', 'open', '2026-01-14 10:00:00', '2026-01-14 10:00:00'),
(6, 6, 5, 150.00, 25.00, 40.00, 'Nagpur, Maharashtra', 'open', '2026-01-15 10:00:00', '2026-01-15 10:00:00'),
(7, 6, 7, 800.00, 30.00, 50.00, 'Nagpur, Maharashtra', 'open', '2026-01-16 10:00:00', '2026-01-16 10:00:00'),
(8, 5, 8, 100.00, 80.00, 120.00, 'Aurangabad, Maharashtra', 'closed', '2026-01-17 10:00:00', '2026-01-24 10:00:00'),
(9, 4, 1, 500.00, 200.00, 250.00, 'Mumbai', 'closed', '2026-04-06 14:40:51', '2026-04-06 14:46:07');

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint(20) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `mobile` varchar(20) DEFAULT NULL,
  `role` enum('farmer','buyer','admin') DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `latitude` decimal(10,8) DEFAULT NULL,
  `longitude` decimal(11,8) DEFAULT NULL,
  `rating` float DEFAULT 0,
  `is_active` tinyint(1) DEFAULT 1,
  `is_verified` tinyint(1) DEFAULT 0,
  `is_blocked` tinyint(1) DEFAULT 0,
  `kyc_status` enum('pending','approved','rejected') DEFAULT 'pending',
  `profile_image` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `password` varchar(200) DEFAULT NULL,
  `remember_token` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `name`, `mobile`, `role`, `location`, `latitude`, `longitude`, `rating`, `is_active`, `is_verified`, `is_blocked`, `kyc_status`, `profile_image`, `created_at`, `updated_at`, `password`) VALUES
(1, 'Ramesh Patil', '9111111111', 'farmer', 'Nashik, Maharashtra', 20.00560000, 73.78970000, 4.5, 1, 1, 0, 'approved', NULL, '2026-01-01 08:00:00', '2026-01-01 08:00:00', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'),
(2, 'Suresh Kumar', '9222222222', 'farmer', 'Pune, Maharashtra', 18.52040000, 73.85670000, 4.2, 1, 1, 0, 'approved', NULL, '2026-01-02 08:00:00', '2026-01-02 08:00:00', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'),
(3, 'Anil Deshmukh', '9333333333', 'farmer', 'Aurangabad, Maharashtra', 19.87620000, 75.34330000, 3.8, 1, 1, 0, 'approved', NULL, '2026-01-03 08:00:00', '2026-01-03 08:00:00', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'),
(4, 'Fresh Mart Ltd', '9555555555', 'buyer', 'Mumbai, Maharashtra', 19.07600000, 72.87770000, 4.7, 1, 1, 0, 'approved', NULL, '2026-01-04 08:00:00', '2026-01-04 08:00:00', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'),
(5, 'Agro Exports Co', '9666666666', 'buyer', 'Nagpur, Maharashtra', 21.14580000, 79.08820000, 4, 1, 1, 0, 'approved', NULL, '2026-01-05 08:00:00', '2026-01-05 08:00:00', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'),
(6, 'City Vegetables', '9777777777', 'buyer', 'Pune, Maharashtra', 18.52040000, 73.85670000, 4.3, 1, 1, 0, 'approved', NULL, '2026-01-06 08:00:00', '2026-01-06 08:00:00', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'),
(7, 'Admin', '9999999999', 'admin', 'Pune, Maharashtra', 18.52040000, 73.85670000, 5, 1, 1, 0, 'approved', NULL, '2026-01-01 00:00:00', '2026-01-01 00:00:00', '$2y$10$ZideoW7WiU10lhW8Jsl0YerqzHE9hwNMzzZDZwOOrCfWrpR/J/TPC'),
(8, 'Pending Farmer', '9888888888', 'farmer', 'Satara, Maharashtra', 17.68050000, 74.01830000, 0, 1, 0, 0, 'pending', NULL, '2026-04-06 03:46:33', '2026-04-06 03:46:33', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi');

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

--
-- Table structure for table `user_verifications`
--

CREATE TABLE `user_verifications` (
  `id` bigint(20) NOT NULL,
  `user_id` bigint(20) DEFAULT NULL,
  `document_type` enum('aadhaar','pan','license') DEFAULT NULL,
  `document_number` varchar(100) DEFAULT NULL,
  `document_file` text DEFAULT NULL,
  `status` enum('pending','approved','rejected') DEFAULT 'pending',
  `verified_by` bigint(20) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_verifications`
--

INSERT INTO `user_verifications` (`id`, `user_id`, `document_type`, `document_number`, `document_file`, `status`, `verified_by`, `created_at`, `updated_at`) VALUES
(1, 1, 'aadhaar', '1234-5678-9012', 'https://dummyimage.com/600x400/228B22/ffffff&text=Aadhaar+Card+Ramesh+Patil', 'approved', 7, '2026-01-01 10:00:00', '2026-01-01 11:00:00'),
(2, 2, 'pan', 'ABCDE1234F', 'https://dummyimage.com/600x400/228B22/ffffff&text=PAN+Card+Suresh+Kumar', 'approved', 7, '2026-01-02 10:00:00', '2026-01-02 11:00:00'),
(3, 3, 'license', 'MH12-2020-1234', 'https://dummyimage.com/600x400/228B22/ffffff&text=License+Anil+Deshmukh', 'approved', 7, '2026-01-03 10:00:00', '2026-01-03 11:00:00'),
(4, 4, 'aadhaar', '9876-5432-1098', 'https://dummyimage.com/600x400/1E90FF/ffffff&text=Aadhaar+Card+Fresh+Mart+Ltd', 'approved', 7, '2026-01-04 10:00:00', '2026-01-04 11:00:00'),
(5, 5, 'pan', 'XYZPQ5678G', 'https://dummyimage.com/600x400/1E90FF/ffffff&text=PAN+Card+Agro+Exports+Co', 'approved', 7, '2026-01-05 10:00:00', '2026-01-05 11:00:00'),
(6, 6, 'aadhaar', '5555-6666-7777', 'https://dummyimage.com/600x400/1E90FF/ffffff&text=Aadhaar+Card+City+Vegetables', 'approved', 7, '2026-01-06 10:00:00', '2026-01-06 11:00:00');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin_logs`
--
ALTER TABLE `admin_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `admin_id` (`admin_id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `chats`
--
ALTER TABLE `chats`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sender_id` (`sender_id`),
  ADD KEY `receiver_id` (`receiver_id`);

--
-- Indexes for table `contracts`
--
ALTER TABLE `contracts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `deal_id` (`deal_id`);

--
-- Indexes for table `contract_documents`
--
ALTER TABLE `contract_documents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contract_id` (`contract_id`);

--
-- Indexes for table `deals`
--
ALTER TABLE `deals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `requirement_id` (`requirement_id`),
  ADD KEY `farmer_id` (`farmer_id`),
  ADD KEY `buyer_id` (`buyer_id`);

--
-- Indexes for table `deliveries`
--
ALTER TABLE `deliveries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `deal_id` (`deal_id`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `offers`
--
ALTER TABLE `offers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `requirement_id` (`requirement_id`),
  ADD KEY `farmer_id` (`farmer_id`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `deal_id` (`deal_id`);

--
-- Indexes for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);

--
-- Indexes for table `price_history`
--
ALTER TABLE `price_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_id` (`product_id`);

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `product_images`
--
ALTER TABLE `product_images`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_id` (`product_id`);

--
-- Indexes for table `ratings`
--
ALTER TABLE `ratings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `from_user_id` (`from_user_id`),
  ADD KEY `to_user_id` (`to_user_id`);

--
-- Indexes for table `reports`
--
ALTER TABLE `reports`
  ADD PRIMARY KEY (`id`),
  ADD KEY `reported_by` (`reported_by`),
  ADD KEY `reported_user_id` (`reported_user_id`);

--
-- Indexes for table `requirements`
--
ALTER TABLE `requirements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `buyer_id` (`buyer_id`),
  ADD KEY `product_id` (`product_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `mobile` (`mobile`);

--
-- Indexes for table `user_verifications`
--
ALTER TABLE `user_verifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `verified_by` (`verified_by`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admin_logs`
--
ALTER TABLE `admin_logs`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `chats`
--
ALTER TABLE `chats`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `contracts`
--
ALTER TABLE `contracts`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `contract_documents`
--
ALTER TABLE `contract_documents`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `deals`
--
ALTER TABLE `deals`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `deliveries`
--
ALTER TABLE `deliveries`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `notifications`
--
ALTER TABLE `notifications`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;

--
-- AUTO_INCREMENT for table `offers`
--
ALTER TABLE `offers`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `price_history`
--
ALTER TABLE `price_history`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `product_images`
--
ALTER TABLE `product_images`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `ratings`
--
ALTER TABLE `ratings`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `reports`
--
ALTER TABLE `reports`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `requirements`
--
ALTER TABLE `requirements`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `user_verifications`
--
ALTER TABLE `user_verifications`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `admin_logs`
--
ALTER TABLE `admin_logs`
  ADD CONSTRAINT `admin_logs_ibfk_1` FOREIGN KEY (`admin_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `admin_logs_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `chats`
--
ALTER TABLE `chats`
  ADD CONSTRAINT `chats_ibfk_1` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `chats_ibfk_2` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `contracts`
--
ALTER TABLE `contracts`
  ADD CONSTRAINT `contracts_ibfk_1` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `contract_documents`
--
ALTER TABLE `contract_documents`
  ADD CONSTRAINT `contract_documents_ibfk_1` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `deals`
--
ALTER TABLE `deals`
  ADD CONSTRAINT `deals_ibfk_1` FOREIGN KEY (`requirement_id`) REFERENCES `requirements` (`id`),
  ADD CONSTRAINT `deals_ibfk_2` FOREIGN KEY (`farmer_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `deals_ibfk_3` FOREIGN KEY (`buyer_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `deliveries`
--
ALTER TABLE `deliveries`
  ADD CONSTRAINT `deliveries_ibfk_1` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `offers`
--
ALTER TABLE `offers`
  ADD CONSTRAINT `offers_ibfk_1` FOREIGN KEY (`requirement_id`) REFERENCES `requirements` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `offers_ibfk_2` FOREIGN KEY (`farmer_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_ibfk_1` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`);

--
-- Constraints for table `price_history`
--
ALTER TABLE `price_history`
  ADD CONSTRAINT `price_history_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);

--
-- Constraints for table `product_images`
--
ALTER TABLE `product_images`
  ADD CONSTRAINT `product_images_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ratings`
--
ALTER TABLE `ratings`
  ADD CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`from_user_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`to_user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `reports`
--
ALTER TABLE `reports`
  ADD CONSTRAINT `reports_ibfk_1` FOREIGN KEY (`reported_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `reports_ibfk_2` FOREIGN KEY (`reported_user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `requirements`
--
ALTER TABLE `requirements`
  ADD CONSTRAINT `requirements_ibfk_1` FOREIGN KEY (`buyer_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `requirements_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);

--
-- Constraints for table `user_verifications`
--
ALTER TABLE `user_verifications`
  ADD CONSTRAINT `user_verifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `user_verifications_ibfk_2` FOREIGN KEY (`verified_by`) REFERENCES `users` (`id`);
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 */;
