CREATE TABLE `podcast_apresentadores` (
	`id` int AUTO_INCREMENT NOT NULL,
	`nome` varchar(255) NOT NULL,
	`slug` varchar(255),
	`bio` text,
	`foto` varchar(500),
	`reproducoes` int DEFAULT 0,
	`ativo` int DEFAULT 1,
	`criado_em` timestamp DEFAULT (now()),
	`atualizado_em` timestamp DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `podcast_apresentadores_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `podcast_episodios` (
	`id` int AUTO_INCREMENT NOT NULL,
	`titulo` varchar(255) NOT NULL,
	`descricao` text,
	`arquivo` varchar(500),
	`capa` varchar(500),
	`duracao` int,
	`reproducoes` int DEFAULT 0,
	`numero_episodio` int,
	`tags` text,
	`apresentador_id` int,
	`programa_id` int,
	`ativo` int DEFAULT 1,
	`criado_em` timestamp DEFAULT (now()),
	`atualizado_em` timestamp DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `podcast_episodios_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `podcast_programas` (
	`id` int AUTO_INCREMENT NOT NULL,
	`titulo` varchar(255) NOT NULL,
	`slug` varchar(255),
	`descricao` text,
	`capa` varchar(500),
	`ano` int,
	`genero` varchar(100),
	`apresentador_id` int,
	`ativo` int DEFAULT 1,
	`criado_em` timestamp DEFAULT (now()),
	`atualizado_em` timestamp DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `podcast_programas_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `user_favoritos` (
	`id` int AUTO_INCREMENT NOT NULL,
	`user_id` int NOT NULL,
	`episodio_id` int NOT NULL,
	`criado_em` timestamp DEFAULT (now()),
	CONSTRAINT `user_favoritos_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `user_historico` (
	`id` int AUTO_INCREMENT NOT NULL,
	`user_id` int NOT NULL,
	`episodio_id` int NOT NULL,
	`tocado_em` timestamp DEFAULT (now()),
	CONSTRAINT `user_historico_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `user_playlist_items` (
	`id` int AUTO_INCREMENT NOT NULL,
	`playlist_id` int NOT NULL,
	`episodio_id` int NOT NULL,
	`ordem` int DEFAULT 0,
	`adicionado_em` timestamp DEFAULT (now()),
	CONSTRAINT `user_playlist_items_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `user_playlists` (
	`id` int AUTO_INCREMENT NOT NULL,
	`user_id` int NOT NULL,
	`titulo` varchar(255) NOT NULL,
	`descricao` text,
	`criado_em` timestamp DEFAULT (now()),
	`atualizado_em` timestamp DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `user_playlists_id` PRIMARY KEY(`id`)
);
