Fix: Using bigint and added backend testing

This commit is contained in:
aronmal 2024-03-10 17:12:50 +01:00
parent ed6195e1e2
commit 89507f8412
Signed by: aronmal
GPG key ID: 816B7707426FC612
20 changed files with 830 additions and 292 deletions

View file

@ -1,7 +1,7 @@
import { relations } from "drizzle-orm";
import {
bigint,
boolean,
integer,
pgTable,
primaryKey,
serial,
@ -39,14 +39,16 @@ export const discordTokens = pgTable("tokens", {
});
export const guilds = pgTable("guilds", {
id: integer("id").primaryKey(),
id: bigint("id", { mode: "bigint" }).primaryKey(),
timezone: text("timezone").notNull().default("Etc/UTC"),
tpEnabled: boolean("tp_enabled").notNull().default(false),
tpChannelId: integer("tp_channel_id"),
tpInterval: smallint("target_interval").notNull(),
tpRoles: boolean("tp_roles").notNull(),
isAvailableRoleId: integer("is_available_role_id"),
wantsToBeNotifieRoledId: integer("wants_to_be_notified_role_id"),
tpChannelId: bigint("tp_channel_id", { mode: "bigint" }),
tpInterval: smallint("target_interval").notNull().default(64),
tpRolesEnabled: boolean("tp_roles_enabled").notNull().default(false),
isAvailableRoleId: bigint("is_available_role_id", { mode: "bigint" }),
wantsToBeNotifieRoledId: bigint("wants_to_be_notified_role_id", {
mode: "bigint",
}),
});
export const guildsRelations = relations(guilds, ({ many }) => ({
@ -57,9 +59,9 @@ export const guildsRelations = relations(guilds, ({ many }) => ({
export const tpMessages = pgTable(
"tp_messages",
{
messageId: integer("message_id"),
messageId: bigint("message_id", { mode: "bigint" }),
day: smallint("day").notNull(),
guildId: integer("guild_id")
guildId: bigint("guild_id", { mode: "bigint" })
.notNull()
.references(() => guilds.id, { onDelete: "cascade" }),
},
@ -79,14 +81,14 @@ export const tpMessagesRelations = relations(tpMessages, ({ one }) => ({
export const matches = pgTable("matches", {
id: serial("id").primaryKey(),
channelId: integer("channel_id").notNull(),
channelId: bigint("channel_id", { mode: "bigint" }).notNull(),
matchType: varchar("match_type", { length: 50 }).notNull(),
createrId: integer("creater_id").notNull(),
roleId: integer("role_id").notNull(),
createrId: bigint("creater_id", { mode: "bigint" }).notNull(),
roleId: bigint("role_id", { mode: "bigint" }).notNull(),
opponentName: varchar("opponent_name", { length: 100 }).notNull(),
messageId: integer("message_id").notNull(),
messageId: bigint("message_id", { mode: "bigint" }).notNull(),
utc_ts: timestamp("utc_ts").notNull(),
guildId: integer("guild_id")
guildId: bigint("guild_id", { mode: "bigint" })
.notNull()
.references(() => guilds.id, { onDelete: "cascade" }),
});