231 lines
7.8 KiB
SQL
231 lines
7.8 KiB
SQL
/*M!999999\- enable the sandbox mode */
|
|
-- MariaDB dump 10.19 Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64)
|
|
--
|
|
-- Host: 127.0.0.1 Database: app_37018
|
|
-- ------------------------------------------------------
|
|
-- Server version 10.11.14-MariaDB-0+deb12u2
|
|
|
|
/*!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 */;
|
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
|
|
|
--
|
|
-- Table structure for table `categories`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `categories`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `categories` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`visibility` tinyint(1) NOT NULL DEFAULT 1,
|
|
`display_order` int(11) NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `categories`
|
|
--
|
|
|
|
LOCK TABLES `categories` WRITE;
|
|
/*!40000 ALTER TABLE `categories` DISABLE KEYS */;
|
|
INSERT INTO `categories` VALUES
|
|
(1,'Arts & Entertainment',1,0),
|
|
(2,'Business & Economy',1,0),
|
|
(3,'Computers & Internet',1,0),
|
|
(4,'Education',1,0),
|
|
(5,'Government',1,0),
|
|
(6,'Health & Fitness',1,0),
|
|
(7,'Home & Garden',1,0),
|
|
(8,'News & Media',1,0),
|
|
(9,'Recreation & Sports',1,0),
|
|
(10,'Reference',1,0),
|
|
(11,'Science & Technology',1,0),
|
|
(12,'Shopping',1,0),
|
|
(13,'Society & Culture',1,0),
|
|
(14,'Travel & Tourism',1,0),
|
|
(15,'Cars & Vehicles',1,0),
|
|
(16,'Food & Drink',1,0),
|
|
(17,'Law & Legal Issues',1,0),
|
|
(18,'Pets & Animals',1,0),
|
|
(19,'Real Estate',1,0),
|
|
(20,'Games',1,0);
|
|
/*!40000 ALTER TABLE `categories` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `links`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `links`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `links` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`user_id` int(11) NOT NULL,
|
|
`subcategory_id` int(11) NOT NULL,
|
|
`title` varchar(255) NOT NULL,
|
|
`url` varchar(2083) NOT NULL,
|
|
`description` text DEFAULT NULL,
|
|
`thumbnail_url` varchar(2083) DEFAULT NULL,
|
|
`status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `user_id` (`user_id`),
|
|
KEY `subcategory_id` (`subcategory_id`),
|
|
CONSTRAINT `links_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
|
|
CONSTRAINT `links_ibfk_2` FOREIGN KEY (`subcategory_id`) REFERENCES `subcategories` (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `links`
|
|
--
|
|
|
|
LOCK TABLES `links` WRITE;
|
|
/*!40000 ALTER TABLE `links` DISABLE KEYS */;
|
|
INSERT INTO `links` VALUES
|
|
(1,1,1,'test title','https://title.com','this is a test description',NULL,'approved','2025-12-17 15:34:06');
|
|
/*!40000 ALTER TABLE `links` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `moderation_logs`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `moderation_logs`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `moderation_logs` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`link_id` int(11) NOT NULL,
|
|
`moderator_id` int(11) NOT NULL,
|
|
`action` enum('approved','rejected') NOT NULL,
|
|
`notes` text DEFAULT NULL,
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `link_id` (`link_id`),
|
|
KEY `moderator_id` (`moderator_id`),
|
|
CONSTRAINT `moderation_logs_ibfk_1` FOREIGN KEY (`link_id`) REFERENCES `links` (`id`),
|
|
CONSTRAINT `moderation_logs_ibfk_2` FOREIGN KEY (`moderator_id`) REFERENCES `users` (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `moderation_logs`
|
|
--
|
|
|
|
LOCK TABLES `moderation_logs` WRITE;
|
|
/*!40000 ALTER TABLE `moderation_logs` DISABLE KEYS */;
|
|
/*!40000 ALTER TABLE `moderation_logs` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `subcategories`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `subcategories`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `subcategories` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`category_id` int(11) NOT NULL,
|
|
`name` varchar(255) NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `category_id` (`category_id`),
|
|
CONSTRAINT `subcategories_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `subcategories`
|
|
--
|
|
|
|
LOCK TABLES `subcategories` WRITE;
|
|
/*!40000 ALTER TABLE `subcategories` DISABLE KEYS */;
|
|
INSERT INTO `subcategories` VALUES
|
|
(1,1,'test Arts & Entertainment'),
|
|
(2,11,'Science & Technology syb');
|
|
/*!40000 ALTER TABLE `subcategories` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `users`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `users`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `users` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`username` varchar(50) NOT NULL,
|
|
`password` varchar(255) NOT NULL,
|
|
`role` enum('regular','power_user','admin') NOT NULL DEFAULT 'regular',
|
|
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `username` (`username`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `users`
|
|
--
|
|
|
|
LOCK TABLES `users` WRITE;
|
|
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
|
|
INSERT INTO `users` VALUES
|
|
(1,'admin','$2y$10$ZXgcZZeRqeZmt3gD1hqnVedgdgGwQ4R5dFoY6YRT.GY0StKYwnx5.','admin','2025-12-17 15:27:26');
|
|
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
|
|
--
|
|
-- Table structure for table `visits`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `visits`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `visits` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`link_id` int(11) DEFAULT NULL,
|
|
`user_id` int(11) DEFAULT NULL,
|
|
`ip_address` varchar(45) DEFAULT NULL,
|
|
`user_agent` text DEFAULT NULL,
|
|
`visited_at` timestamp NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
KEY `link_id` (`link_id`),
|
|
KEY `user_id` (`user_id`),
|
|
CONSTRAINT `visits_ibfk_1` FOREIGN KEY (`link_id`) REFERENCES `links` (`id`),
|
|
CONSTRAINT `visits_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `visits`
|
|
--
|
|
|
|
LOCK TABLES `visits` WRITE;
|
|
/*!40000 ALTER TABLE `visits` DISABLE KEYS */;
|
|
/*!40000 ALTER TABLE `visits` ENABLE KEYS */;
|
|
UNLOCK TABLES;
|
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
|
|
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
|
/*!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 */;
|
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
|
|
|
-- Dump completed on 2025-12-17 23:45:53
|