1
0
Fork 0

feat(minigames): add creator bank and exposure toggle schema with migrations

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Jason Fraley 2026-09-08 15:57:01 -04:00
parent 987e78babd
commit 243bb8ae0d
7 changed files with 48995 additions and 2 deletions

View file

@ -69,6 +69,15 @@ export const CustomMinefields: CollectionConfig = {
type: "checkbox",
defaultValue: true,
},
{
name: "exposeEdgeMines",
type: "checkbox",
defaultValue: true,
admin: {
description:
"On a failed run, reveal mines bordering the swept area. When off, no remaining mines are revealed.",
},
},
{
name: "playCount",
type: "number",
@ -77,6 +86,22 @@ export const CustomMinefields: CollectionConfig = {
readOnly: true,
},
},
{
name: "creatorXpBank",
type: "number",
defaultValue: 0,
// Engine-managed payout ledger: only server actions may write it. Field
// access blocks REST/admin edits (overrideAccess in the actions bypasses
// this), so authors cannot credit their own bank.
access: {
update: () => false,
},
admin: {
readOnly: true,
description:
"Engine-managed: fractional XP bank for the author (5% of each player payout).",
},
},
],
timestamps: true,
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "custom_minefields" ADD COLUMN IF NOT EXISTS "creator_xp_bank" numeric DEFAULT 0;`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "custom_minefields" DROP COLUMN IF EXISTS "creator_xp_bank";`)
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "custom_minefields" ADD COLUMN IF NOT EXISTS "expose_edge_mines" boolean DEFAULT true;`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "custom_minefields" DROP COLUMN IF EXISTS "expose_edge_mines";`)
}

View file

@ -46,6 +46,8 @@ import * as migration_20260907_120754_add_story_beats from './20260907_120754_ad
import * as migration_20260907_124024_convert_story_beats_body_to_lexical from './20260907_124024_convert_story_beats_body_to_lexical';
import * as migration_20260908_152021_add_opord_recall_minigame_stats from './20260908_152021_add_opord_recall_minigame_stats';
import * as migration_20260908_172241_add_custom_minigame_collections from './20260908_172241_add_custom_minigame_collections';
import * as migration_20260908_193107_add_creator_xp_bank_field from './20260908_193107_add_creator_xp_bank_field';
import * as migration_20260908_194435_add_expose_edge_mines_field from './20260908_194435_add_expose_edge_mines_field';
export const migrations = [
{
@ -281,11 +283,21 @@ export const migrations = [
{
up: migration_20260908_152021_add_opord_recall_minigame_stats.up,
down: migration_20260908_152021_add_opord_recall_minigame_stats.down,
name: '20260908_152021_add_opord_recall_minigame_stats'
name: '20260908_152021_add_opord_recall_minigame_stats',
},
{
up: migration_20260908_172241_add_custom_minigame_collections.up,
down: migration_20260908_172241_add_custom_minigame_collections.down,
name: '20260908_172241_add_custom_minigame_collections'
name: '20260908_172241_add_custom_minigame_collections',
},
{
up: migration_20260908_193107_add_creator_xp_bank_field.up,
down: migration_20260908_193107_add_creator_xp_bank_field.down,
name: '20260908_193107_add_creator_xp_bank_field',
},
{
up: migration_20260908_194435_add_expose_edge_mines_field.up,
down: migration_20260908_194435_add_expose_edge_mines_field.down,
name: '20260908_194435_add_expose_edge_mines_field'
},
];

View file

@ -3737,7 +3737,15 @@ export interface CustomMinefield {
| null;
mineCount: number;
published?: boolean | null;
/**
* On a failed run, reveal mines bordering the swept area. When off, no remaining mines are revealed.
*/
exposeEdgeMines?: boolean | null;
playCount?: number | null;
/**
* Engine-managed: fractional XP bank for the author (5% of each player payout).
*/
creatorXpBank?: number | null;
updatedAt: string;
createdAt: string;
}
@ -5792,7 +5800,9 @@ export interface CustomMinefieldsSelect<T extends boolean = true> {
mines?: T;
mineCount?: T;
published?: T;
exposeEdgeMines?: T;
playCount?: T;
creatorXpBank?: T;
updatedAt?: T;
createdAt?: T;
}