Open KamiyamaKiriko opened 10 years ago
A summarisation of the earlier IRC discussion relating to how this could be implemented would probably be a good idea.
Hopefully a log will do.
Create pseudo groups? Groups can set up a pseudo group with at least 1 other group.
Create table with torrent_id, group_id, pseudo_group_id, and user_id
Pseudogroups seems like a good idea.
Or you could just do a Many-to-Many group to torrent relationships (Can even let you do 3 groups at a time.):
e.g.: (I just copied this out of my django-autogen queries. change the types as need be. I also have a similar thing done for users to groups.)
Table for groups:
CREATE TABLE index_group
(
id
integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
name
varchar(200) NOT NULL,
website
varchar(200) NOT NULL
)
Tables for torrents:
CREATE TABLE index_torrent
(
id
integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
name
varchar(200) NOT NULL,
owner_id
integer NOT NULL,
likes
integer NOT NULL,
size
integer NOT NULL,
info_hash
varchar(40) NOT NULL,
date
datetime NOT NULL
)
Many to Many relationships table
CREATE TABLE index_torrent_groups
(
id
integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
torrent_id
integer NOT NULL,
group_id
integer NOT NULL,
UNIQUE (torrent_id
, group_id
)
)
Foreign key link for easier and faster joining:
ALTER TABLE index_torrent_groups
ADD CONSTRAINT group_id_refs_id_63c48fc4
FOREIGN KEY (group_id
) REFERENCES index_group
(id
);
ALTER TABLE index_torrent_groups
ADD CONSTRAINT torrent_id_refs_id_6981c024
FOREIGN KEY (torrent_id
) REFERENCES index_torrent
(id
);
That was the plan! Hence the "at least 1" What I suggested:
CREATE TABLE index_torrent_groups
(
id
integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
torrent_id
integer NOT NULL,
group_id
integer NOT NULL,
pseudo_group_id integer
,
UNIQUE (torrent_id
, group_id
, pseudo_group_id
)
)
Will just create many-to-many relation between torrent and group. People can search for collaborations with the AND in search query.
Modified DB to support this.