simplify subscribing/unsubscribing podcasts
[mygpo.git] / install / update-17.sql
blobe4d36c8efde1ce5b9ecaabd4097667ac4c93048d
1 BEGIN;
2 CREATE TABLE `historic_podcast_data` (
3     `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
4     `podcast_id` integer NOT NULL,
5     `date` date NOT NULL,
6     `subscriber_count` integer NOT NULL,
7     UNIQUE (`podcast_id`, `date`)
10 ALTER TABLE `historic_podcast_data` ADD CONSTRAINT `podcast_id_refs_id_aeb8d2a` FOREIGN KEY (`podcast_id`) REFERENCES `podcast` (`id`);
11 CREATE TABLE `historic_episode_data` (
12     `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
13     `episode_id` integer NOT NULL,
14     `date` date NOT NULL,
15     `listener_count` integer NOT NULL,
16     UNIQUE (`episode_id`, `date`)
19 ALTER TABLE `historic_episode_data` ADD CONSTRAINT `episode_id_refs_id_2f31345e` FOREIGN KEY (`episode_id`) REFERENCES `episode` (`id`);
20 COMMIT;
23 create index podcast_data_index on historic_podcast_data(podcast_id, date);
24 create index podcast_data_podcast_index on historic_podcast_data(podcast_id);
25 create index podcast_data_date_index on historic_podcast_data(date);
26 create index episode_data_index on historic_episode_data(episode_id, date);
27 create index episode_data_episode_index on historic_episode_data(episode_id);
28 create index episode_data_date_index on historic_episode_data(date);