diff --git a/alembic/versions/8d0d81bc9c34_channel_channel_downloads.py b/alembic/versions/8d0d81bc9c34_channel_channel_downloads.py index 799e8b12..06393ac5 100644 --- a/alembic/versions/8d0d81bc9c34_channel_channel_downloads.py +++ b/alembic/versions/8d0d81bc9c34_channel_channel_downloads.py @@ -1,4 +1,4 @@ -"""Channel.channel_downloads +"""Channel.downloads / Download.channel Revision ID: 8d0d81bc9c34 Revises: 00f11f309c53 @@ -11,6 +11,8 @@ from alembic import op from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import Session +from modules.videos.lib import link_channel_and_downloads + # revision identifiers, used by Alembic. revision = '8d0d81bc9c34' down_revision = '00f11f309c53' @@ -27,29 +29,21 @@ def upgrade(): session = Session(bind=bind) session.execute('ALTER TABLE download ADD CONSTRAINT download_url_unique UNIQUE (url)') - session.execute(''' - CREATE TABLE channel_download ( - channel_id INTEGER REFERENCES channel (id), - download_url TEXT REFERENCES download (url), - primary key (channel_id, download_url) - )''') + session.execute('ALTER TABLE download ADD COLUMN channel_id INTEGER REFERENCES channel(id)') - # Migration is separated for testing. See `test_channel_channel_downloads_migration` - from wrolpi.migration import migrate_channel_downloads - migrate_channel_downloads(session) + link_channel_and_downloads(session) session.execute('ALTER TABLE channel DROP COLUMN IF EXISTS match_regex') session.execute('ALTER TABLE channel DROP COLUMN IF EXISTS download_frequency') - if not DOCKERIZED: - session.execute('ALTER TABLE public.channel_download OWNER TO wrolpi') - def downgrade(): bind = op.get_bind() session = Session(bind=bind) session.execute('DROP TABLE IF EXISTS channel_download') + session.execute('ALTER TABLE download DROP COLUMN IF EXISTS channel_id') + session.execute('ALTER TABLE channel DROP COLUMN IF EXISTS channel_id') session.execute('ALTER TABLE channel ADD COLUMN IF NOT EXISTS match_regex TEXT') session.execute('ALTER TABLE channel ADD COLUMN IF NOT EXISTS download_frequency INTEGER') session.execute('ALTER TABLE download DROP CONSTRAINT IF EXISTS download_url_unique') diff --git a/app/src/components/Channels.js b/app/src/components/Channels.js index a2b5670f..3cc046e9 100644 --- a/app/src/components/Channels.js +++ b/app/src/components/Channels.js @@ -240,7 +240,7 @@ function ChannelPage({create, header}) { } } - let channelDownloads = channel && channel.channel_downloads ? channel.channel_downloads : null; + let downloads = channel && channel.downloads ? channel.downloads : null; const afterNewDownloadSave = async () => { await fetchChannel(); @@ -399,7 +399,7 @@ function ChannelPage({create, header}) { - + }
diff --git a/app/src/components/admin/Downloads.js b/app/src/components/admin/Downloads.js index b95e436a..45afe812 100644 --- a/app/src/components/admin/Downloads.js +++ b/app/src/components/admin/Downloads.js @@ -252,17 +252,6 @@ class RecurringDownloadRow extends React.Component { } } - handleDelete = async () => { - const {id} = this.props; - try { - await deleteDownload(id); - } finally { - if (this.props.fetchDownloads) { - this.props.fetchDownloads(); - } - } - } - handleRestart = async () => { const {id} = this.props; try { @@ -295,7 +284,6 @@ class RecurringDownloadRow extends React.Component { next_download, error, downloader, - channel_id } = this.props; const {errorModalOpen} = this.state; @@ -319,17 +307,6 @@ class RecurringDownloadRow extends React.Component { ; - const deleteButton = <> - - ; - const editButton = <>