CREATE TABLE `daily_spins` (
	`id` int AUTO_INCREMENT NOT NULL,
	`userId` int NOT NULL,
	`spinsUsed` int NOT NULL DEFAULT 0,
	`lastSpinAt` timestamp,
	`lastResetAt` timestamp NOT NULL DEFAULT (now()),
	`totalWon` decimal(10,2) NOT NULL DEFAULT '0.00',
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `daily_spins_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `spin_history` (
	`id` int AUTO_INCREMENT NOT NULL,
	`userId` int NOT NULL,
	`amount` decimal(10,2) NOT NULL,
	`currency` enum('GC','SC') NOT NULL DEFAULT 'SC',
	`result` varchar(50) NOT NULL,
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	CONSTRAINT `spin_history_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE INDEX `idx_daily_spins_userId` ON `daily_spins` (`userId`);--> statement-breakpoint
CREATE INDEX `idx_daily_spins_lastResetAt` ON `daily_spins` (`lastResetAt`);--> statement-breakpoint
CREATE INDEX `idx_spin_history_userId` ON `spin_history` (`userId`);--> statement-breakpoint
CREATE INDEX `idx_spin_history_createdAt` ON `spin_history` (`createdAt`);