Use bigint instead of int and also fix get-verify-code endpoint because of a column rename
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
-- https://www.phpmyadmin.net/
|
-- https://www.phpmyadmin.net/
|
||||||
--
|
--
|
||||||
-- Host: localhost
|
-- Host: localhost
|
||||||
-- Generation Time: Jan 22, 2026 at 09:31 PM
|
-- Generation Time: Jan 23, 2026 at 12:59 AM
|
||||||
-- Server version: 12.1.2-MariaDB
|
-- Server version: 12.1.2-MariaDB
|
||||||
-- PHP Version: 8.5.2
|
-- PHP Version: 8.5.2
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ SET time_zone = "+00:00";
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE `games` (
|
CREATE TABLE `games` (
|
||||||
`id` int(11) NOT NULL,
|
`id` bigint(20) NOT NULL,
|
||||||
`name` text NOT NULL,
|
`name` text NOT NULL,
|
||||||
`official` tinyint(1) NOT NULL DEFAULT 0,
|
`official` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
`verified` tinyint(1) NOT NULL DEFAULT 0,
|
`verified` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
@@ -47,7 +47,7 @@ CREATE TABLE `launcherupdates` (
|
|||||||
`downloadUrls` text NOT NULL,
|
`downloadUrls` text NOT NULL,
|
||||||
`platforms` text NOT NULL,
|
`platforms` text NOT NULL,
|
||||||
`hidden` tinyint(1) NOT NULL DEFAULT 1,
|
`hidden` tinyint(1) NOT NULL DEFAULT 1,
|
||||||
`place` int(11) NOT NULL DEFAULT 0,
|
`place` bigint(20) NOT NULL DEFAULT 0,
|
||||||
`sha512sums` text NOT NULL DEFAULT '[]'
|
`sha512sums` 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;
|
||||||
|
|
||||||
@@ -65,8 +65,8 @@ CREATE TABLE `launcherversionmanifest` (
|
|||||||
`platforms` text NOT NULL,
|
`platforms` text NOT NULL,
|
||||||
`executables` text NOT NULL,
|
`executables` text NOT NULL,
|
||||||
`hidden` tinyint(1) NOT NULL DEFAULT 1,
|
`hidden` tinyint(1) NOT NULL DEFAULT 1,
|
||||||
`game` int(11) NOT NULL DEFAULT 0,
|
`game` bigint(20) NOT NULL DEFAULT 0,
|
||||||
`place` int(11) NOT NULL DEFAULT 0,
|
`place` bigint(20) NOT NULL DEFAULT 0,
|
||||||
`sha512sums` text NOT NULL DEFAULT '[]',
|
`sha512sums` text NOT NULL DEFAULT '[]',
|
||||||
`sizes` text NOT NULL DEFAULT '\'[]\'',
|
`sizes` text NOT NULL DEFAULT '\'[]\'',
|
||||||
`changelog` text DEFAULT NULL
|
`changelog` text DEFAULT NULL
|
||||||
@@ -82,7 +82,7 @@ CREATE TABLE `loaderupdates` (
|
|||||||
`id` varchar(24) NOT NULL,
|
`id` varchar(24) NOT NULL,
|
||||||
`releaseDate` bigint(20) NOT NULL,
|
`releaseDate` bigint(20) NOT NULL,
|
||||||
`hidden` tinyint(1) NOT NULL DEFAULT 1,
|
`hidden` tinyint(1) NOT NULL DEFAULT 1,
|
||||||
`place` int(11) NOT NULL DEFAULT 0
|
`place` bigint(20) NOT NULL DEFAULT 0
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
@@ -92,12 +92,12 @@ CREATE TABLE `loaderupdates` (
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE `users` (
|
CREATE TABLE `users` (
|
||||||
`id` int(11) NOT NULL,
|
`id` bigint(20) NOT NULL,
|
||||||
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||||
`password` varchar(60) NOT NULL,
|
`password` varchar(60) NOT NULL,
|
||||||
`email` varchar(255) NOT NULL,
|
`email` varchar(255) NOT NULL,
|
||||||
`latest_ip` varchar(255) DEFAULT NULL,
|
`latest_ip` varchar(255) DEFAULT NULL,
|
||||||
`register_time` int(11) NOT NULL,
|
`register_time` bigint(20) NOT NULL,
|
||||||
`leaderboards_banned` tinyint(1) NOT NULL DEFAULT 0
|
`leaderboards_banned` tinyint(1) NOT NULL DEFAULT 0
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||||
|
|
||||||
@@ -108,11 +108,11 @@ CREATE TABLE `users` (
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE `verifycodes` (
|
CREATE TABLE `verifycodes` (
|
||||||
`id` int(11) NOT NULL,
|
`id` bigint(20) NOT NULL,
|
||||||
`code` varchar(16) DEFAULT NULL,
|
`code` varchar(16) DEFAULT NULL,
|
||||||
`ip` varchar(255) DEFAULT NULL,
|
`ip` varchar(255) DEFAULT NULL,
|
||||||
`timestamp` int(11) NOT NULL,
|
`timestamp` bigint(20) NOT NULL,
|
||||||
`used` tinyint(1) NOT NULL DEFAULT 0
|
`usedTimestamp` bigint(20) NOT NULL DEFAULT 0
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -164,19 +164,19 @@ ALTER TABLE `verifycodes`
|
|||||||
-- AUTO_INCREMENT for table `games`
|
-- AUTO_INCREMENT for table `games`
|
||||||
--
|
--
|
||||||
ALTER TABLE `games`
|
ALTER TABLE `games`
|
||||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `users`
|
-- AUTO_INCREMENT for table `users`
|
||||||
--
|
--
|
||||||
ALTER TABLE `users`
|
ALTER TABLE `users`
|
||||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `verifycodes`
|
-- AUTO_INCREMENT for table `verifycodes`
|
||||||
--
|
--
|
||||||
ALTER TABLE `verifycodes`
|
ALTER TABLE `verifycodes`
|
||||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Constraints for dumped tables
|
-- Constraints for dumped tables
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ import {
|
|||||||
// lncvrtgames
|
// lncvrtgames
|
||||||
|
|
||||||
export const users = mysqlTable('users', {
|
export const users = mysqlTable('users', {
|
||||||
id: int('id').primaryKey().autoincrement().notNull(),
|
id: bigint('id', { mode: 'number' }).primaryKey().autoincrement().notNull(),
|
||||||
username: varchar('username', { length: 255 }).notNull(),
|
username: varchar('username', { length: 255 }).notNull(),
|
||||||
password: varchar('password', { length: 60 }).notNull(),
|
password: varchar('password', { length: 60 }).notNull(),
|
||||||
email: varchar('email', { length: 255 }).notNull(),
|
email: varchar('email', { length: 255 }).notNull(),
|
||||||
latestIp: varchar('latest_ip', { length: 255 }),
|
latestIp: varchar('latest_ip', { length: 255 }),
|
||||||
registerTime: int('register_time').notNull(),
|
registerTime: bigint('register_time', { mode: 'number' }).notNull(),
|
||||||
leaderboardsBanned: boolean('leaderboards_banned').default(false).notNull()
|
leaderboardsBanned: boolean('leaderboards_banned').default(false).notNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ export const launcherUpdates = mysqlTable('launcherupdates', {
|
|||||||
platforms: text('platforms').notNull(),
|
platforms: text('platforms').notNull(),
|
||||||
executables: text('executables').notNull(),
|
executables: text('executables').notNull(),
|
||||||
hidden: boolean('hidden').default(false).notNull(),
|
hidden: boolean('hidden').default(false).notNull(),
|
||||||
place: int('place').default(0).notNull(),
|
place: bigint('place', { mode: 'number' }).default(0).notNull(),
|
||||||
sha512sums: text('sha512sums').default('[]').notNull()
|
sha512sums: text('sha512sums').default('[]').notNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -36,11 +36,11 @@ export const loaderUpdates = mysqlTable('loaderupdates', {
|
|||||||
id: varchar('id', { length: 24 }).primaryKey().notNull(),
|
id: varchar('id', { length: 24 }).primaryKey().notNull(),
|
||||||
releaseDate: bigint('releaseDate', { mode: 'number' }).notNull(),
|
releaseDate: bigint('releaseDate', { mode: 'number' }).notNull(),
|
||||||
hidden: boolean('hidden').default(false).notNull(),
|
hidden: boolean('hidden').default(false).notNull(),
|
||||||
place: int('place').default(0).notNull()
|
place: bigint('place', { mode: 'number' }).default(0).notNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
export const games = mysqlTable('games', {
|
export const games = mysqlTable('games', {
|
||||||
id: int('id').primaryKey().autoincrement().notNull(),
|
id: bigint('id', { mode: 'number' }).primaryKey().autoincrement().notNull(),
|
||||||
name: text('name').notNull(),
|
name: text('name').notNull(),
|
||||||
official: boolean('official').default(false).notNull(),
|
official: boolean('official').default(false).notNull(),
|
||||||
verified: boolean('verified').default(false).notNull(),
|
verified: boolean('verified').default(false).notNull(),
|
||||||
@@ -55,22 +55,24 @@ export const launcherVersionManifest = mysqlTable('launcherversionmanifest', {
|
|||||||
platforms: text('platforms').notNull(),
|
platforms: text('platforms').notNull(),
|
||||||
executables: text('executables').notNull(),
|
executables: text('executables').notNull(),
|
||||||
hidden: boolean('hidden').default(false).notNull(),
|
hidden: boolean('hidden').default(false).notNull(),
|
||||||
game: int('game')
|
game: bigint('game', { mode: 'number' })
|
||||||
.default(0)
|
.default(0)
|
||||||
.references(() => games.id)
|
.references(() => games.id)
|
||||||
.notNull(),
|
.notNull(),
|
||||||
place: int('place').default(0).notNull(),
|
place: bigint('place', { mode: 'number' }).default(0).notNull(),
|
||||||
sha512sums: text('sha512sums').default('[]').notNull(),
|
sha512sums: text('sha512sums').default('[]').notNull(),
|
||||||
sizes: text('sizes').default('[]').notNull(),
|
sizes: text('sizes').default('[]').notNull(),
|
||||||
changelog: text('changelog')
|
changelog: text('changelog')
|
||||||
})
|
})
|
||||||
|
|
||||||
export const verifyCodes = mysqlTable('verifycodes', {
|
export const verifyCodes = mysqlTable('verifycodes', {
|
||||||
id: int('id').primaryKey().autoincrement().notNull(),
|
id: bigint('id', { mode: 'number' }).primaryKey().autoincrement().notNull(),
|
||||||
code: varchar('code', { length: 16 }).notNull(),
|
code: varchar('code', { length: 16 }).notNull(),
|
||||||
ip: varchar('ip', { length: 255 }),
|
ip: varchar('ip', { length: 255 }),
|
||||||
timestamp: int('timestamp').notNull(),
|
timestamp: bigint('timestamp', { mode: 'number' }).notNull(),
|
||||||
used: boolean('used').default(false).notNull()
|
usedTimestamp: bigint('usedTimestamp', { mode: 'number' })
|
||||||
|
.default(0)
|
||||||
|
.notNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
// berrydashdatabase
|
// berrydashdatabase
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export async function handler (context: Context) {
|
|||||||
.where(
|
.where(
|
||||||
and(
|
and(
|
||||||
eq(verifyCodes.ip, ip),
|
eq(verifyCodes.ip, ip),
|
||||||
eq(verifyCodes.used, false),
|
eq(verifyCodes.usedTimestamp, 0),
|
||||||
sql`${verifyCodes.timestamp} >= UNIX_TIMESTAMP() - 600`
|
sql`${verifyCodes.timestamp} >= UNIX_TIMESTAMP() - 600`
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user