adds OtherProducts and Collections data structures
This commit is contained in:
		
							
								
								
									
										117
									
								
								SCHEMA.md
									
									
									
									
									
								
							
							
						
						
									
										117
									
								
								SCHEMA.md
									
									
									
									
									
								
							@ -705,26 +705,115 @@ CREATE INDEX ArticleComments_article_id_IDX ON ArticleComments (article_id);
 | 
			
		||||
CREATE INDEX ArticleComments_comment_id_IDX ON ArticleComments (comment_id);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# LabelImages
 | 
			
		||||
# OtherProducts
 | 
			
		||||
The OtherProducts table will contain products for sale that are not Albums nor Tracks nor Collections.
 | 
			
		||||
 | 
			
		||||
# LabelVideos
 | 
			
		||||
``` sql
 | 
			
		||||
CREATE TABLE OtherProducts (
 | 
			
		||||
	id TEXT(36),
 | 
			
		||||
	name TEXT,
 | 
			
		||||
	description TEXT,
 | 
			
		||||
	created_by TEXT(36),
 | 
			
		||||
	created_at INTEGER,
 | 
			
		||||
	modified_by TEXT(36),
 | 
			
		||||
	modified_at INTEGER,
 | 
			
		||||
	deleted_by TEXT(36),
 | 
			
		||||
	deleted_at INTEGER,
 | 
			
		||||
	is_public INTEGER DEFAULT (0),
 | 
			
		||||
	is_available INTEGER DEFAULT (0),
 | 
			
		||||
	requires_shipping INTEGER DEFAULT (0),
 | 
			
		||||
	CONSTRAINT OtherProducts_PK PRIMARY KEY (id),
 | 
			
		||||
	CONSTRAINT OtherProducts_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
 | 
			
		||||
	CONSTRAINT OtherProducts_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
 | 
			
		||||
	CONSTRAINT OtherProducts_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
 | 
			
		||||
);
 | 
			
		||||
CREATE INDEX OtherProducts_name_IDX ON OtherProducts (name);
 | 
			
		||||
CREATE INDEX OtherProducts_description_IDX ON OtherProducts (description);
 | 
			
		||||
CREATE INDEX OtherProducts_created_by_IDX ON OtherProducts (created_by);
 | 
			
		||||
CREATE INDEX OtherProducts_created_at_IDX ON OtherProducts (created_at);
 | 
			
		||||
CREATE INDEX OtherProducts_modified_by_IDX ON OtherProducts (modified_by);
 | 
			
		||||
CREATE INDEX OtherProducts_modified_at_IDX ON OtherProducts (modified_at);
 | 
			
		||||
CREATE INDEX OtherProducts_deleted_by_IDX ON OtherProducts (deleted_by);
 | 
			
		||||
CREATE INDEX OtherProducts_deleted_at_IDX ON OtherProducts (deleted_at);
 | 
			
		||||
CREATE INDEX OtherProducts_is_public_IDX ON OtherProducts (is_public);
 | 
			
		||||
CREATE INDEX OtherProducts_is_available_IDX ON OtherProducts (is_available);
 | 
			
		||||
CREATE INDEX OtherProducts_requires_shipping_IDX ON OtherProducts (requires_shipping);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# ArtistImages
 | 
			
		||||
# Collections
 | 
			
		||||
The Collections table will contain Collections where each Collection is comprised of one or more Tracks, Albums, and/or OtherProducts packaged together for sale.
 | 
			
		||||
 | 
			
		||||
# ArtistVideos
 | 
			
		||||
``` sql
 | 
			
		||||
CREATE TABLE Collections (
 | 
			
		||||
	id TEXT(36),
 | 
			
		||||
	name TEXT,
 | 
			
		||||
	description TEXT,
 | 
			
		||||
	created_by TEXT(36),
 | 
			
		||||
	created_at INTEGER,
 | 
			
		||||
	modified_by TEXT(36),
 | 
			
		||||
	modified_at INTEGER,
 | 
			
		||||
	deleted_by TEXT(36),
 | 
			
		||||
	deleted_at INTEGER,
 | 
			
		||||
	is_public INTEGER DEFAULT (0),
 | 
			
		||||
	is_available INTEGER DEFAULT (0),
 | 
			
		||||
	CONSTRAINT Collections_PK PRIMARY KEY (id),
 | 
			
		||||
	CONSTRAINT Collections_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
 | 
			
		||||
	CONSTRAINT Collections_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
 | 
			
		||||
	CONSTRAINT Collections_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
 | 
			
		||||
);
 | 
			
		||||
CREATE INDEX Collections_name_IDX ON Collections (name);
 | 
			
		||||
CREATE INDEX Collections_description_IDX ON Collections (description);
 | 
			
		||||
CREATE INDEX Collections_created_by_IDX ON Collections (created_by);
 | 
			
		||||
CREATE INDEX Collections_created_at_IDX ON Collections (created_at);
 | 
			
		||||
CREATE INDEX Collections_modified_by_IDX ON Collections (modified_by);
 | 
			
		||||
CREATE INDEX Collections_modified_at_IDX ON Collections (modified_at);
 | 
			
		||||
CREATE INDEX Collections_deleted_by_IDX ON Collections (deleted_by);
 | 
			
		||||
CREATE INDEX Collections_deleted_at_IDX ON Collections (deleted_at);
 | 
			
		||||
CREATE INDEX Collections_is_public_IDX ON Collections (is_public);
 | 
			
		||||
CREATE INDEX Collections_is_available_IDX ON Collections (is_available);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# AlbumImages
 | 
			
		||||
# CollectionAlbums
 | 
			
		||||
The CollectionAlbums table will relate a Collection to the Album(s) it contains.
 | 
			
		||||
 | 
			
		||||
# AlbumVideos
 | 
			
		||||
``` sql
 | 
			
		||||
CREATE TABLE CollectionAlbums (
 | 
			
		||||
	collection_id TEXT(36),
 | 
			
		||||
	album_id TEXT(36),
 | 
			
		||||
	CONSTRAINT CollectionAlbums_PK PRIMARY KEY (collection_id,album_id),
 | 
			
		||||
	CONSTRAINT CollectionAlbums_FK FOREIGN KEY (collection_id) REFERENCES Collections(id) ON DELETE CASCADE,
 | 
			
		||||
	CONSTRAINT CollectionAlbums_FK_1 FOREIGN KEY (album_id) REFERENCES Albums(id) ON DELETE CASCADE
 | 
			
		||||
);
 | 
			
		||||
CREATE INDEX CollectionAlbums_collection_id_IDX ON CollectionAlbums (collection_id);
 | 
			
		||||
CREATE INDEX CollectionAlbums_album_id_IDX ON CollectionAlbums (album_id);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# TrackImages
 | 
			
		||||
# CollectionTracks
 | 
			
		||||
The CollectionTracks table will relate a Collection to the Track(s) it contains.
 | 
			
		||||
 | 
			
		||||
# TrackVideos
 | 
			
		||||
``` sql
 | 
			
		||||
CREATE TABLE CollectionTracks (
 | 
			
		||||
	collection_id TEXT(36),
 | 
			
		||||
	track_id TEXT(36),
 | 
			
		||||
	CONSTRAINT CollectionTracks_PK PRIMARY KEY (collection_id,track_id),
 | 
			
		||||
	CONSTRAINT CollectionTracks_FK FOREIGN KEY (collection_id) REFERENCES Collections(id) ON DELETE CASCADE,
 | 
			
		||||
	CONSTRAINT CollectionTracks_FK_1 FOREIGN KEY (track_id) REFERENCES Tracks(id) ON DELETE CASCADE
 | 
			
		||||
);
 | 
			
		||||
CREATE INDEX CollectionTracks_collection_id_IDX ON CollectionTracks (collection_id);
 | 
			
		||||
CREATE INDEX CollectionTracks_track_id_IDX ON CollectionTracks (track_id);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# PlaylistImages
 | 
			
		||||
# CollectionOtherProducts
 | 
			
		||||
The CollectionOtherProducts table will relate a Collection to the OtherProduct(s) it contains.
 | 
			
		||||
 | 
			
		||||
# PlaylistVideos
 | 
			
		||||
 | 
			
		||||
# ArticleImages
 | 
			
		||||
 | 
			
		||||
# ArticleVideos
 | 
			
		||||
``` sql
 | 
			
		||||
CREATE TABLE CollectionOtherProducts (
 | 
			
		||||
	collection_id TEXT(36),
 | 
			
		||||
	other_product_id TEXT(36),
 | 
			
		||||
	CONSTRAINT CollectionOtherProducts_PK PRIMARY KEY (collection_id,other_product_id),
 | 
			
		||||
	CONSTRAINT CollectionOtherProducts_FK FOREIGN KEY (collection_id) REFERENCES Collections(id) ON DELETE CASCADE,
 | 
			
		||||
	CONSTRAINT CollectionOtherProducts_FK_1 FOREIGN KEY (other_product_id) REFERENCES OtherProducts(id) ON DELETE CASCADE
 | 
			
		||||
);
 | 
			
		||||
CREATE INDEX CollectionOtherProducts_collection_id_IDX ON CollectionOtherProducts (collection_id);
 | 
			
		||||
CREATE INDEX CollectionOtherProducts_other_product_id_IDX ON CollectionOtherProducts (other_product_id);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user