Two teams try and fill in any horizontal, vertical, or diagonal line on a bingo board by playing maps on osu! osu.bingo
osu
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

database migration

+1334 -37
bun.lockb

This is a binary file and will not be displayed.

+4
src/lib/drizzle/index.ts
··· 1 1 import { env } from '$env/dynamic/private'; 2 2 import { createClient } from '@libsql/client'; 3 3 import { drizzle, type LibSQLDatabase } from 'drizzle-orm/libsql'; 4 + import { migrate } from 'drizzle-orm/libsql/migrator'; 4 5 5 6 export let db: LibSQLDatabase<Record<string, never>>; 6 7 7 8 if (env.TURSO_URL) { 8 9 const sqlite = createClient({ url: env.TURSO_URL, authToken: env.TURSO_TOKEN }); 9 10 db = drizzle(sqlite); 11 + migrate(db, { 12 + migrationsFolder: "src/lib/drizzle/migrations" 13 + }) 10 14 }
+47
src/lib/drizzle/migrations/0001_demonic_jack_flag.sql
··· 1 + ALTER TABLE `MapInPool` RENAME COLUMN `` TO `required_mods`;--> statement-breakpoint 2 + ALTER TABLE `Score` ADD `claim` integer DEFAULT 0 NOT NULL;--> statement-breakpoint 3 + ALTER TABLE `Template` ADD `description` text;--> statement-breakpoint 4 + 5 + -- Recreate BingoGame table 6 + PRAGMA foreign_keys=OFF; --> statement-breakpoint 7 + CREATE TABLE `new_BingoGame` ( 8 + `id` text PRIMARY KEY NOT NULL, 9 + `name` text, 10 + `winning_team` text, 11 + `link_id` text, 12 + `start_time` integer, 13 + `end_time` integer, 14 + `state` integer DEFAULT 0 NOT NULL, 15 + `public` integer DEFAULT true NOT NULL, 16 + `allow_team_switching` integer DEFAULT true, 17 + `options` text DEFAULT '{"min_sr":4,"max_sr":5,"min_length":0,"max_length":200}' NOT NULL, 18 + `template_id` text, 19 + FOREIGN KEY (`template_id`) REFERENCES `Template`(`id`) ON UPDATE no action ON DELETE no action 20 + ); --> statement-breakpoint 21 + 22 + -- Add old entries 23 + INSERT INTO `new_BingoGame` 24 + (`id`, `winning_team`, `link_id`, `start_time`, `state`, `public`, `allow_team_switching`, `template_id`) SELECT 25 + `id`, `winning_team`, `link_id`, `start_time`, `state`, `public`, `allow_team_switching`, `template_id` 26 + FROM "BingoGame"; --> statement-breakpoint 27 + 28 + -- Combine old properties into options json 29 + UPDATE `new_BingoGame` 30 + SET options = ( 31 + SELECT '{"setup": {"claim_condition": {"metric": "' || claim_condition || '"}, "reclaim_condition": "' || tiebreaker || '", "stars": {"min": ' || IFNULL(min_sr, 0.0) || ', "max": ' || IFNULL(max_sr, 10.0) || '}, "length": {"min": ' || IFNULL(min_length, 0) || ',"max": ' || IFNULL(max_length, 300) || '}}}' options 32 + FROM BingoGame 33 + WHERE new_BingoGame.id = BingoGame.id 34 + ); --> statement-breakpoint 35 + 36 + UPDATE `new_BingoGame` 37 + SET name = ( 38 + SELECT 'Game ' || link_id 39 + FROM BingoGame 40 + WHERE new_BingoGame.id = BingoGame.id 41 + ); --> statement-breakpoint 42 + 43 + -- Drop old table and rename new table 44 + DROP TABLE "BingoGame"; --> statement-breakpoint 45 + ALTER TABLE "new_BingoGame" RENAME TO "BingoGame"; --> statement-breakpoint 46 + PRAGMA foreign_key_check; --> statement-breakpoint 47 + PRAGMA foreign_keys=ON;
+1243
src/lib/drizzle/migrations/meta/0001_snapshot.json
··· 1 + { 2 + "version": "6", 3 + "dialect": "sqlite", 4 + "id": "5c8dca65-405b-435a-94d4-556958c2116c", 5 + "prevId": "d404bead-0ed7-44dc-aeeb-02b7bf230694", 6 + "tables": { 7 + "BingoGame": { 8 + "name": "BingoGame", 9 + "columns": { 10 + "id": { 11 + "name": "id", 12 + "type": "text", 13 + "primaryKey": true, 14 + "notNull": true, 15 + "autoincrement": false 16 + }, 17 + "name": { 18 + "name": "name", 19 + "type": "text", 20 + "primaryKey": false, 21 + "notNull": false, 22 + "autoincrement": false 23 + }, 24 + "winning_team": { 25 + "name": "winning_team", 26 + "type": "text", 27 + "primaryKey": false, 28 + "notNull": false, 29 + "autoincrement": false 30 + }, 31 + "link_id": { 32 + "name": "link_id", 33 + "type": "text", 34 + "primaryKey": false, 35 + "notNull": false, 36 + "autoincrement": false 37 + }, 38 + "start_time": { 39 + "name": "start_time", 40 + "type": "integer", 41 + "primaryKey": false, 42 + "notNull": false, 43 + "autoincrement": false 44 + }, 45 + "end_time": { 46 + "name": "end_time", 47 + "type": "integer", 48 + "primaryKey": false, 49 + "notNull": false, 50 + "autoincrement": false 51 + }, 52 + "state": { 53 + "name": "state", 54 + "type": "integer", 55 + "primaryKey": false, 56 + "notNull": true, 57 + "autoincrement": false, 58 + "default": 0 59 + }, 60 + "public": { 61 + "name": "public", 62 + "type": "integer", 63 + "primaryKey": false, 64 + "notNull": true, 65 + "autoincrement": false, 66 + "default": true 67 + }, 68 + "allow_team_switching": { 69 + "name": "allow_team_switching", 70 + "type": "integer", 71 + "primaryKey": false, 72 + "notNull": false, 73 + "autoincrement": false, 74 + "default": true 75 + }, 76 + "options": { 77 + "name": "options", 78 + "type": "text", 79 + "primaryKey": false, 80 + "notNull": true, 81 + "autoincrement": false, 82 + "default": "'{\"min_sr\":4,\"max_sr\":5,\"min_length\":0,\"max_length\":200}'" 83 + }, 84 + "template_id": { 85 + "name": "template_id", 86 + "type": "text", 87 + "primaryKey": false, 88 + "notNull": false, 89 + "autoincrement": false 90 + } 91 + }, 92 + "indexes": {}, 93 + "foreignKeys": { 94 + "BingoGame_template_id_Template_id_fk": { 95 + "name": "BingoGame_template_id_Template_id_fk", 96 + "tableFrom": "BingoGame", 97 + "tableTo": "Template", 98 + "columnsFrom": [ 99 + "template_id" 100 + ], 101 + "columnsTo": [ 102 + "id" 103 + ], 104 + "onDelete": "no action", 105 + "onUpdate": "no action" 106 + } 107 + }, 108 + "compositePrimaryKeys": {}, 109 + "uniqueConstraints": {} 110 + }, 111 + "BingoSquare": { 112 + "name": "BingoSquare", 113 + "columns": { 114 + "id": { 115 + "name": "id", 116 + "type": "text", 117 + "primaryKey": true, 118 + "notNull": true, 119 + "autoincrement": false 120 + }, 121 + "game_id": { 122 + "name": "game_id", 123 + "type": "text", 124 + "primaryKey": false, 125 + "notNull": true, 126 + "autoincrement": false 127 + }, 128 + "map_id": { 129 + "name": "map_id", 130 + "type": "integer", 131 + "primaryKey": false, 132 + "notNull": true, 133 + "autoincrement": false 134 + }, 135 + "mod_string": { 136 + "name": "mod_string", 137 + "type": "text", 138 + "primaryKey": false, 139 + "notNull": false, 140 + "autoincrement": false, 141 + "default": "''" 142 + }, 143 + "x_pos": { 144 + "name": "x_pos", 145 + "type": "integer", 146 + "primaryKey": false, 147 + "notNull": true, 148 + "autoincrement": false 149 + }, 150 + "y_pos": { 151 + "name": "y_pos", 152 + "type": "integer", 153 + "primaryKey": false, 154 + "notNull": true, 155 + "autoincrement": false 156 + }, 157 + "claimed_by_id": { 158 + "name": "claimed_by_id", 159 + "type": "text", 160 + "primaryKey": false, 161 + "notNull": false, 162 + "autoincrement": false 163 + } 164 + }, 165 + "indexes": {}, 166 + "foreignKeys": { 167 + "BingoSquare_game_id_BingoGame_id_fk": { 168 + "name": "BingoSquare_game_id_BingoGame_id_fk", 169 + "tableFrom": "BingoSquare", 170 + "tableTo": "BingoGame", 171 + "columnsFrom": [ 172 + "game_id" 173 + ], 174 + "columnsTo": [ 175 + "id" 176 + ], 177 + "onDelete": "cascade", 178 + "onUpdate": "cascade" 179 + }, 180 + "BingoSquare_map_id_Map_id_fk": { 181 + "name": "BingoSquare_map_id_Map_id_fk", 182 + "tableFrom": "BingoSquare", 183 + "tableTo": "Map", 184 + "columnsFrom": [ 185 + "map_id" 186 + ], 187 + "columnsTo": [ 188 + "id" 189 + ], 190 + "onDelete": "restrict", 191 + "onUpdate": "cascade" 192 + }, 193 + "BingoSquare_claimed_by_id_GameUser_id_fk": { 194 + "name": "BingoSquare_claimed_by_id_GameUser_id_fk", 195 + "tableFrom": "BingoSquare", 196 + "tableTo": "GameUser", 197 + "columnsFrom": [ 198 + "claimed_by_id" 199 + ], 200 + "columnsTo": [ 201 + "id" 202 + ], 203 + "onDelete": "no action", 204 + "onUpdate": "no action" 205 + } 206 + }, 207 + "compositePrimaryKeys": {}, 208 + "uniqueConstraints": {} 209 + }, 210 + "Chat": { 211 + "name": "Chat", 212 + "columns": { 213 + "id": { 214 + "name": "id", 215 + "type": "text", 216 + "primaryKey": true, 217 + "notNull": true, 218 + "autoincrement": false 219 + }, 220 + "time": { 221 + "name": "time", 222 + "type": "integer", 223 + "primaryKey": false, 224 + "notNull": true, 225 + "autoincrement": false 226 + }, 227 + "text": { 228 + "name": "text", 229 + "type": "text", 230 + "primaryKey": false, 231 + "notNull": false, 232 + "autoincrement": false 233 + }, 234 + "channel": { 235 + "name": "channel", 236 + "type": "text", 237 + "primaryKey": false, 238 + "notNull": true, 239 + "autoincrement": false, 240 + "default": "'GLOBAL'" 241 + }, 242 + "game_id": { 243 + "name": "game_id", 244 + "type": "text", 245 + "primaryKey": false, 246 + "notNull": true, 247 + "autoincrement": false 248 + }, 249 + "user_id": { 250 + "name": "user_id", 251 + "type": "integer", 252 + "primaryKey": false, 253 + "notNull": true, 254 + "autoincrement": false 255 + } 256 + }, 257 + "indexes": {}, 258 + "foreignKeys": { 259 + "Chat_game_id_BingoGame_id_fk": { 260 + "name": "Chat_game_id_BingoGame_id_fk", 261 + "tableFrom": "Chat", 262 + "tableTo": "BingoGame", 263 + "columnsFrom": [ 264 + "game_id" 265 + ], 266 + "columnsTo": [ 267 + "id" 268 + ], 269 + "onDelete": "cascade", 270 + "onUpdate": "cascade" 271 + }, 272 + "Chat_user_id_User_id_fk": { 273 + "name": "Chat_user_id_User_id_fk", 274 + "tableFrom": "Chat", 275 + "tableTo": "User", 276 + "columnsFrom": [ 277 + "user_id" 278 + ], 279 + "columnsTo": [ 280 + "id" 281 + ], 282 + "onDelete": "no action", 283 + "onUpdate": "no action" 284 + } 285 + }, 286 + "compositePrimaryKeys": {}, 287 + "uniqueConstraints": {} 288 + }, 289 + "GameUser": { 290 + "name": "GameUser", 291 + "columns": { 292 + "id": { 293 + "name": "id", 294 + "type": "text", 295 + "primaryKey": true, 296 + "notNull": true, 297 + "autoincrement": false 298 + }, 299 + "game_id": { 300 + "name": "game_id", 301 + "type": "text", 302 + "primaryKey": false, 303 + "notNull": true, 304 + "autoincrement": false 305 + }, 306 + "user_id": { 307 + "name": "user_id", 308 + "type": "integer", 309 + "primaryKey": false, 310 + "notNull": true, 311 + "autoincrement": false 312 + }, 313 + "team_name": { 314 + "name": "team_name", 315 + "type": "text", 316 + "primaryKey": false, 317 + "notNull": true, 318 + "autoincrement": false 319 + }, 320 + "host": { 321 + "name": "host", 322 + "type": "integer", 323 + "primaryKey": false, 324 + "notNull": true, 325 + "autoincrement": false, 326 + "default": false 327 + } 328 + }, 329 + "indexes": {}, 330 + "foreignKeys": { 331 + "GameUser_game_id_BingoGame_id_fk": { 332 + "name": "GameUser_game_id_BingoGame_id_fk", 333 + "tableFrom": "GameUser", 334 + "tableTo": "BingoGame", 335 + "columnsFrom": [ 336 + "game_id" 337 + ], 338 + "columnsTo": [ 339 + "id" 340 + ], 341 + "onDelete": "cascade", 342 + "onUpdate": "cascade" 343 + }, 344 + "GameUser_user_id_User_id_fk": { 345 + "name": "GameUser_user_id_User_id_fk", 346 + "tableFrom": "GameUser", 347 + "tableTo": "User", 348 + "columnsFrom": [ 349 + "user_id" 350 + ], 351 + "columnsTo": [ 352 + "id" 353 + ], 354 + "onDelete": "cascade", 355 + "onUpdate": "cascade" 356 + } 357 + }, 358 + "compositePrimaryKeys": {}, 359 + "uniqueConstraints": {} 360 + }, 361 + "Map": { 362 + "name": "Map", 363 + "columns": { 364 + "id": { 365 + "name": "id", 366 + "type": "integer", 367 + "primaryKey": true, 368 + "notNull": true, 369 + "autoincrement": false 370 + }, 371 + "beatmapset_id": { 372 + "name": "beatmapset_id", 373 + "type": "integer", 374 + "primaryKey": false, 375 + "notNull": true, 376 + "autoincrement": false 377 + }, 378 + "fetch_time": { 379 + "name": "fetch_time", 380 + "type": "integer", 381 + "primaryKey": false, 382 + "notNull": true, 383 + "autoincrement": false 384 + }, 385 + "gamemode": { 386 + "name": "gamemode", 387 + "type": "text", 388 + "primaryKey": false, 389 + "notNull": true, 390 + "autoincrement": false, 391 + "default": "'osu'" 392 + }, 393 + "title": { 394 + "name": "title", 395 + "type": "text", 396 + "primaryKey": false, 397 + "notNull": true, 398 + "autoincrement": false 399 + }, 400 + "artist": { 401 + "name": "artist", 402 + "type": "text", 403 + "primaryKey": false, 404 + "notNull": true, 405 + "autoincrement": false 406 + }, 407 + "difficulty_name": { 408 + "name": "difficulty_name", 409 + "type": "text", 410 + "primaryKey": false, 411 + "notNull": true, 412 + "autoincrement": false 413 + }, 414 + "url": { 415 + "name": "url", 416 + "type": "text", 417 + "primaryKey": false, 418 + "notNull": true, 419 + "autoincrement": false 420 + }, 421 + "square_url": { 422 + "name": "square_url", 423 + "type": "text", 424 + "primaryKey": false, 425 + "notNull": true, 426 + "autoincrement": false 427 + }, 428 + "banner_url": { 429 + "name": "banner_url", 430 + "type": "text", 431 + "primaryKey": false, 432 + "notNull": true, 433 + "autoincrement": false 434 + }, 435 + "status": { 436 + "name": "status", 437 + "type": "text", 438 + "primaryKey": false, 439 + "notNull": true, 440 + "autoincrement": false 441 + }, 442 + "max_combo": { 443 + "name": "max_combo", 444 + "type": "integer", 445 + "primaryKey": false, 446 + "notNull": true, 447 + "autoincrement": false 448 + }, 449 + "last_updated": { 450 + "name": "last_updated", 451 + "type": "integer", 452 + "primaryKey": false, 453 + "notNull": true, 454 + "autoincrement": false 455 + }, 456 + "available": { 457 + "name": "available", 458 + "type": "integer", 459 + "primaryKey": false, 460 + "notNull": true, 461 + "autoincrement": false 462 + } 463 + }, 464 + "indexes": {}, 465 + "foreignKeys": {}, 466 + "compositePrimaryKeys": {}, 467 + "uniqueConstraints": {} 468 + }, 469 + "MapInPool": { 470 + "name": "MapInPool", 471 + "columns": { 472 + "id": { 473 + "name": "id", 474 + "type": "text", 475 + "primaryKey": true, 476 + "notNull": true, 477 + "autoincrement": false 478 + }, 479 + "pool_id": { 480 + "name": "pool_id", 481 + "type": "text", 482 + "primaryKey": false, 483 + "notNull": false, 484 + "autoincrement": false 485 + }, 486 + "map_id": { 487 + "name": "map_id", 488 + "type": "integer", 489 + "primaryKey": false, 490 + "notNull": false, 491 + "autoincrement": false 492 + }, 493 + "required_mods": { 494 + "name": "required_mods", 495 + "type": "text", 496 + "primaryKey": false, 497 + "notNull": false, 498 + "autoincrement": false 499 + } 500 + }, 501 + "indexes": {}, 502 + "foreignKeys": { 503 + "MapInPool_pool_id_Mappool_id_fk": { 504 + "name": "MapInPool_pool_id_Mappool_id_fk", 505 + "tableFrom": "MapInPool", 506 + "tableTo": "Mappool", 507 + "columnsFrom": [ 508 + "pool_id" 509 + ], 510 + "columnsTo": [ 511 + "id" 512 + ], 513 + "onDelete": "no action", 514 + "onUpdate": "no action" 515 + }, 516 + "MapInPool_map_id_Map_id_fk": { 517 + "name": "MapInPool_map_id_Map_id_fk", 518 + "tableFrom": "MapInPool", 519 + "tableTo": "Map", 520 + "columnsFrom": [ 521 + "map_id" 522 + ], 523 + "columnsTo": [ 524 + "id" 525 + ], 526 + "onDelete": "no action", 527 + "onUpdate": "no action" 528 + } 529 + }, 530 + "compositePrimaryKeys": {}, 531 + "uniqueConstraints": {} 532 + }, 533 + "MapStats": { 534 + "name": "MapStats", 535 + "columns": { 536 + "map_id": { 537 + "name": "map_id", 538 + "type": "integer", 539 + "primaryKey": false, 540 + "notNull": true, 541 + "autoincrement": false 542 + }, 543 + "mod_string": { 544 + "name": "mod_string", 545 + "type": "text", 546 + "primaryKey": false, 547 + "notNull": true, 548 + "autoincrement": false, 549 + "default": "''" 550 + }, 551 + "star_rating": { 552 + "name": "star_rating", 553 + "type": "real", 554 + "primaryKey": false, 555 + "notNull": true, 556 + "autoincrement": false 557 + }, 558 + "bpm": { 559 + "name": "bpm", 560 + "type": "real", 561 + "primaryKey": false, 562 + "notNull": true, 563 + "autoincrement": false 564 + }, 565 + "length": { 566 + "name": "length", 567 + "type": "integer", 568 + "primaryKey": false, 569 + "notNull": true, 570 + "autoincrement": false 571 + }, 572 + "cs": { 573 + "name": "cs", 574 + "type": "real", 575 + "primaryKey": false, 576 + "notNull": true, 577 + "autoincrement": false 578 + }, 579 + "ar": { 580 + "name": "ar", 581 + "type": "real", 582 + "primaryKey": false, 583 + "notNull": true, 584 + "autoincrement": false 585 + }, 586 + "od": { 587 + "name": "od", 588 + "type": "real", 589 + "primaryKey": false, 590 + "notNull": true, 591 + "autoincrement": false 592 + }, 593 + "hp": { 594 + "name": "hp", 595 + "type": "real", 596 + "primaryKey": false, 597 + "notNull": true, 598 + "autoincrement": false 599 + } 600 + }, 601 + "indexes": { 602 + "MapStats_map_id_mod_string_unique": { 603 + "name": "MapStats_map_id_mod_string_unique", 604 + "columns": [ 605 + "map_id", 606 + "mod_string" 607 + ], 608 + "isUnique": true 609 + } 610 + }, 611 + "foreignKeys": { 612 + "MapStats_map_id_Map_id_fk": { 613 + "name": "MapStats_map_id_Map_id_fk", 614 + "tableFrom": "MapStats", 615 + "tableTo": "Map", 616 + "columnsFrom": [ 617 + "map_id" 618 + ], 619 + "columnsTo": [ 620 + "id" 621 + ], 622 + "onDelete": "cascade", 623 + "onUpdate": "cascade" 624 + } 625 + }, 626 + "compositePrimaryKeys": { 627 + "MapStats_map_id_mod_string_pk": { 628 + "columns": [ 629 + "map_id", 630 + "mod_string" 631 + ], 632 + "name": "MapStats_map_id_mod_string_pk" 633 + } 634 + }, 635 + "uniqueConstraints": {} 636 + }, 637 + "Mappool": { 638 + "name": "Mappool", 639 + "columns": { 640 + "id": { 641 + "name": "id", 642 + "type": "text", 643 + "primaryKey": true, 644 + "notNull": true, 645 + "autoincrement": false 646 + }, 647 + "name": { 648 + "name": "name", 649 + "type": "text", 650 + "primaryKey": false, 651 + "notNull": false, 652 + "autoincrement": false 653 + } 654 + }, 655 + "indexes": {}, 656 + "foreignKeys": {}, 657 + "compositePrimaryKeys": {}, 658 + "uniqueConstraints": {} 659 + }, 660 + "OauthToken": { 661 + "name": "OauthToken", 662 + "columns": { 663 + "id": { 664 + "name": "id", 665 + "type": "text", 666 + "primaryKey": true, 667 + "notNull": true, 668 + "autoincrement": false 669 + }, 670 + "service": { 671 + "name": "service", 672 + "type": "text", 673 + "primaryKey": false, 674 + "notNull": true, 675 + "autoincrement": false 676 + }, 677 + "access_token": { 678 + "name": "access_token", 679 + "type": "text", 680 + "primaryKey": false, 681 + "notNull": true, 682 + "autoincrement": false 683 + }, 684 + "expires_at": { 685 + "name": "expires_at", 686 + "type": "integer", 687 + "primaryKey": false, 688 + "notNull": true, 689 + "autoincrement": false 690 + }, 691 + "refresh_token": { 692 + "name": "refresh_token", 693 + "type": "text", 694 + "primaryKey": false, 695 + "notNull": true, 696 + "autoincrement": false 697 + }, 698 + "token_type": { 699 + "name": "token_type", 700 + "type": "text", 701 + "primaryKey": false, 702 + "notNull": true, 703 + "autoincrement": false 704 + }, 705 + "user_id": { 706 + "name": "user_id", 707 + "type": "integer", 708 + "primaryKey": false, 709 + "notNull": false, 710 + "autoincrement": false 711 + } 712 + }, 713 + "indexes": { 714 + "OauthToken_access_token_unique": { 715 + "name": "OauthToken_access_token_unique", 716 + "columns": [ 717 + "access_token" 718 + ], 719 + "isUnique": true 720 + }, 721 + "OauthToken_refresh_token_unique": { 722 + "name": "OauthToken_refresh_token_unique", 723 + "columns": [ 724 + "refresh_token" 725 + ], 726 + "isUnique": true 727 + } 728 + }, 729 + "foreignKeys": { 730 + "OauthToken_user_id_User_id_fk": { 731 + "name": "OauthToken_user_id_User_id_fk", 732 + "tableFrom": "OauthToken", 733 + "tableTo": "User", 734 + "columnsFrom": [ 735 + "user_id" 736 + ], 737 + "columnsTo": [ 738 + "id" 739 + ], 740 + "onDelete": "cascade", 741 + "onUpdate": "cascade" 742 + } 743 + }, 744 + "compositePrimaryKeys": {}, 745 + "uniqueConstraints": {} 746 + }, 747 + "Score": { 748 + "name": "Score", 749 + "columns": { 750 + "id": { 751 + "name": "id", 752 + "type": "text", 753 + "primaryKey": true, 754 + "notNull": true, 755 + "autoincrement": false 756 + }, 757 + "score_id": { 758 + "name": "score_id", 759 + "type": "integer", 760 + "primaryKey": false, 761 + "notNull": false, 762 + "autoincrement": false 763 + }, 764 + "user_id": { 765 + "name": "user_id", 766 + "type": "integer", 767 + "primaryKey": false, 768 + "notNull": true, 769 + "autoincrement": false 770 + }, 771 + "date": { 772 + "name": "date", 773 + "type": "integer", 774 + "primaryKey": false, 775 + "notNull": true, 776 + "autoincrement": false 777 + }, 778 + "percentage": { 779 + "name": "percentage", 780 + "type": "real", 781 + "primaryKey": false, 782 + "notNull": false, 783 + "autoincrement": false 784 + }, 785 + "is_fc": { 786 + "name": "is_fc", 787 + "type": "integer", 788 + "primaryKey": false, 789 + "notNull": true, 790 + "autoincrement": false, 791 + "default": false 792 + }, 793 + "score": { 794 + "name": "score", 795 + "type": "real", 796 + "primaryKey": false, 797 + "notNull": true, 798 + "autoincrement": false 799 + }, 800 + "pp": { 801 + "name": "pp", 802 + "type": "real", 803 + "primaryKey": false, 804 + "notNull": false, 805 + "autoincrement": false 806 + }, 807 + "grade": { 808 + "name": "grade", 809 + "type": "text", 810 + "primaryKey": false, 811 + "notNull": true, 812 + "autoincrement": false 813 + }, 814 + "accuracy": { 815 + "name": "accuracy", 816 + "type": "real", 817 + "primaryKey": false, 818 + "notNull": true, 819 + "autoincrement": false 820 + }, 821 + "max_combo": { 822 + "name": "max_combo", 823 + "type": "integer", 824 + "primaryKey": false, 825 + "notNull": true, 826 + "autoincrement": false 827 + }, 828 + "mods": { 829 + "name": "mods", 830 + "type": "text", 831 + "primaryKey": false, 832 + "notNull": false, 833 + "autoincrement": false, 834 + "default": "''" 835 + }, 836 + "lazer": { 837 + "name": "lazer", 838 + "type": "integer", 839 + "primaryKey": false, 840 + "notNull": true, 841 + "autoincrement": false 842 + }, 843 + "important": { 844 + "name": "important", 845 + "type": "integer", 846 + "primaryKey": false, 847 + "notNull": false, 848 + "autoincrement": false, 849 + "default": false 850 + }, 851 + "claim": { 852 + "name": "claim", 853 + "type": "integer", 854 + "primaryKey": false, 855 + "notNull": true, 856 + "autoincrement": false, 857 + "default": 0 858 + }, 859 + "square_id": { 860 + "name": "square_id", 861 + "type": "text", 862 + "primaryKey": false, 863 + "notNull": true, 864 + "autoincrement": false 865 + }, 866 + "game_user_id": { 867 + "name": "game_user_id", 868 + "type": "text", 869 + "primaryKey": false, 870 + "notNull": true, 871 + "autoincrement": false 872 + } 873 + }, 874 + "indexes": {}, 875 + "foreignKeys": { 876 + "Score_square_id_BingoSquare_id_fk": { 877 + "name": "Score_square_id_BingoSquare_id_fk", 878 + "tableFrom": "Score", 879 + "tableTo": "BingoSquare", 880 + "columnsFrom": [ 881 + "square_id" 882 + ], 883 + "columnsTo": [ 884 + "id" 885 + ], 886 + "onDelete": "cascade", 887 + "onUpdate": "cascade" 888 + }, 889 + "Score_game_user_id_GameUser_id_fk": { 890 + "name": "Score_game_user_id_GameUser_id_fk", 891 + "tableFrom": "Score", 892 + "tableTo": "GameUser", 893 + "columnsFrom": [ 894 + "game_user_id" 895 + ], 896 + "columnsTo": [ 897 + "id" 898 + ], 899 + "onDelete": "no action", 900 + "onUpdate": "no action" 901 + } 902 + }, 903 + "compositePrimaryKeys": {}, 904 + "uniqueConstraints": {} 905 + }, 906 + "Session": { 907 + "name": "Session", 908 + "columns": { 909 + "id": { 910 + "name": "id", 911 + "type": "text", 912 + "primaryKey": true, 913 + "notNull": true, 914 + "autoincrement": false 915 + }, 916 + "user_id": { 917 + "name": "user_id", 918 + "type": "integer", 919 + "primaryKey": false, 920 + "notNull": true, 921 + "autoincrement": false 922 + }, 923 + "token": { 924 + "name": "token", 925 + "type": "text", 926 + "primaryKey": false, 927 + "notNull": true, 928 + "autoincrement": false 929 + }, 930 + "created_at": { 931 + "name": "created_at", 932 + "type": "integer", 933 + "primaryKey": false, 934 + "notNull": false, 935 + "autoincrement": false 936 + }, 937 + "last_used": { 938 + "name": "last_used", 939 + "type": "integer", 940 + "primaryKey": false, 941 + "notNull": false, 942 + "autoincrement": false 943 + }, 944 + "device": { 945 + "name": "device", 946 + "type": "text", 947 + "primaryKey": false, 948 + "notNull": false, 949 + "autoincrement": false 950 + }, 951 + "browser": { 952 + "name": "browser", 953 + "type": "text", 954 + "primaryKey": false, 955 + "notNull": false, 956 + "autoincrement": false 957 + }, 958 + "os": { 959 + "name": "os", 960 + "type": "text", 961 + "primaryKey": false, 962 + "notNull": false, 963 + "autoincrement": false 964 + } 965 + }, 966 + "indexes": { 967 + "Session_token_unique": { 968 + "name": "Session_token_unique", 969 + "columns": [ 970 + "token" 971 + ], 972 + "isUnique": true 973 + } 974 + }, 975 + "foreignKeys": { 976 + "Session_user_id_User_id_fk": { 977 + "name": "Session_user_id_User_id_fk", 978 + "tableFrom": "Session", 979 + "tableTo": "User", 980 + "columnsFrom": [ 981 + "user_id" 982 + ], 983 + "columnsTo": [ 984 + "id" 985 + ], 986 + "onDelete": "cascade", 987 + "onUpdate": "cascade" 988 + } 989 + }, 990 + "compositePrimaryKeys": {}, 991 + "uniqueConstraints": {} 992 + }, 993 + "Template": { 994 + "name": "Template", 995 + "columns": { 996 + "id": { 997 + "name": "id", 998 + "type": "text", 999 + "primaryKey": true, 1000 + "notNull": true, 1001 + "autoincrement": false 1002 + }, 1003 + "user_id": { 1004 + "name": "user_id", 1005 + "type": "integer", 1006 + "primaryKey": false, 1007 + "notNull": true, 1008 + "autoincrement": false 1009 + }, 1010 + "name": { 1011 + "name": "name", 1012 + "type": "text", 1013 + "primaryKey": false, 1014 + "notNull": false, 1015 + "autoincrement": false 1016 + }, 1017 + "description": { 1018 + "name": "description", 1019 + "type": "text", 1020 + "primaryKey": false, 1021 + "notNull": false, 1022 + "autoincrement": false 1023 + }, 1024 + "data": { 1025 + "name": "data", 1026 + "type": "text", 1027 + "primaryKey": false, 1028 + "notNull": true, 1029 + "autoincrement": false 1030 + } 1031 + }, 1032 + "indexes": {}, 1033 + "foreignKeys": { 1034 + "Template_user_id_User_id_fk": { 1035 + "name": "Template_user_id_User_id_fk", 1036 + "tableFrom": "Template", 1037 + "tableTo": "User", 1038 + "columnsFrom": [ 1039 + "user_id" 1040 + ], 1041 + "columnsTo": [ 1042 + "id" 1043 + ], 1044 + "onDelete": "no action", 1045 + "onUpdate": "no action" 1046 + } 1047 + }, 1048 + "compositePrimaryKeys": {}, 1049 + "uniqueConstraints": {} 1050 + }, 1051 + "TimeEvent": { 1052 + "name": "TimeEvent", 1053 + "columns": { 1054 + "id": { 1055 + "name": "id", 1056 + "type": "text", 1057 + "primaryKey": true, 1058 + "notNull": true, 1059 + "autoincrement": false 1060 + }, 1061 + "time": { 1062 + "name": "time", 1063 + "type": "integer", 1064 + "primaryKey": false, 1065 + "notNull": true, 1066 + "autoincrement": false 1067 + }, 1068 + "action": { 1069 + "name": "action", 1070 + "type": "text", 1071 + "primaryKey": false, 1072 + "notNull": true, 1073 + "autoincrement": false 1074 + }, 1075 + "fulfilled": { 1076 + "name": "fulfilled", 1077 + "type": "integer", 1078 + "primaryKey": false, 1079 + "notNull": false, 1080 + "autoincrement": false, 1081 + "default": false 1082 + }, 1083 + "game_id": { 1084 + "name": "game_id", 1085 + "type": "text", 1086 + "primaryKey": false, 1087 + "notNull": true, 1088 + "autoincrement": false 1089 + } 1090 + }, 1091 + "indexes": {}, 1092 + "foreignKeys": { 1093 + "TimeEvent_game_id_BingoGame_id_fk": { 1094 + "name": "TimeEvent_game_id_BingoGame_id_fk", 1095 + "tableFrom": "TimeEvent", 1096 + "tableTo": "BingoGame", 1097 + "columnsFrom": [ 1098 + "game_id" 1099 + ], 1100 + "columnsTo": [ 1101 + "id" 1102 + ], 1103 + "onDelete": "cascade", 1104 + "onUpdate": "cascade" 1105 + } 1106 + }, 1107 + "compositePrimaryKeys": {}, 1108 + "uniqueConstraints": {} 1109 + }, 1110 + "User": { 1111 + "name": "User", 1112 + "columns": { 1113 + "id": { 1114 + "name": "id", 1115 + "type": "integer", 1116 + "primaryKey": true, 1117 + "notNull": true, 1118 + "autoincrement": false 1119 + }, 1120 + "username": { 1121 + "name": "username", 1122 + "type": "text", 1123 + "primaryKey": false, 1124 + "notNull": true, 1125 + "autoincrement": false 1126 + }, 1127 + "country_code": { 1128 + "name": "country_code", 1129 + "type": "text", 1130 + "primaryKey": false, 1131 + "notNull": true, 1132 + "autoincrement": false 1133 + }, 1134 + "country_name": { 1135 + "name": "country_name", 1136 + "type": "text", 1137 + "primaryKey": false, 1138 + "notNull": true, 1139 + "autoincrement": false 1140 + }, 1141 + "cover_url": { 1142 + "name": "cover_url", 1143 + "type": "text", 1144 + "primaryKey": false, 1145 + "notNull": true, 1146 + "autoincrement": false 1147 + }, 1148 + "avatar_url": { 1149 + "name": "avatar_url", 1150 + "type": "text", 1151 + "primaryKey": false, 1152 + "notNull": true, 1153 + "autoincrement": false 1154 + }, 1155 + "pp": { 1156 + "name": "pp", 1157 + "type": "real", 1158 + "primaryKey": false, 1159 + "notNull": false, 1160 + "autoincrement": false 1161 + }, 1162 + "global_rank": { 1163 + "name": "global_rank", 1164 + "type": "integer", 1165 + "primaryKey": false, 1166 + "notNull": false, 1167 + "autoincrement": false 1168 + }, 1169 + "country_rank": { 1170 + "name": "country_rank", 1171 + "type": "integer", 1172 + "primaryKey": false, 1173 + "notNull": false, 1174 + "autoincrement": false 1175 + }, 1176 + "total_score": { 1177 + "name": "total_score", 1178 + "type": "integer", 1179 + "primaryKey": false, 1180 + "notNull": false, 1181 + "autoincrement": false 1182 + }, 1183 + "ranked_score": { 1184 + "name": "ranked_score", 1185 + "type": "integer", 1186 + "primaryKey": false, 1187 + "notNull": false, 1188 + "autoincrement": false 1189 + }, 1190 + "hit_accuracy": { 1191 + "name": "hit_accuracy", 1192 + "type": "real", 1193 + "primaryKey": false, 1194 + "notNull": false, 1195 + "autoincrement": false 1196 + }, 1197 + "play_count": { 1198 + "name": "play_count", 1199 + "type": "integer", 1200 + "primaryKey": false, 1201 + "notNull": false, 1202 + "autoincrement": false 1203 + }, 1204 + "level": { 1205 + "name": "level", 1206 + "type": "integer", 1207 + "primaryKey": false, 1208 + "notNull": false, 1209 + "autoincrement": false 1210 + }, 1211 + "level_progress": { 1212 + "name": "level_progress", 1213 + "type": "integer", 1214 + "primaryKey": false, 1215 + "notNull": false, 1216 + "autoincrement": false 1217 + }, 1218 + "last_refreshed": { 1219 + "name": "last_refreshed", 1220 + "type": "integer", 1221 + "primaryKey": false, 1222 + "notNull": false, 1223 + "autoincrement": false 1224 + } 1225 + }, 1226 + "indexes": {}, 1227 + "foreignKeys": {}, 1228 + "compositePrimaryKeys": {}, 1229 + "uniqueConstraints": {} 1230 + } 1231 + }, 1232 + "enums": {}, 1233 + "_meta": { 1234 + "schemas": {}, 1235 + "tables": {}, 1236 + "columns": { 1237 + "\"MapInPool\".\"\"": "\"MapInPool\".\"required_mods\"" 1238 + } 1239 + }, 1240 + "internal": { 1241 + "indexes": {} 1242 + } 1243 + }
+19 -12
src/lib/drizzle/migrations/meta/_journal.json
··· 1 1 { 2 - "version": "7", 3 - "dialect": "sqlite", 4 - "entries": [ 5 - { 6 - "idx": 0, 7 - "version": "6", 8 - "when": 1721505117564, 9 - "tag": "0000_superb_rictor", 10 - "breakpoints": true 11 - } 12 - ] 13 - } 2 + "version": "7", 3 + "dialect": "sqlite", 4 + "entries": [ 5 + { 6 + "idx": 0, 7 + "version": "6", 8 + "when": 1721505117564, 9 + "tag": "0000_superb_rictor", 10 + "breakpoints": true 11 + }, 12 + { 13 + "idx": 1, 14 + "version": "6", 15 + "when": 1743883971219, 16 + "tag": "0001_demonic_jack_flag", 17 + "breakpoints": true 18 + } 19 + ] 20 + }
+21 -25
src/lib/drizzle/schema.ts
··· 19 19 id: text('id') 20 20 .primaryKey() 21 21 .$defaultFn(() => `gam_${randomUUID()}`), 22 - link_id: text('link_id'), // Four letters, similar to Jackbox 23 22 24 - // Don't bother processing scores before this date: 23 + name: text('name'), 24 + winning_team: text('winning_team'), 25 + 26 + // Four letters, similar to a Jackbox invite code 27 + link_id: text('link_id'), 28 + 29 + // The time the lobby started (or will start), so the game doesn't process scores set before this. 25 30 start_time: integer('start_time', { mode: 'timestamp' }), 31 + end_time: integer('end_time', { mode: 'timestamp' }), 26 32 27 33 // Settings 28 - // 0: Before starting, 1: In game, 2: Finished 34 + // 0: Before starting, 1: In game, 2: Finished, 3: Final Showdown 29 35 state: integer('state').default(0).notNull(), 30 - winning_team: text('winning_team'), 31 36 32 - // Square Filling Settings 33 - min_sr: real('min_sr'), 34 - max_sr: real('max_sr'), 35 - min_length: real('min_length'), 36 - max_length: real('max_length'), 37 - 38 - // Restrict users that can join 39 - min_rank: integer('min_rank'), 40 - max_rank: integer('max_rank'), 37 + public: integer('public', { mode: 'boolean' }).notNull().default(true), 41 38 42 - // Only takes effect when game state is 0. 39 + // Whether or not players are allowed to pick their own team at the start of the game 43 40 allow_team_switching: integer('allow_team_switching', { mode: 'boolean' }).default(true), 44 41 45 - // What dictates whether a square is claimed. See more: `lib/server/claimworthy.ts` 46 - claim_condition: text('claim_condition').notNull().default('fc'), 47 - // How to sort scores for reclaims See more: `lib/server/get_best_score.ts` 48 - tiebreaker: text('tiebreaker').notNull().default('score'), 49 - 50 - // Whether this game shows up in public listing 51 - public: integer('public', { mode: 'boolean' }).notNull().default(true), 42 + // All other settings are stored in this json object (See the docs: https://notes.clxxiii.dev/1b23f4b9c82c800499bbd95c9fccbbab) 43 + options: text('options').notNull().default(JSON.stringify({ min_sr: 4.0, max_sr: 5.0, min_length: 0, max_length: 200 })), 52 44 53 45 template_id: text('template_id').references(() => Template.id) 54 46 }); ··· 199 191 pool_id: text('pool_id').references(() => Mappool.id), 200 192 map_id: integer('map_id').references(() => Map.id), 201 193 202 - required_mods: text('') // For tournament mappools and such 194 + required_mods: text('required_mods') // For tournament mappools and such 203 195 }); 204 196 205 197 /** ··· 285 277 mods: text('mods').default(''), 286 278 lazer: integer('lazer', { mode: 'boolean' }).notNull(), 287 279 288 - important: integer('important', { 289 - mode: 'boolean' 290 - }).default(false), // Whether this score appears as a notification 280 + // Whether this score is sufficient to claim a square 281 + claimworthy: integer('important', { mode: 'boolean' }).default(false), 282 + 283 + // Whether this score had an effect on the state on the board 284 + // 0: No Change, 1: Claim, 2: Reclaim, 3: Win 285 + claim: integer('claim').notNull().default(0), 291 286 292 287 square_id: text('square_id') 293 288 .notNull() ··· 331 326 .notNull() 332 327 .references(() => User.id), 333 328 name: text('name'), 329 + description: text('description'), 334 330 335 331 data: text('data').notNull() 336 332 });