ALTER TABLE `restaurants` ADD `trial_ends_at` text;
--> statement-breakpoint
CREATE INDEX `idx_restaurants_trial_ends` ON `restaurants` (`plan`,`trial_ends_at`);
--> statement-breakpoint
-- Anyone already sitting on the old always-locked trial gets a full 30 days
-- from now, so nobody loses access the moment this version is installed.
UPDATE `restaurants`
SET `trial_ends_at` = datetime(CURRENT_TIMESTAMP, '+30 days')
WHERE `plan` = 'trial' AND `trial_ends_at` IS NULL;
--> statement-breakpoint
PRAGMA optimize;
