From 3a68eaba868a0cf1e3bc7628e02989cb04988d99 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Fri, 12 Sep 2025 10:45:49 -0700 Subject: [PATCH] Add a option for me to hide launcher versions and update db --- database.sql | 40 ++++++++++++++++++++++++++++++++-- database/launcher/versions.php | 2 +- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/database.sql b/database.sql index a3eb8d5..a29d8fa 100644 --- a/database.sql +++ b/database.sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 --- Generation Time: Aug 28, 2025 at 08:21 PM +-- Generation Time: Sep 12, 2025 at 07:45 PM -- Server version: 11.8.3-MariaDB-ubu2404 -- PHP Version: 8.1.33 @@ -62,7 +62,8 @@ CREATE TABLE `launcherversions` ( `releaseDate` bigint(20) NOT NULL, `downloadUrls` text NOT NULL, `platforms` text NOT NULL, - `executables` text NOT NULL + `executables` text NOT NULL, + `hidden` tinyint(1) NOT NULL DEFAULT 1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED; -- -------------------------------------------------------- @@ -85,6 +86,22 @@ CREATE TABLE `marketplaceicons` ( -- -------------------------------------------------------- +-- +-- Table structure for table `userposts` +-- + +CREATE TABLE `userposts` ( + `id` int(11) NOT NULL, + `userId` int(11) NOT NULL, + `content` text NOT NULL, + `timestamp` int(11) NOT NULL, + `likes` bigint(20) NOT NULL DEFAULT 0, + `deleted_at` int(11) NOT NULL DEFAULT 0, + `votes` text NOT NULL DEFAULT '[]' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci; + +-- -------------------------------------------------------- + -- -- Table structure for table `users` -- @@ -135,6 +152,13 @@ ALTER TABLE `marketplaceicons` ADD PRIMARY KEY (`id`), ADD KEY `fk_userId` (`userId`); +-- +-- Indexes for table `userposts` +-- +ALTER TABLE `userposts` + ADD PRIMARY KEY (`id`), + ADD KEY `fk_userposts_userId` (`userId`); + -- -- Indexes for table `users` -- @@ -169,6 +193,12 @@ ALTER TABLE `launcherversions` ALTER TABLE `marketplaceicons` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `userposts` +-- +ALTER TABLE `userposts` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; + -- -- AUTO_INCREMENT for table `users` -- @@ -197,6 +227,12 @@ ALTER TABLE `chats` -- ALTER TABLE `marketplaceicons` ADD CONSTRAINT `fk_marketplaceicons_userId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints for table `userposts` +-- +ALTER TABLE `userposts` + ADD CONSTRAINT `fk_userposts_userId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/database/launcher/versions.php b/database/launcher/versions.php index c46e4e6..a3407af 100755 --- a/database/launcher/versions.php +++ b/database/launcher/versions.php @@ -3,7 +3,7 @@ require __DIR__ . '/../../incl/util.php'; setJsonHeader(); $conn = newConnection(); -$stmt = $conn->prepare("SELECT * FROM launcherversions ORDER BY id DESC"); +$stmt = $conn->prepare("SELECT * FROM launcherversions WHERE hidden = 0 ORDER BY id DESC"); $stmt->execute(); $result = $stmt->get_result();