24 lines
773 B
SQL
24 lines
773 B
SQL
CREATE TABLE `priceHistory` (
|
|
`id` int AUTO_INCREMENT NOT NULL,
|
|
`monitorId` int NOT NULL,
|
|
`price` decimal(10,2) NOT NULL,
|
|
`priceChange` decimal(10,2),
|
|
`percentChange` decimal(5,2),
|
|
`recordedAt` timestamp NOT NULL DEFAULT (now()),
|
|
CONSTRAINT `priceHistory_id` PRIMARY KEY(`id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `priceMonitors` (
|
|
`id` int AUTO_INCREMENT NOT NULL,
|
|
`favoriteId` int NOT NULL,
|
|
`userId` int NOT NULL,
|
|
`currentPrice` decimal(10,2),
|
|
`targetPrice` decimal(10,2),
|
|
`lowestPrice` decimal(10,2),
|
|
`highestPrice` decimal(10,2),
|
|
`isActive` boolean NOT NULL DEFAULT true,
|
|
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
|
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
|
|
CONSTRAINT `priceMonitors_id` PRIMARY KEY(`id`)
|
|
);
|