New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made downloads and subscriptions unique by programme or episode id. #113

Closed
ribbons opened this Issue Aug 22, 2013 · 3 comments

Comments

Projects
None yet
1 participant
@ribbons
Owner

ribbons commented Aug 22, 2013

Original report from Matt Robinson at 12:35:48 on 2010-05-29

Currently, the database will quite happily allow multiple entries for a single episode in the downloads table, and for a single programme in the subscriptions table. This is incorrect, as if this does happen, the application will crash because it assumes there will not be multiple entries for a single programme or episode.

To resolve this issue, a unique constraint should be added to the progid column in the subscriptions table, and to the epid column in the downloads table.


Imported from Bug 270 in the NerdoftheHerd.com Bugzilla.

@ghost ghost assigned ribbons Aug 22, 2013

@ribbons

This comment has been minimized.

Owner

ribbons commented Aug 22, 2013

Original comment from Matt Robinson at 16:17:51 on 2010-05-29

Updated subscriptions table from:

CREATE TABLE [subscriptions]([progid] integer)

to:

CREATE TABLE [subscriptions]([progid] integer UNIQUE NOT NULL)

in revisions 861 & 862.

@ribbons

This comment has been minimized.

Owner

ribbons commented Aug 22, 2013

Original comment from Matt Robinson at 16:31:17 on 2010-05-29

Updated downloads table from:

CREATE TABLE [downloads]([epid] integer,
[status] integer NOT NULL DEFAULT 0,
[filepath] varchar %28255%29,
[errorcount] integer NOT NULL DEFAULT 0,
[totalerrors] integer NOT NULL DEFAULT 0,
[errortime] datetime,
[errordetails] memo,
[playcount] integer NOT NULL DEFAULT 0,
[errortype] integer)

to:

CREATE TABLE [downloads]([epid] integer UNIQUE NOT NULL,
[status] integer NOT NULL DEFAULT 0,
[filepath] varchar %28255%29,
[errorcount] integer NOT NULL DEFAULT 0,
[totalerrors] integer NOT NULL DEFAULT 0,
[errortime] datetime,
[errordetails] memo,
[playcount] integer NOT NULL DEFAULT 0,
[errortype] integer)

in 7289a60.

@ribbons

This comment has been minimized.

Owner

ribbons commented Aug 22, 2013

Original comment from Matt Robinson at 17:10:32 on 2010-05-29

Added locks and extra checks to the AddDownloadAsync and AddSubscriptionAsync subs in 3db071d to prevent the application from trying to insert duplicate downloads or subscriptions because of race conditions.

@ribbons ribbons closed this Aug 22, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment