57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
/**
|
|
* In theory you should be able to just modify the imports here if you want to
|
|
* use a different database driver.
|
|
*/
|
|
import { integer, text, real, sqliteTable } from "drizzle-orm/sqlite-core";
|
|
|
|
export const arcade = sqliteTable("allnet_arcade", {
|
|
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
|
|
name: text("name", { length: 60 }).default("Random arcade at nowhere"),
|
|
nickname: text("nickname", { length: 40 }).default("Please send help"),
|
|
country: text("country", { length: 3 }).default("JPN"),
|
|
|
|
/**
|
|
* Largest to smallest units of administrative division
|
|
*/
|
|
regionId: integer("region_id").default(1),
|
|
regionName0: text("region_name0", { length: 48 }).default("W"),
|
|
regionName1: text("region_name1", { length: 48 }).default(""),
|
|
regionName2: text("region_name2", { length: 48 }).default(""),
|
|
regionName3: text("region_name3", { length: 48 }).default(""),
|
|
|
|
/**
|
|
* Client timezone. There's probably no arcades that span
|
|
* 2 timezones, right...?
|
|
*/
|
|
utcOffset: real("utc_offset").default(9),
|
|
});
|
|
|
|
export type Arcade = typeof arcade.$inferSelect;
|
|
export type NewArcade = typeof arcade.$inferInsert;
|
|
|
|
export const arcadeIp = sqliteTable("allnet_arcade_ip", {
|
|
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
|
|
arcade_id: integer("arcade_id").references(() => arcade.id),
|
|
ip: text("ip", { length: 15 }).unique(),
|
|
});
|
|
|
|
export type ArcadeIp = typeof arcadeIp.$inferSelect;
|
|
export type NewArcadeIp = typeof arcadeIp.$inferInsert;
|
|
|
|
export const machine = sqliteTable("allnet_machine", {
|
|
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
arcade_id: integer("arcade_id").references(() => arcade.id),
|
|
|
|
serial: text("serial", { length: 11 }).unique(),
|
|
game: text("game", { length: 5 }),
|
|
|
|
canVenueHop: integer("can_venue_hop", { mode: "boolean" }),
|
|
|
|
lastAuthenticated: integer("last_authenticated", { mode: "timestamp" }),
|
|
});
|
|
|
|
export type Machine = typeof machine.$inferSelect;
|
|
export type NewMachine = typeof machine.$inferInsert;
|