CREATE TABLE `community_posts` (
	`id` text PRIMARY KEY NOT NULL,
	`profile_id` text NOT NULL,
	`submitted_by` text NOT NULL,
	`image_url` text DEFAULT '' NOT NULL,
	`source_url` text DEFAULT '' NOT NULL,
	`caption` text DEFAULT '' NOT NULL,
	`status` text DEFAULT 'pending' NOT NULL,
	`featured` integer DEFAULT 0 NOT NULL,
	`sort_order` integer DEFAULT 0 NOT NULL,
	`permission` integer DEFAULT 0 NOT NULL,
	`review_note` text DEFAULT '' NOT NULL,
	`created_at` text NOT NULL,
	`updated_at` text NOT NULL,
	FOREIGN KEY (`profile_id`) REFERENCES `profiles`(`id`) ON UPDATE no action ON DELETE no action,
	FOREIGN KEY (`submitted_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE INDEX `idx_community_status` ON `community_posts` (`status`,`featured`);--> statement-breakpoint
CREATE INDEX `idx_community_user` ON `community_posts` (`submitted_by`);--> statement-breakpoint
ALTER TABLE `profiles` ADD `elite_override` text DEFAULT 'auto' NOT NULL;--> statement-breakpoint
ALTER TABLE `profiles` ADD `elite_updated_by` text;--> statement-breakpoint
ALTER TABLE `profiles` ADD `elite_updated_at` text;