-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 17-03-2026 a las 19:52:30
-- Versión del servidor: 10.4.32-MariaDB
-- Versión de 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 */;

--
-- Base de datos: `mu_web`
--

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

--
-- Estructura de tabla para la tabla `news`
--

CREATE TABLE `news` (
  `id` int(11) NOT NULL,
  `title` varchar(150) NOT NULL,
  `slug` varchar(180) NOT NULL,
  `content` text NOT NULL,
  `is_published` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `purchase_logs`
--

CREATE TABLE `purchase_logs` (
  `id` bigint(20) NOT NULL,
  `adapter_name` varchar(30) NOT NULL,
  `account_username` varchar(50) NOT NULL,
  `character_name` varchar(20) NOT NULL,
  `item_code` varchar(100) NOT NULL,
  `item_name` varchar(120) NOT NULL,
  `price` int(11) NOT NULL,
  `credits_before` int(11) DEFAULT NULL,
  `credits_after` int(11) DEFAULT NULL,
  `status` varchar(30) NOT NULL,
  `message` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `settings`
--

CREATE TABLE `settings` (
  `id` int(11) NOT NULL,
  `key` varchar(100) NOT NULL,
  `value` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `shop_items`
--

CREATE TABLE `shop_items` (
  `id` int(11) NOT NULL,
  `code` varchar(100) NOT NULL,
  `name` varchar(120) NOT NULL,
  `image_file` varchar(255) DEFAULT NULL,
  `category` varchar(60) NOT NULL DEFAULT 'General',
  `class_restriction` varchar(30) NOT NULL DEFAULT 'ALL',
  `currency` varchar(30) NOT NULL DEFAULT 'WCoinC',
  `price` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `sort_order` int(11) NOT NULL DEFAULT 100,
  `delivery_mode` varchar(40) NOT NULL DEFAULT 'log_only',
  `base_item_code` int(11) NOT NULL DEFAULT 0,
  `main_item_code` int(11) NOT NULL DEFAULT 0,
  `inventory_type` int(11) NOT NULL DEFAULT 0,
  `package_main_index` int(11) NOT NULL DEFAULT 0,
  `product_base_index` int(11) NOT NULL DEFAULT 0,
  `product_main_index` int(11) NOT NULL DEFAULT 0,
  `coin_value` int(11) NOT NULL DEFAULT 0,
  `product_type` int(11) NOT NULL DEFAULT 0,
  `gift_name` varchar(100) DEFAULT NULL,
  `gift_text` varchar(200) DEFAULT NULL,
  `gift_quantity` int(11) NOT NULL DEFAULT 1,
  `allow_skill` tinyint(1) NOT NULL DEFAULT 0,
  `allow_luck` tinyint(1) NOT NULL DEFAULT 1,
  `allow_excellent` tinyint(1) NOT NULL DEFAULT 1,
  `allow_ancient` tinyint(1) NOT NULL DEFAULT 0,
  `allow_socket` tinyint(1) NOT NULL DEFAULT 0,
  `allow_harmony` tinyint(1) NOT NULL DEFAULT 0,
  `max_level` tinyint(3) UNSIGNED NOT NULL DEFAULT 15,
  `max_option` tinyint(3) UNSIGNED NOT NULL DEFAULT 7,
  `max_socket_count` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
  `custom_sql` text DEFAULT NULL,
  `image_path` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `shop_orders`
--

CREATE TABLE `shop_orders` (
  `id` bigint(20) NOT NULL,
  `adapter_name` varchar(30) NOT NULL,
  `account_username` varchar(50) NOT NULL,
  `character_name` varchar(20) NOT NULL,
  `item_id` int(11) NOT NULL,
  `item_code` varchar(100) NOT NULL,
  `item_name` varchar(120) NOT NULL,
  `currency` varchar(30) NOT NULL,
  `price` int(11) NOT NULL,
  `credits_before` int(11) DEFAULT NULL,
  `credits_after` int(11) DEFAULT NULL,
  `order_status` varchar(30) NOT NULL DEFAULT 'pending',
  `delivery_mode` varchar(40) NOT NULL DEFAULT 'log_only',
  `delivery_status` varchar(40) NOT NULL DEFAULT 'pending',
  `result_message` varchar(255) DEFAULT NULL,
  `metadata_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata_json`)),
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `news`
--
ALTER TABLE `news`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `slug` (`slug`);

--
-- Indices de la tabla `purchase_logs`
--
ALTER TABLE `purchase_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_account_username` (`account_username`),
  ADD KEY `idx_status` (`status`);

--
-- Indices de la tabla `settings`
--
ALTER TABLE `settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `key` (`key`);

--
-- Indices de la tabla `shop_items`
--
ALTER TABLE `shop_items`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `code` (`code`),
  ADD KEY `idx_shop_items_active` (`is_active`),
  ADD KEY `idx_shop_items_sort` (`sort_order`);

--
-- Indices de la tabla `shop_orders`
--
ALTER TABLE `shop_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_shop_orders_account` (`account_username`),
  ADD KEY `idx_shop_orders_status` (`order_status`),
  ADD KEY `idx_shop_orders_item` (`item_code`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `news`
--
ALTER TABLE `news`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `purchase_logs`
--
ALTER TABLE `purchase_logs`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `settings`
--
ALTER TABLE `settings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `shop_items`
--
ALTER TABLE `shop_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `shop_orders`
--
ALTER TABLE `shop_orders`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
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 */;
