Add more tables and berrydash database

This commit is contained in:
2025-12-17 16:37:06 -07:00
parent 6d5259df09
commit 58a51530e7
3 changed files with 295 additions and 23 deletions

View File

@@ -0,0 +1,180 @@
-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Dec 17, 2025 at 11:36 PM
-- Server version: 12.1.2-MariaDB
-- PHP Version: 8.5.1
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: `berrydashdatabase`
--
-- --------------------------------------------------------
--
-- Table structure for table `chatroom_reports`
--
CREATE TABLE `chatroom_reports` (
`id` int(11) NOT NULL,
`chatId` int(11) NOT NULL,
`userId` int(11) NOT NULL,
`reason` longtext NOT NULL,
`timestamp` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
-- --------------------------------------------------------
--
-- Table structure for table `chats`
--
CREATE TABLE `chats` (
`id` int(11) NOT NULL,
`userId` int(11) NOT NULL,
`content` longtext NOT NULL,
`timestamp` bigint(20) NOT NULL,
`deleted_at` bigint(20) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
-- --------------------------------------------------------
--
-- Table structure for table `marketplaceicons`
--
CREATE TABLE `marketplaceicons` (
`id` int(11) NOT NULL,
`userId` int(11) NOT NULL,
`data` longtext NOT NULL,
`hash` varchar(128) NOT NULL,
`timestamp` bigint(20) NOT NULL,
`state` tinyint(1) NOT NULL DEFAULT 0,
`price` int(11) NOT NULL DEFAULT 0,
`name` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
-- --------------------------------------------------------
--
-- Table structure for table `userdata`
--
CREATE TABLE `userdata` (
`id` int(11) NOT NULL,
`token` varchar(512) NOT NULL,
`save_data` longtext NOT NULL DEFAULT '{}',
`legacy_high_score` bigint(20) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
-- --------------------------------------------------------
--
-- 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;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `chatroom_reports`
--
ALTER TABLE `chatroom_reports`
ADD PRIMARY KEY (`id`),
ADD KEY `chatId` (`chatId`);
--
-- Indexes for table `chats`
--
ALTER TABLE `chats`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `marketplaceicons`
--
ALTER TABLE `marketplaceicons`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `userdata`
--
ALTER TABLE `userdata`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `userposts`
--
ALTER TABLE `userposts`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `chatroom_reports`
--
ALTER TABLE `chatroom_reports`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `chats`
--
ALTER TABLE `chats`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `marketplaceicons`
--
ALTER TABLE `marketplaceicons`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `userdata`
--
ALTER TABLE `userdata`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `userposts`
--
ALTER TABLE `userposts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `chatroom_reports`
--
ALTER TABLE `chatroom_reports`
ADD CONSTRAINT `chatId` FOREIGN KEY (`chatId`) REFERENCES `chats` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
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 */;

View File

@@ -3,9 +3,9 @@
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- Host: localhost -- Host: localhost
-- Generation Time: Nov 05, 2025 at 05:35 PM -- Generation Time: Dec 17, 2025 at 11:36 PM
-- Server version: 12.0.2-MariaDB -- Server version: 12.1.2-MariaDB
-- PHP Version: 8.4.14 -- PHP Version: 8.5.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION; START TRANSACTION;
@@ -72,6 +72,22 @@ CREATE TABLE `launcherversions` (
`sizes` text NOT NULL DEFAULT '\'[]\'' `sizes` text NOT NULL DEFAULT '\'[]\''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(60) NOT NULL,
`email` varchar(255) NOT NULL,
`latest_ip` varchar(255) DEFAULT NULL,
`register_time` int(11) NOT NULL,
`leaderboards_banned` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
-- --
-- Indexes for dumped tables -- Indexes for dumped tables
-- --
@@ -95,6 +111,12 @@ ALTER TABLE `launcherversions`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
ADD KEY `fk_game` (`game`); ADD KEY `fk_game` (`game`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
-- --
-- AUTO_INCREMENT for dumped tables -- AUTO_INCREMENT for dumped tables
-- --
@@ -105,6 +127,12 @@ ALTER TABLE `launcherversions`
ALTER TABLE `launchergames` ALTER TABLE `launchergames`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
-- --
-- Constraints for dumped tables -- Constraints for dumped tables
-- --

View File

@@ -2,44 +2,108 @@ import {
bigint, bigint,
boolean, boolean,
int, int,
longtext,
mysqlTable, mysqlTable,
text, text,
tinyint,
varchar varchar
} from 'drizzle-orm/mysql-core' } from 'drizzle-orm/mysql-core'
// lncvrtgames
export const users = mysqlTable('users', {
id: int('id').primaryKey().autoincrement().notNull(),
username: varchar('username', { length: 255 }).notNull(),
password: varchar('password', { length: 60 }).notNull(),
email: varchar('email', { length: 255 }).notNull(),
latestIp: varchar('latest_ip', { length: 255 }),
registerTime: int('register_time').notNull(),
leaderboardsBanned: boolean('leaderboards_banned').default(false).notNull()
})
export const launcherUpdates = mysqlTable('launcherupdates', {
id: varchar('id', { length: 24 }).primaryKey().notNull(),
releaseDate: bigint('releaseDate', { mode: 'number' }).notNull(),
downloadUrls: text('downloadUrls').notNull(),
platforms: text('platforms').notNull(),
executables: text('executables').notNull(),
hidden: boolean('hidden').default(false).notNull(),
place: int('place').default(0).notNull(),
sha512sums: text('sha512sums').default('[]').notNull()
})
export const launcherGames = mysqlTable('launchergames', { export const launcherGames = mysqlTable('launchergames', {
id: int('id').primaryKey().autoincrement(), id: int('id').primaryKey().autoincrement().notNull(),
name: text('name').notNull(), name: text('name').notNull(),
official: boolean('official').notNull().default(false), official: boolean('official').default(false).notNull(),
verified: boolean('verified').notNull().default(false), verified: boolean('verified').default(false).notNull(),
developer: varchar('developer', { length: 32 }), developer: varchar('developer', { length: 32 }),
cutOff: int('cutOff').notNull().default(-1) cutOff: int('cutOff').default(-1)
}) })
export const launcherVersions = mysqlTable('launcherversions', { export const launcherVersions = mysqlTable('launcherversions', {
id: varchar('id', { length: 24 }).primaryKey(), id: varchar('id', { length: 24 }).primaryKey().notNull(),
versionName: text('versionName').notNull(), versionName: text('versionName').notNull(),
releaseDate: bigint('releaseDate', { mode: 'number' }).notNull(), releaseDate: bigint('releaseDate', { mode: 'number' }).notNull(),
downloadUrls: text('downloadUrls').notNull(), downloadUrls: text('downloadUrls').notNull(),
platforms: text('platforms').notNull(), platforms: text('platforms').notNull(),
executables: text('executables').notNull(), executables: text('executables').notNull(),
hidden: boolean('hidden').notNull().default(false), hidden: boolean('hidden').default(false).notNull(),
game: int('game') game: int('game')
.notNull()
.default(0) .default(0)
.references(() => launcherGames.id), .references(() => launcherGames.id)
place: int('place').notNull().default(0), .notNull(),
sha512sums: text('sha512sums').notNull().default('[]'), place: int('place').default(0).notNull(),
sizes: text('sizes').notNull().default('[]') sha512sums: text('sha512sums').default('[]').notNull(),
sizes: text('sizes').default('[]').notNull()
}) })
export const launcherUpdates = mysqlTable('launcherupdates', { // berrydashdatabase
id: varchar('id', { length: 24 }).primaryKey(),
releaseDate: bigint('releaseDate', { mode: 'number' }).notNull(), export const berryDashUserData = mysqlTable('userdata', {
downloadUrls: text('downloadUrls').notNull(), id: int('id').primaryKey().autoincrement().notNull(),
platforms: text('platforms').notNull(), token: varchar('token', { length: 512 }).notNull(),
executables: text('executables').notNull(), saveData: longtext('save_data').default('{}').notNull(),
hidden: boolean('hidden').notNull().default(false), legacyHighScore: bigint('legacy_high_score', { mode: 'number' })
place: int('place').notNull().default(0), .default(0)
sha512sums: text('sha512sums').notNull().default('[]') .notNull()
})
export const berryDashUserPosts = mysqlTable('userdata', {
id: int('id').primaryKey().autoincrement().notNull(),
userId: int('userId').notNull(),
content: text('content').notNull(),
timestamp: int('timestamp').notNull(),
likes: bigint('likes', { mode: 'number' }).default(0).notNull(),
deletedAt: int('deleted_at').default(0).notNull(),
votes: text('votes').default('{}').notNull()
})
export const berryDashChats = mysqlTable('chats', {
id: int('id').primaryKey().autoincrement().notNull(),
userId: int('userId').notNull(),
content: longtext('content').notNull(),
timestamp: bigint('timestamp', { mode: 'number' }).notNull(),
deletedAt: bigint('deleted_at', { mode: 'number' }).default(0).notNull()
})
export const berryDashChatroomReports = mysqlTable('chatroom_reports', {
id: int('id').primaryKey().autoincrement().notNull(),
chatId: int('chatId')
.references(() => berryDashChats.id)
.notNull(),
userId: int('userId').notNull(),
reason: longtext('reason').notNull(),
timestamp: bigint('timestamp', { mode: 'number' }).notNull()
})
export const berryDashMarketplaceIcons = mysqlTable('marketplaceicons', {
id: int('id').primaryKey().autoincrement().notNull(),
userId: int('userId').notNull(),
data: longtext('data').notNull(),
hash: varchar('hash', { length: 128 }).notNull(),
timestamp: bigint('timestamp', { mode: 'number' }).notNull(),
state: tinyint('state').default(0).notNull(),
price: int('price').default(0).notNull(),
name: text('name').notNull()
}) })