Compare commits
39 Commits
1359dca5df
...
automated-
Author | SHA1 | Date | |
---|---|---|---|
d85d6285d2 | |||
3e80545d6b | |||
b511e5a81a | |||
8b5b5b539b | |||
f5b7db930d | |||
8e0984e7b1 | |||
4957b36355 | |||
614d7b8a20 | |||
c5f723210b | |||
691afc382d | |||
cd4333cacd | |||
de9d8dde88 | |||
55ec00d1fb | |||
05b6ffc807 | |||
7360bba00e | |||
8c46018fee | |||
dc01798dfa | |||
2aad6e49cd | |||
b7c37613ce | |||
d8b6e31836 | |||
0babf35c1e | |||
57313ddf7c | |||
5ae1314bb7 | |||
0cd0e54b66 | |||
54db9795fe | |||
e27d224d3d | |||
3b14b93d17 | |||
1c719b3061 | |||
cab056ea69 | |||
1fbe2d6911 | |||
c5ebcc8204 | |||
4bba521103 | |||
abe545397b | |||
cb3f76aa17 | |||
e93736be61 | |||
188544366c | |||
9c4d3a7197 | |||
ce51888070 | |||
69b694ae60 |
44
.gitea/workflows/checks.yml
Normal file
44
.gitea/workflows/checks.yml
Normal file
@ -0,0 +1,44 @@
|
||||
name: checks
|
||||
on:
|
||||
pull_request:
|
||||
paths: &CODE_PATHS
|
||||
- 'src/**'
|
||||
- 'Cargo*'
|
||||
push:
|
||||
paths: *CODE_PATHS
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# TODO(cascode) cache checkout for build and test stages?
|
||||
lint:
|
||||
container:
|
||||
# TODO use communitymedia docker registry
|
||||
image: "cascode/aural-isle-ci:0"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
github-server-url: "https://code.communitymedia.network"
|
||||
- name: rustfmt
|
||||
run: cargo fmt --check
|
||||
build:
|
||||
container:
|
||||
# TODO use communitymedia docker registry
|
||||
image: "cascode/aural-isle-ci:2"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
github-server-url: "https://code.communitymedia.network"
|
||||
- name: build
|
||||
run: cargo build
|
||||
# TODO(cascode) cache builds for test stage
|
||||
test:
|
||||
container:
|
||||
# TODO use communitymedia docker registry
|
||||
image: "cascode/aural-isle-ci:2"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
github-server-url: "https://code.communitymedia.network"
|
||||
- name: run unit tests
|
||||
run: cargo test
|
251
MODELS.md
251
MODELS.md
@ -21,6 +21,9 @@ struct Person {
|
||||
name: String,
|
||||
handle: Option<String>,
|
||||
email: Option<Vec<String>>,
|
||||
avatar: Option<String>,
|
||||
cover: Option<String>,
|
||||
bio: Option<String>,
|
||||
is_active: bool,
|
||||
is_blocked: bool,
|
||||
created_at: chrono::DateTime,
|
||||
@ -48,9 +51,10 @@ enum PersonCredentialProviderType {
|
||||
struct PersonCredentialProviderId {
|
||||
id: String,
|
||||
}
|
||||
enum PersonCredentialProvider {
|
||||
struct PersonCredentialProvider {
|
||||
id: PersonCredentialProviderId,
|
||||
name: String,
|
||||
type: PersonCredentialProviderType,
|
||||
config: String,
|
||||
}
|
||||
struct PersonCredential {
|
||||
@ -99,12 +103,41 @@ struct Label {
|
||||
name: String,
|
||||
description: String,
|
||||
website: String,
|
||||
is_enabled: bool,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: PersonId,
|
||||
modified_at: chrono::DateTime,
|
||||
deleted_by: Option<PersonId>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
artists: HashMap<Artist>,
|
||||
tags: Option<Vec<Tag>>,
|
||||
comments: Option<Vec<Comment>>,
|
||||
}
|
||||
```
|
||||
|
||||
# LabelContact
|
||||
|
||||
A LabelContact represents a method for contacting a representative of a Label.
|
||||
|
||||
``` rust
|
||||
struct LabelContactId {
|
||||
id: String,
|
||||
}
|
||||
struct LabelContact {
|
||||
id: LabelContactId,
|
||||
method: String,
|
||||
address: String,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: PersonId,
|
||||
modified_at: chrono::DateTime,
|
||||
deleted_by: Option<PersonId>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
sort_order: usize,
|
||||
}
|
||||
```
|
||||
|
||||
# Artist
|
||||
|
||||
An Artist represents a musical artist.
|
||||
@ -118,8 +151,19 @@ struct Artist {
|
||||
name: String,
|
||||
bio: String,
|
||||
website: String,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: PersonId,
|
||||
modified_at: chrono::DateTime,
|
||||
deleted_by: Option<PersonId>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
is_enabled: bool,
|
||||
is_public: bool,
|
||||
labels: Option<Vec<LabelId>>,
|
||||
tags: Option<Vec<Tag>>,
|
||||
comments: Option<Vec<Comment>>,
|
||||
cover: Option<String>,
|
||||
images: Option<Vec<String>>,
|
||||
}
|
||||
```
|
||||
|
||||
@ -134,14 +178,13 @@ struct TrackId {
|
||||
struct Track {
|
||||
id: TrackId,
|
||||
title: String,
|
||||
description: String,
|
||||
description: Option<String>,
|
||||
duration: chrono::Duration,
|
||||
artists: HashMap<Artist>,
|
||||
artists: Vec<Artist>,
|
||||
is_public: bool,
|
||||
is_available: bool,
|
||||
preview_source: Option<String>,
|
||||
source: String,
|
||||
price: Option<rusty_money::Money>,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: PersonId,
|
||||
@ -168,13 +211,12 @@ struct Album {
|
||||
id: AlbumId,
|
||||
title: String,
|
||||
description: String,
|
||||
artists: HashMap<Artist>,
|
||||
tracks: HashMap<Track>,
|
||||
artists: Vec<Artist>,
|
||||
tracks: Vec<Track>,
|
||||
is_public: bool,
|
||||
is_available: bool,
|
||||
preview_source: Option<String>,
|
||||
source: String,
|
||||
price: Option<rusty_money::Money>,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: PersonId,
|
||||
@ -183,8 +225,8 @@ struct Album {
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
tags: Option<Vec<Tag>>,
|
||||
comments: Option<Vec<Comment>>,
|
||||
cover: Option<String>,
|
||||
images: Option<Vec<String>>,
|
||||
cover: Option<ImageId>,
|
||||
images: Option<Vec<ImageId>>,
|
||||
}
|
||||
```
|
||||
|
||||
@ -199,13 +241,13 @@ struct PlaylistId {
|
||||
struct Playlist {
|
||||
id: PlaylistId,
|
||||
title: String,
|
||||
description: String,
|
||||
created_by: String,
|
||||
description: Option<String>,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_at: chrono::DateTime,
|
||||
deleted_at: Option<chrono::DateTime>
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
is_public: bool,
|
||||
cover: Option<String>,
|
||||
cover: Option<ImageId>,
|
||||
tracks: Vec<Track>,
|
||||
tags: Option<Vec<Tag>>,
|
||||
comments: Option<Vec<Comment>>,
|
||||
@ -228,11 +270,12 @@ struct Article {
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_at: chrono::DateTime,
|
||||
deleted_at: Option<chrono::DateTime>
|
||||
published_at: Option<chrono::DateTime>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
is_public: bool,
|
||||
is_draft: bool,
|
||||
cover: Option<String>,
|
||||
images: Option<Vec<String>>,
|
||||
cover: Option<ImageId>,
|
||||
images: Option<Vec<ImageId>>,
|
||||
tracks: Option<Vec<Track>>,
|
||||
tags: Option<Vec<Tag>>,
|
||||
comments: Option<Vec<Comment>>,
|
||||
@ -244,23 +287,14 @@ struct Article {
|
||||
A Comment represents a textual comment that a Person wants to attach contextually to an Artist, an Album, a Track, or a Playlist.
|
||||
|
||||
``` rust
|
||||
enum CommentTargetType {
|
||||
Label,
|
||||
Artist,
|
||||
Album,
|
||||
Track,
|
||||
Playlist,
|
||||
Article,
|
||||
Comment,
|
||||
}
|
||||
struct CommentTargetId {
|
||||
label_id: Option<LabelId>,
|
||||
artist_id: Option<ArtistId>,
|
||||
album_id: Option<AlbumId>,
|
||||
track_id: Option<TrackId>,
|
||||
playlist_id: Option<PlaylistId>,
|
||||
article_id: Option<ArticleId>,
|
||||
comment_id: Option<CommentId>,
|
||||
enum CommentTarget {
|
||||
Label(LabelId),
|
||||
Artist(ArtistId),
|
||||
Album(AlbumId),
|
||||
Track(TrackId),
|
||||
Playlist(PlaylistId),
|
||||
Article(ArticleId),
|
||||
Comment(CommentId),
|
||||
}
|
||||
struct CommentId {
|
||||
id: String,
|
||||
@ -268,23 +302,84 @@ struct CommentId {
|
||||
struct Comment {
|
||||
id: CommentId,
|
||||
body: String,
|
||||
target_type: CommentTargetType,
|
||||
target_id: CommentTargetId,
|
||||
target: CommentTarget,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_at: chrono::DateTime,
|
||||
deleted_at: Option<chrono::DateTime>
|
||||
modified_by: Option<PersonId>,
|
||||
modified_at: Option<chrono::DateTime>,
|
||||
deleted_by: Option<PersonId>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
is_public: bool,
|
||||
is_approved: bool,
|
||||
in_reply_to: Option<CommentId>,
|
||||
}
|
||||
```
|
||||
|
||||
# Collection
|
||||
# Image
|
||||
|
||||
A Collection represents one or more Albums and/or Tracks that are offered together as a package for Purchase
|
||||
An Image represents an image file that a Person wants to reference from a Label, an Artist, an Album, a Track, a Playlist, or an Article.
|
||||
|
||||
``` rust
|
||||
struct ImageId {
|
||||
id: String,
|
||||
}
|
||||
struct Image {
|
||||
id: ImageId,
|
||||
name: Option<String>,
|
||||
path: String,
|
||||
url: String,
|
||||
width: usize,
|
||||
height: usize,
|
||||
alt_text: String,
|
||||
is_public: bool,
|
||||
allow_hotlinking: bool,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: PersonId,
|
||||
modified_at: chrono::DateTime,
|
||||
deleted_by: Option<PersonId>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
}
|
||||
```
|
||||
|
||||
# Video
|
||||
|
||||
A Video represents a video file that a Person wants to reference from a Label, an Artist, an Album, a Track, a Playlist, or an Article.
|
||||
|
||||
``` rust
|
||||
struct VideoId {
|
||||
id: String,
|
||||
}
|
||||
struct Video {
|
||||
id: VideoId,
|
||||
name: Option<String>,
|
||||
path: String,
|
||||
url: String,
|
||||
width: usize,
|
||||
height: usize,
|
||||
duration: chrono::Duration,
|
||||
alt_text: String,
|
||||
is_public: bool,
|
||||
allow_hotlinking: bool,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: PersonId,
|
||||
modified_at: chrono::DateTime,
|
||||
deleted_by: Option<PersonId>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
}
|
||||
```
|
||||
|
||||
# Collection
|
||||
|
||||
A Collection represents one or more Albums, Tracks, and/or OtherProducts that are offered together as a package for Purchase
|
||||
|
||||
``` rust
|
||||
enum CollectionItem {
|
||||
Album(AlbumId),
|
||||
Track(TrackId),
|
||||
OtherProduct(OtherProductId),
|
||||
}
|
||||
struct CollectionId {
|
||||
id: String,
|
||||
}
|
||||
@ -292,17 +387,15 @@ struct Collection {
|
||||
id: CollectionId,
|
||||
name: String,
|
||||
description: String,
|
||||
created_by: Person,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: Person,
|
||||
modified_at: chrono::DateTime,
|
||||
is_public: bool,
|
||||
is_available: bool,
|
||||
deleted_by: Option<Person>,
|
||||
deleted_by: Option<PersonId>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
albums: Option<Vec<Album>>,
|
||||
tracks: Option<Vec<Track>>,
|
||||
price: Oprion<rusty_money::Money>,
|
||||
collection_items: Option<Vec<CollectionMember>>,
|
||||
}
|
||||
```
|
||||
|
||||
@ -318,20 +411,28 @@ struct OtherProduct {
|
||||
id: OtherProductId,
|
||||
name: String,
|
||||
description: String,
|
||||
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: PersonId,
|
||||
modified_at: chrono::DateTime,
|
||||
is_public: bool,
|
||||
is_available: bool,
|
||||
deleted_by: Option<PersonId>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
requires_shipping: bool,
|
||||
}
|
||||
```
|
||||
|
||||
# Purchase
|
||||
|
||||
A Purchase represents one or more Tracks or Albums that a Person purchases from an Artist or Label through the server.
|
||||
A Purchase represents one or more Tracks, Albums, Collections, and/or OtherProducts that a Person purchases from an Artist or Label through the server.
|
||||
|
||||
``` rust
|
||||
enum PurchaseItemType {
|
||||
Album,
|
||||
Track,
|
||||
Collection,
|
||||
OtherProduct,
|
||||
Album(AlbumId),
|
||||
Track(TrackId),
|
||||
Collection(CollectionId),
|
||||
OtherProduct(OtherProductId),
|
||||
}
|
||||
struct PurchaseItemId {
|
||||
id: String,
|
||||
@ -341,17 +442,17 @@ struct SkuId {
|
||||
}
|
||||
struct Sku {
|
||||
id: SkuId,
|
||||
album_id: Option<AlbumId>,
|
||||
track_id: Option<TrackId>,
|
||||
collection_id: Option<CollectionId>,
|
||||
other_product_id: Option<OtherProductId>,
|
||||
item: PurchaseItemType,
|
||||
variant: Option<String>,
|
||||
description: Option<String>,
|
||||
price: rusty_money::Money,
|
||||
requires_shipping: bool,
|
||||
shipping_charge: Option<rusty_money::Money>,
|
||||
}
|
||||
struct PurchaseItem {
|
||||
id: PurchaseItemId,
|
||||
type: PurchaseItemType,
|
||||
struct LineItem {
|
||||
id: LineItemId,
|
||||
sku: SkuId,
|
||||
quantity: usize,
|
||||
discount_percentage: usize,
|
||||
}
|
||||
enum PurchaseState {
|
||||
InCart,
|
||||
@ -364,9 +465,41 @@ enum PurchaseState {
|
||||
}
|
||||
struct Purchase {
|
||||
id: String,
|
||||
items: Vec<PurchaseItem>,
|
||||
items: Vec<LineItem>,
|
||||
state: PurchaseState,
|
||||
purchased_by: Person,
|
||||
purchased_at: Option<chrono::DateTime>,
|
||||
fulfilled_by: Option<Person>,
|
||||
fulfilled_at: Option<chrono::DateTime>,
|
||||
coupons_applied: Option<Vec<CouponCodeId>>,
|
||||
total_charge: rusty_money::Money,
|
||||
}
|
||||
```
|
||||
|
||||
# CouponCode
|
||||
|
||||
A CouponCode represents a code a Person can enter to receive a discount on a PurchateItem or on a Purchase.
|
||||
|
||||
``` rust
|
||||
struct CouponCodeId {
|
||||
id: String,
|
||||
}
|
||||
struct CouponCode {
|
||||
id: CouponCodeId,
|
||||
name: String,
|
||||
code: String,
|
||||
uses: usize,
|
||||
max_uses: usize,
|
||||
expiration: Option<chrono::DateTime>,
|
||||
discount_flat: Option<rusty_money::Money>,
|
||||
discount_percentage: Option<f32>,
|
||||
skus: Option<Vec<SkuId>>,
|
||||
is_active: bool,
|
||||
created_by: PersonId,
|
||||
created_at: chrono::DateTime,
|
||||
modified_by: PersonId,
|
||||
modified_at: chrono::DateTime,
|
||||
deleted_by: Option<PersonId>,
|
||||
deleted_at: Option<chrono::DateTime>,
|
||||
}
|
||||
```
|
859
SCHEMA.md
859
SCHEMA.md
@ -13,6 +13,9 @@ CREATE TABLE Persons (
|
||||
remote_id TEXT, /* field to store an arbitrary remote identifier for this Person if they are not local */
|
||||
name TEXT, /* "real" name */
|
||||
handle TEXT, /* also commonly refered to as 'display_name' or 'screen_name', optional (if missing, name will be used as handle) */
|
||||
avatar TEXT, /* optional URL to Person's avatar image / profile pic */
|
||||
cover TEXT, /* optional URL to Person's cover image / header image */
|
||||
bio TEXT, /* optional biographical text provided by Person */
|
||||
is_active INTEGER DEFAULT (1), /* bool, default true */
|
||||
is_blocked INTEGER DEFAULT (0), /* bool, default false */
|
||||
created_at INTEGER, /* timestamp */
|
||||
@ -51,3 +54,859 @@ CREATE INDEX PersonEmails_is_verified_IDX ON PersonEmails (is_verified);
|
||||
CREATE INDEX PersonEmails_is_primary_IDX ON PersonEmails (is_primary);
|
||||
```
|
||||
|
||||
# PersonCredentialProvider
|
||||
The PersonCredentialProvider table will contain configuration for different authentication providers.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE PersonCredentialProvider (
|
||||
id TEXT(36),
|
||||
name TEXT,
|
||||
"type" TEXT,
|
||||
config TEXT,
|
||||
CONSTRAINT PersonCredentialProvider_PK PRIMARY KEY (id)
|
||||
);
|
||||
CREATE INDEX PersonCredentialProvider_name_IDX ON PersonCredentialProvider (name);
|
||||
CREATE INDEX PersonCredentialProvider_type_IDX ON PersonCredentialProvider ("type");
|
||||
```
|
||||
|
||||
# PersonCredential
|
||||
The PersonCredential table will contain authentication credentials for Persons
|
||||
|
||||
``` sql
|
||||
CREATE TABLE PersonCredential (
|
||||
id TEXT(36),
|
||||
person_id TEXT(36),
|
||||
provider_id TEXT(36),
|
||||
provider_user_id TEXT(36),
|
||||
is_enabled INTEGER DEFAULT (1),
|
||||
CONSTRAINT PersonCredential_PK PRIMARY KEY (id),
|
||||
CONSTRAINT PersonCredential_FK FOREIGN KEY (person_id) REFERENCES Persons(id) ON DELETE CASCADE,
|
||||
CONSTRAINT PersonCredential_FK_1 FOREIGN KEY (provider_id) REFERENCES PersonCredentialProvider(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX PersonCredential_person_id_IDX ON PersonCredential (person_id);
|
||||
CREATE INDEX PersonCredential_provider_id_IDX ON PersonCredential (provider_id);
|
||||
CREATE INDEX PersonCredential_is_enabled_IDX ON PersonCredential (is_enabled);
|
||||
```
|
||||
|
||||
# PersonLocal
|
||||
The PersonLocal table will contain hashed and salted passwords for users authenticating via PersonCredentialProvider.Local type provider
|
||||
|
||||
``` sql
|
||||
CREATE TABLE PersonLocal (
|
||||
person_id TEXT(36),
|
||||
hash TEXT,
|
||||
modified_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
CONSTRAINT PersonLocal_PK PRIMARY KEY (person_id),
|
||||
CONSTRAINT PersonLocal_FK FOREIGN KEY (person_id) REFERENCES Persons(id) ON DELETE CASCADE
|
||||
);
|
||||
```
|
||||
|
||||
# Tags
|
||||
The Tags table will contain tags for categorization of other entities. Tags use the originating host and the tag name as a composite key to allow for us to search for commonalities across instances (for example, "show me Albums matching *::tag::jazz" to see all the jazz albums this instance is aware of, "show me Albums matching sundog-isle.reclaim.technology::tag::jazz" to see only albums tagged as jazz on that one specific instance named in the host field).
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Tags (
|
||||
id TEXT(36),
|
||||
host TEXT,
|
||||
tag TEXT,
|
||||
CONSTRAINT Tags_PK PRIMARY KEY (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX Tags_host_IDX ON Tags (host,tag);
|
||||
```
|
||||
|
||||
# Labels
|
||||
The Labels table will contain data about record labels/imprints that manage one or more Artists and their content.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Labels (
|
||||
id TEXT(36),
|
||||
name TEXT,
|
||||
description TEXT,
|
||||
website TEXT,
|
||||
is_enabled INTEGER DEFAULT (1),
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
modified_at INTEGER,
|
||||
deleted_by TEXT(36),
|
||||
deleted_at INTEGER,
|
||||
CONSTRAINT Labels_PK PRIMARY KEY (id),
|
||||
CONSTRAINT Labels_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Labels_FK_1 FOREIGN KEY (modified_at) REFERENCES Persons(id),
|
||||
CONSTRAINT Labels_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX Labels_name_IDX ON Labels (name);
|
||||
CREATE INDEX Labels_description_IDX ON Labels (description);
|
||||
CREATE INDEX Labels_is_enabled_IDX ON Labels (is_enabled);
|
||||
CREATE INDEX Labels_created_by_IDX ON Labels (created_by);
|
||||
CREATE INDEX Labels_deleted_at_IDX ON Labels (deleted_at);
|
||||
```
|
||||
|
||||
# LabelContacts
|
||||
The LabelContacts table will contain key-value pairs of methods to contact representatives of the Label (for example, "fediverse: sundog@toot-lab.reclaim.technology" or "email: sundog@reclaim.technology").
|
||||
|
||||
``` sql
|
||||
CREATE TABLE LabelContacts (
|
||||
id TEXT(36),
|
||||
label_id TEXT(36),
|
||||
"method" TEXT,
|
||||
address TEXT,
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
modified_at INTEGER,
|
||||
deleted_by TEXT(36),
|
||||
deleted_at INTEGER,
|
||||
sort_order INTEGER,
|
||||
CONSTRAINT LabelContacts_PK PRIMARY KEY (id),
|
||||
CONSTRAINT LabelContacts_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT LabelContacts_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
|
||||
CONSTRAINT LabelContacts_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id),
|
||||
CONSTRAINT LabelContacts_FK_3 FOREIGN KEY (label_id) REFERENCES Labels(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX LabelContacts_sort_order_IDX ON LabelContacts (sort_order);
|
||||
```
|
||||
|
||||
# LabelTags
|
||||
The LabelTags table will contain Tags that have been assigned to a Label.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE LabelTags (
|
||||
label_id TEXT(36),
|
||||
tag_id TEXT(36),
|
||||
is_approved INTEGER DEFAULT (0),
|
||||
CONSTRAINT LabelTags_PK PRIMARY KEY (label_id,tag_id),
|
||||
CONSTRAINT LabelTags_FK FOREIGN KEY (label_id) REFERENCES Labels(id) ON DELETE CASCADE,
|
||||
CONSTRAINT LabelTags_FK_1 FOREIGN KEY (tag_id) REFERENCES Tags(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX LabelTags_is_approved_IDX ON LabelTags (is_approved);
|
||||
CREATE INDEX LabelTags_tag_id_IDX ON LabelTags (tag_id);
|
||||
CREATE INDEX LabelTags_label_id_IDX ON LabelTags (label_id);
|
||||
```
|
||||
|
||||
# Artists
|
||||
The Artists table will contain Artists!
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Artists (
|
||||
id TEXT(36),
|
||||
name TEXT,
|
||||
bio TEXT,
|
||||
website TEXT,
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
modified_at INTEGER,
|
||||
deleted_by TEXT(36),
|
||||
deleted_at INTEGER,
|
||||
is_enabled INTEGER DEFAULT (1),
|
||||
is_public INTEGER DEFAULT (1),
|
||||
CONSTRAINT Artists_PK PRIMARY KEY (id),
|
||||
CONSTRAINT Artists_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Artists_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Artists_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX Artists_name_IDX ON Artists (name);
|
||||
CREATE INDEX Artists_is_enabled_IDX ON Artists (is_enabled);
|
||||
CREATE INDEX Artists_is_public_IDX ON Artists (is_public);
|
||||
```
|
||||
|
||||
# ArtistContacts
|
||||
The ArtistContacts tablekey-value pairs of methods to contact representatives of the Artist (for example, "fediverse: sundog@toot-lab.reclaim.technology" or "email: sundog@reclaim.technology").
|
||||
|
||||
``` sql
|
||||
CREATE TABLE ArtistContacts (
|
||||
id TEXT(36),
|
||||
artist_id TEXT(36),
|
||||
"method" TEXT,
|
||||
address TEXT,
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
modified_at INTEGER,
|
||||
deleted_by TEXT(36),
|
||||
deleted_at INTEGER,
|
||||
sort_order INTEGER,
|
||||
CONSTRAINT ArtistContacts_PK PRIMARY KEY (id),
|
||||
CONSTRAINT ArtistContacts_FK FOREIGN KEY (artist_id) REFERENCES Artists(id) ON DELETE CASCADE
|
||||
CONSTRAINT ArtistContacts_FK_1 FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT ArtistContacts_FK_2 FOREIGN KEY (modified_by) REFERENCES Persons(id),
|
||||
CONSTRAINT ArtistContacts_FK_3 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX ArtistContacts_artist_id_IDX ON ArtistContacts (artist_id);
|
||||
CREATE INDEX ArtistContacts_deleted_at_IDX ON ArtistContacts (deleted_at);
|
||||
CREATE INDEX ArtistContacts_sort_order_IDX ON ArtistContacts (sort_order);
|
||||
```
|
||||
|
||||
# ArtistTags
|
||||
The ArtistTags table will contain Tags that have been assigned to an Artist.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE ArtistTags (
|
||||
artist_id TEXT(36),
|
||||
tag_id TEXT(36),
|
||||
is_approved INTEGER DEFAULT (0),
|
||||
CONSTRAINT ArtistTags_PK PRIMARY KEY (artist_id,tag_id),
|
||||
CONSTRAINT ArtistTags_FK FOREIGN KEY (artist_id) REFERENCES Artists(id) ON DELETE CASCADE,
|
||||
CONSTRAINT ArtistTags_FK_1 FOREIGN KEY (tag_id) REFERENCES Tags(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX ArtistTags_is_approved_IDX ON ArtistTags (is_approved);
|
||||
CREATE INDEX ArtistTags_artist_id_IDX ON ArtistTags (artist_id);
|
||||
CREATE INDEX ArtistTags_tag_id_IDX ON ArtistTags (tag_id);
|
||||
```
|
||||
|
||||
# Tracks
|
||||
The Tracks table will contain Tracks!
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Tracks (
|
||||
id TEXT(36),
|
||||
title TEXT,
|
||||
description TEXT,
|
||||
duration REAL,
|
||||
is_public INTEGER,
|
||||
is_available INTEGER DEFAULT (1),
|
||||
preview_source TEXT,
|
||||
"source" TEXT,
|
||||
price INTEGER DEFAULT (0),
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
modified_at INTEGER,
|
||||
deleted_by TEXT(36),
|
||||
deleted_at INTEGER,
|
||||
lyrics TEXT,
|
||||
CONSTRAINT Tracks_PK PRIMARY KEY (id),
|
||||
CONSTRAINT Tracks_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Tracks_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Tracks_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX Tracks_title_IDX ON Tracks (title);
|
||||
CREATE INDEX Tracks_duration_IDX ON Tracks (duration);
|
||||
CREATE INDEX Tracks_is_public_IDX ON Tracks (is_public);
|
||||
CREATE INDEX Tracks_is_available_IDX ON Tracks (is_available);
|
||||
CREATE INDEX Tracks_price_IDX ON Tracks (price);
|
||||
CREATE INDEX Tracks_created_by_IDX ON Tracks (created_by);
|
||||
CREATE INDEX Tracks_deleted_at_IDX ON Tracks (deleted_at);
|
||||
CREATE INDEX Tracks_lyrics_IDX ON Tracks (lyrics);
|
||||
```
|
||||
|
||||
# TrackArtists
|
||||
The TrackArtists table will be a one-to-many lookup table mapping Artists to a particular Track.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE TrackArtists (
|
||||
track_id TEXT(36),
|
||||
artist_id TEXT(36),
|
||||
is_primary INTEGER DEFAULT (0),
|
||||
CONSTRAINT TrackArtists_PK PRIMARY KEY (track_id,artist_id),
|
||||
CONSTRAINT TrackArtists_FK FOREIGN KEY (track_id) REFERENCES Tracks(id) ON DELETE CASCADE,
|
||||
CONSTRAINT TrackArtists_FK_1 FOREIGN KEY (artist_id) REFERENCES Artists(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX TrackArtists_is_primary_IDX ON TrackArtists (is_primary);
|
||||
CREATE INDEX TrackArtists_track_id_IDX ON TrackArtists (track_id);
|
||||
CREATE INDEX TrackArtists_artist_id_IDX ON TrackArtists (artist_id);
|
||||
```
|
||||
|
||||
# TrackTags
|
||||
The TrackTags table will contain Tags that have been assigned to a Track.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE TrackTags (
|
||||
track_id TEXT(36),
|
||||
tag_id TEXT(36),
|
||||
is_approved INTEGER DEFAULT (0),
|
||||
CONSTRAINT TrackTags_PK PRIMARY KEY (track_id,tag_id),
|
||||
CONSTRAINT TrackTags_FK FOREIGN KEY (track_id) REFERENCES Tracks(id) ON DELETE CASCADE,
|
||||
CONSTRAINT TrackTags_FK_1 FOREIGN KEY (tag_id) REFERENCES Tags(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX TrackTags_is_approved_IDX ON TrackTags (is_approved);
|
||||
CREATE INDEX TrackTags_track_id_IDX ON TrackTags (track_id);
|
||||
CREATE INDEX TrackTags_tag_id_IDX ON TrackTags (tag_id);
|
||||
```
|
||||
|
||||
# Albums
|
||||
The Albums table will contain Albums!
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Albums (
|
||||
id TEXT(36),
|
||||
title TEXT,
|
||||
description TEXT,
|
||||
is_public INTEGER DEFAULT (0),
|
||||
is_available INTEGER DEFAULT (1),
|
||||
preview_source TEXT,
|
||||
"source" TEXT,
|
||||
price INTEGER DEFAULT (0),
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
modified_at INTEGER,
|
||||
deleted_by TEXT(36),
|
||||
deleted_at INTEGER,
|
||||
CONSTRAINT Albums_PK PRIMARY KEY (id),
|
||||
CONSTRAINT Albums_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Albums_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Albums_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX Albums_title_IDX ON Albums (title);
|
||||
CREATE INDEX Albums_description_IDX ON Albums (description);
|
||||
CREATE INDEX Albums_is_public_IDX ON Albums (is_public);
|
||||
CREATE INDEX Albums_is_available_IDX ON Albums (is_available);
|
||||
CREATE INDEX Albums_price_IDX ON Albums (price);
|
||||
CREATE INDEX Albums_created_by_IDX ON Albums (created_by);
|
||||
CREATE INDEX Albums_deleted_at_IDX ON Albums (deleted_at);
|
||||
```
|
||||
|
||||
# AlbumArtists
|
||||
The AlbumArtists table will be a one-to-many lookup table mapping Artists to a particular Album.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE AlbumArtists (
|
||||
album_id TEXT(36),
|
||||
artist_id TEXT(36),
|
||||
is_primary INTEGER DEFAULT (0),
|
||||
CONSTRAINT AlbumArtists_PK PRIMARY KEY (album_id,artist_id),
|
||||
CONSTRAINT AlbumArtists_FK FOREIGN KEY (album_id) REFERENCES Albums(id) ON DELETE CASCADE,
|
||||
CONSTRAINT AlbumArtists_FK_1 FOREIGN KEY (artist_id) REFERENCES Artists(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX AlbumArtists_is_primary_IDX ON AlbumArtists (is_primary);
|
||||
CREATE INDEX AlbumArtists_album_id_IDX ON AlbumArtists (album_id);
|
||||
CREATE INDEX AlbumArtists_artist_id_IDX ON AlbumArtists (artist_id);
|
||||
```
|
||||
|
||||
# AlbumTags
|
||||
The AlbumTags table will contain Tags that have been assigned to an Album.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE AlbumTags (
|
||||
album_id TEXT(36),
|
||||
tag_id TEXT(36),
|
||||
is_approved INTEGER DEFAULT (0),
|
||||
CONSTRAINT AlbumTags_PK PRIMARY KEY (album_id,tag_id),
|
||||
CONSTRAINT AlbumTags_FK FOREIGN KEY (album_id) REFERENCES Albums(id) ON DELETE CASCADE,
|
||||
CONSTRAINT AlbumTags_FK_1 FOREIGN KEY (tag_id) REFERENCES Tags(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX AlbumTags_is_approved_IDX ON AlbumTags (is_approved);
|
||||
CREATE INDEX AlbumTags_album_id_IDX ON AlbumTags (album_id);
|
||||
CREATE INDEX AlbumTags_tag_id_IDX ON AlbumTags (tag_id);
|
||||
```
|
||||
|
||||
# AlbumTracks
|
||||
The AlbumTracks table will be a many-to-many lookup table mapping Tracks to Albums
|
||||
|
||||
``` sql
|
||||
CREATE TABLE AlbumTracks (
|
||||
album_id TEXT(36),
|
||||
track_id TEXT(36),
|
||||
track_number INTEGER,
|
||||
CONSTRAINT AlbumTracks_PK PRIMARY KEY (album_id,track_id),
|
||||
CONSTRAINT AlbumTracks_FK FOREIGN KEY (album_id) REFERENCES Albums(id) ON DELETE CASCADE,
|
||||
CONSTRAINT AlbumTracks_FK_1 FOREIGN KEY (track_id) REFERENCES Tracks(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX AlbumTracks_track_number_IDX ON AlbumTracks (track_number);
|
||||
CREATE INDEX AlbumTracks_album_id_IDX ON AlbumTracks (album_id);
|
||||
CREATE INDEX AlbumTracks_track_id_IDX ON AlbumTracks (track_id);
|
||||
```
|
||||
|
||||
# Playlists
|
||||
The Playlists table will contain Playlists!
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Playlists (
|
||||
id TEXT(36),
|
||||
title TEXT,
|
||||
description TEXT,
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_at INTEGER,
|
||||
deleted_at INTEGER,
|
||||
is_public INTEGER DEFAULT (1),
|
||||
CONSTRAINT Playlists_PK PRIMARY KEY (id),
|
||||
CONSTRAINT Playlists_FK FOREIGN KEY (created_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX Playlists_title_IDX ON Playlists (title);
|
||||
CREATE INDEX Playlists_description_IDX ON Playlists (description);
|
||||
CREATE INDEX Playlists_created_by_IDX ON Playlists (created_by);
|
||||
CREATE INDEX Playlists_created_at_IDX ON Playlists (created_at);
|
||||
CREATE INDEX Playlists_modified_at_IDX ON Playlists (modified_at);
|
||||
CREATE INDEX Playlists_deleted_at_IDX ON Playlists (deleted_at);
|
||||
CREATE INDEX Playlists_is_public_IDX ON Playlists (is_public);
|
||||
```
|
||||
|
||||
# PlaylistTracks
|
||||
The PlaylistTracks table will be a many-to-many lookup table mapping Tracks to Playlists
|
||||
|
||||
``` sql
|
||||
CREATE TABLE PlaylistTracks (
|
||||
playlist_track_id TEXT(36),
|
||||
playlist_id TEXT(36),
|
||||
track_id TEXT,
|
||||
track_number INTEGER,
|
||||
CONSTRAINT PlaylistTracks_PK PRIMARY KEY (playlist_track_id),
|
||||
CONSTRAINT PlaylistTracks_FK FOREIGN KEY (playlist_id) REFERENCES Playlists(id) ON DELETE CASCADE,
|
||||
CONSTRAINT PlaylistTracks_FK_1 FOREIGN KEY (track_id) REFERENCES Tracks(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX PlaylistTracks_track_number_IDX ON PlaylistTracks (track_number);
|
||||
CREATE INDEX PlaylistTracks_playlist_id_IDX ON PlaylistTracks (playlist_id);
|
||||
CREATE INDEX PlaylistTracks_track_id_IDX ON PlaylistTracks (track_id);
|
||||
```
|
||||
|
||||
# PlaylistTags
|
||||
The PlaylistTags table will contain Tags that have been assigned to a Playlist.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE PlaylistTags (
|
||||
playlist_id TEXT(36),
|
||||
tag_id TEXT(36),
|
||||
is_approved INTEGER DEFAULT (0),
|
||||
CONSTRAINT PlaylistTags_PK PRIMARY KEY (playlist_id,tag_id),
|
||||
CONSTRAINT PlaylistTags_FK FOREIGN KEY (playlist_id) REFERENCES Playlists(id) ON DELETE CASCADE,
|
||||
CONSTRAINT PlaylistTags_FK_1 FOREIGN KEY (tag_id) REFERENCES Tags(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX PlaylistTags_is_approved_IDX ON PlaylistTags (is_approved);
|
||||
CREATE INDEX PlaylistTags_playlist_id_IDX ON PlaylistTags (playlist_id);
|
||||
CREATE INDEX PlaylistTags_tag_id_IDX ON PlaylistTags (tag_id);
|
||||
```
|
||||
|
||||
# Comments
|
||||
The Comments table will contain Comments!
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Comments (
|
||||
id TEXT(36),
|
||||
body 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 (1),
|
||||
is_approved INTEGER DEFAULT (0),
|
||||
in_reply_to TEXT(36),
|
||||
CONSTRAINT Comments_PK PRIMARY KEY (id),
|
||||
CONSTRAINT Comments_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Comments_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Comments_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX Comments_body_IDX ON Comments (body);
|
||||
CREATE INDEX Comments_created_at_IDX ON Comments (created_at);
|
||||
CREATE INDEX Comments_modified_at_IDX ON Comments (modified_at);
|
||||
CREATE INDEX Comments_deleted_at_IDX ON Comments (deleted_at);
|
||||
CREATE INDEX Comments_is_public_IDX ON Comments (is_public);
|
||||
CREATE INDEX Comments_is_approved_IDX ON Comments (is_approved);
|
||||
CREATE INDEX Comments_in_reply_to_IDX ON Comments (in_reply_to);
|
||||
```
|
||||
|
||||
# LabelComments
|
||||
The LabelComments table will relate Comments to the Label they are about, if pertinent.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE LabelComments (
|
||||
label_id TEXT(36),
|
||||
comment_id TEXT(36),
|
||||
CONSTRAINT LabelComments_PK PRIMARY KEY (label_id,comment_id),
|
||||
CONSTRAINT LabelComments_FK FOREIGN KEY (label_id) REFERENCES Labels(id) ON DELETE CASCADE,
|
||||
CONSTRAINT LabelComments_FK_1 FOREIGN KEY (comment_id) REFERENCES Comments(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX LabelComments_label_id_IDX ON LabelComments (label_id);
|
||||
CREATE INDEX LabelComments_comment_id_IDX ON LabelComments (comment_id);
|
||||
```
|
||||
|
||||
# ArtistComments
|
||||
The ArtistComments table will relate Comments to the Artist they are about, if pertinent.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE ArtistComments (
|
||||
artist_id TEXT(36),
|
||||
comment_id TEXT(36),
|
||||
CONSTRAINT ArtistComments_PK PRIMARY KEY (artist_id,comment_id),
|
||||
CONSTRAINT ArtistComments_FK FOREIGN KEY (artist_id) REFERENCES Artists(id) ON DELETE CASCADE,
|
||||
CONSTRAINT ArtistComments_FK_1 FOREIGN KEY (comment_id) REFERENCES Comments(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX ArtistComments_artist_id_IDX ON ArtistComments (artist_id);
|
||||
CREATE INDEX ArtistComments_comment_id_IDX ON ArtistComments (comment_id);
|
||||
```
|
||||
|
||||
# TrackComments
|
||||
The TrackComments table will relate Comments to the Track they are about, if pertinent.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE TrackComments (
|
||||
track_id TEXT(36),
|
||||
comment_id TEXT(36),
|
||||
CONSTRAINT TrackComments_PK PRIMARY KEY (track_id,comment_id),
|
||||
CONSTRAINT TrackComments_FK FOREIGN KEY (track_id) REFERENCES Tracks(id) ON DELETE CASCADE,
|
||||
CONSTRAINT TrackComments_FK_1 FOREIGN KEY (comment_id) REFERENCES Comments(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX TrackComments_track_id_IDX ON TrackComments (track_id);
|
||||
CREATE INDEX TrackComments_comment_id_IDX ON TrackComments (comment_id);
|
||||
```
|
||||
|
||||
# AlbumComments
|
||||
The AlbumComments table will relate Comments to the Album they are about, if pertinent.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE AlbumComments (
|
||||
album_id TEXT(36),
|
||||
comment_id TEXT(36),
|
||||
CONSTRAINT AlbumComments_PK PRIMARY KEY (album_id,comment_id),
|
||||
CONSTRAINT AlbumComments_FK FOREIGN KEY (album_id) REFERENCES Albums(id) ON DELETE CASCADE,
|
||||
CONSTRAINT AlbumComments_FK_1 FOREIGN KEY (comment_id) REFERENCES Comments(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX AlbumComments_album_id_IDX ON AlbumComments (album_id);
|
||||
CREATE INDEX AlbumComments_comment_id_IDX ON AlbumComments (comment_id);
|
||||
```
|
||||
|
||||
# PlaylistComments
|
||||
The PlaylistComments table will relate Comments to the Playlist they are about, if pertinent.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE PlaylistComments (
|
||||
playlist_id TEXT(36),
|
||||
comment_id TEXT(36),
|
||||
CONSTRAINT PlaylistComments_PK PRIMARY KEY (playlist_id,comment_id),
|
||||
CONSTRAINT PlaylistComments_FK FOREIGN KEY (playlist_id) REFERENCES Playlists(id) ON DELETE CASCADE,
|
||||
CONSTRAINT PlaylistComments_FK_1 FOREIGN KEY (comment_id) REFERENCES Comments(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX PlaylistComments_playlist_id_IDX ON PlaylistComments (playlist_id);
|
||||
CREATE INDEX PlaylistComments_comment_id_IDX ON PlaylistComments (comment_id);
|
||||
```
|
||||
|
||||
# Images
|
||||
The Images table will contain Images!
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Images (
|
||||
id TEXT(36),
|
||||
name TEXT,
|
||||
"path" TEXT,
|
||||
url TEXT,
|
||||
width INTEGER,
|
||||
height INTEGER,
|
||||
alt_text TEXT,
|
||||
is_public INTEGER DEFAULT (1),
|
||||
allow_hotlinking INTEGER DEFAULT (0),
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
modified_at INTEGER,
|
||||
deleted_by TEXT(36),
|
||||
deleted_at INTEGER,
|
||||
CONSTRAINT Images_PK PRIMARY KEY (id),
|
||||
CONSTRAINT Images_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Images_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Images_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX Images_name_IDX ON Images (name);
|
||||
CREATE INDEX Images_path_IDX ON Images ("path");
|
||||
CREATE INDEX Images_url_IDX ON Images (url);
|
||||
CREATE INDEX Images_alt_text_IDX ON Images (alt_text);
|
||||
CREATE INDEX Images_is_public_IDX ON Images (is_public);
|
||||
CREATE INDEX Images_allow_hotlinking_IDX ON Images (allow_hotlinking);
|
||||
CREATE INDEX Images_created_by_IDX ON Images (created_by);
|
||||
CREATE INDEX Images_deleted_at_IDX ON Images (deleted_at);
|
||||
```
|
||||
|
||||
# Videos
|
||||
The Videos table will contain Videos!
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Videos (
|
||||
id TEXT(36),
|
||||
name TEXT,
|
||||
"path" TEXT,
|
||||
url TEXT,
|
||||
width INTEGER,
|
||||
height INTEGER,
|
||||
duration NUMERIC,
|
||||
alt_text TEXT,
|
||||
is_public INTEGER DEFAULT (1),
|
||||
allow_hotlinking INTEGER DEFAULT (0),
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
modified_at INTEGER,
|
||||
deleted_by TEXT(36),
|
||||
deleted_at INTEGER,
|
||||
CONSTRAINT Videos_PK PRIMARY KEY (id),
|
||||
CONSTRAINT Videos_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Videos_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
|
||||
CONSTRAINT Videos_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX Videos_name_IDX ON Videos (name);
|
||||
CREATE INDEX Videos_path_IDX ON Videos ("path");
|
||||
CREATE INDEX Videos_url_IDX ON Videos (url);
|
||||
CREATE INDEX Videos_alt_text_IDX ON Videos (alt_text);
|
||||
CREATE INDEX Videos_is_public_IDX ON Videos (is_public);
|
||||
CREATE INDEX Videos_allow_hotlinking_IDX ON Videos (allow_hotlinking);
|
||||
CREATE INDEX Videos_created_by_IDX ON Videos (created_by);
|
||||
CREATE INDEX Videos_deleted_at_IDX ON Videos (deleted_at);
|
||||
```
|
||||
|
||||
# Articles
|
||||
The Articles table will contain Articles!
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Articles (
|
||||
id TEXT(36),
|
||||
title TEXT,
|
||||
body TEXT,
|
||||
description TEXT,
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_at INTEGER,
|
||||
published_at INTEGER,
|
||||
deleted_at INTEGER,
|
||||
is_public INTEGER DEFAULT (0),
|
||||
is_draft INTEGER DEFAULT (1),
|
||||
CONSTRAINT Articles_PK PRIMARY KEY (id),
|
||||
CONSTRAINT Articles_FK FOREIGN KEY (created_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX Articles_title_IDX ON Articles (title);
|
||||
CREATE INDEX Articles_body_IDX ON Articles (body);
|
||||
CREATE INDEX Articles_description_IDX ON Articles (description);
|
||||
CREATE INDEX Articles_created_by_IDX ON Articles (created_by);
|
||||
CREATE INDEX Articles_published_at_IDX ON Articles (published_at);
|
||||
CREATE INDEX Articles_deleted_at_IDX ON Articles (deleted_at);
|
||||
CREATE INDEX Articles_is_public_IDX ON Articles (is_public);
|
||||
CREATE INDEX Articles_is_draft_IDX ON Articles (is_draft);
|
||||
```
|
||||
|
||||
# ArticleTags
|
||||
The ArticleTags table will contain Tags that have been assigned to an Article.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE ArticleTags (
|
||||
article_id TEXT(36),
|
||||
tag_id TEXT(36),
|
||||
is_approved INTEGER DEFAULT (0),
|
||||
CONSTRAINT ArticleTags_PK PRIMARY KEY (article_id,tag_id),
|
||||
CONSTRAINT ArticleTags_FK FOREIGN KEY (article_id) REFERENCES Articles(id) ON DELETE CASCADE,
|
||||
CONSTRAINT ArticleTags_FK_1 FOREIGN KEY (tag_id) REFERENCES Tags(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX ArticleTags_is_approved_IDX ON ArticleTags (is_approved);
|
||||
```
|
||||
|
||||
# ArticleComments
|
||||
The ArticleComments table will relate Comments to the Article they are about, if pertinent.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE ArticleComments (
|
||||
article_id TEXT(36),
|
||||
comment_id TEXT(36),
|
||||
CONSTRAINT ArticleComments_PK PRIMARY KEY (article_id,comment_id),
|
||||
CONSTRAINT ArticleComments_FK FOREIGN KEY (article_id) REFERENCES Articles(id) ON DELETE CASCADE,
|
||||
CONSTRAINT ArticleComments_FK_1 FOREIGN KEY (comment_id) REFERENCES Comments(id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX ArticleComments_article_id_IDX ON ArticleComments (article_id);
|
||||
CREATE INDEX ArticleComments_comment_id_IDX ON ArticleComments (comment_id);
|
||||
```
|
||||
|
||||
# OtherProducts
|
||||
The OtherProducts table will contain products for sale that are not Albums nor Tracks nor Collections.
|
||||
|
||||
``` 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);
|
||||
```
|
||||
|
||||
# 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.
|
||||
|
||||
``` 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);
|
||||
```
|
||||
|
||||
# CollectionAlbums
|
||||
The CollectionAlbums table will relate a Collection to the Album(s) it contains.
|
||||
|
||||
``` 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);
|
||||
```
|
||||
|
||||
# CollectionTracks
|
||||
The CollectionTracks table will relate a Collection to the Track(s) it contains.
|
||||
|
||||
``` 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);
|
||||
```
|
||||
|
||||
# CollectionOtherProducts
|
||||
The CollectionOtherProducts table will relate a Collection to the OtherProduct(s) it contains.
|
||||
|
||||
``` 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);
|
||||
```
|
||||
|
||||
# Skus
|
||||
The Skus table will contain SKUs () representing items available for Purchase through the server.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE Skus (
|
||||
id TEXT(36),
|
||||
item_type TEXT,
|
||||
item_id TEXT(36),
|
||||
variant TEXT,
|
||||
description TEXT,
|
||||
price NUMERIC DEFAULT (0.00),
|
||||
requires_shipping INTEGER DEFAULT (0),
|
||||
shipping_charge NUMERIC DEFAULT (0.00),
|
||||
CONSTRAINT Skus_PK PRIMARY KEY (id)
|
||||
);
|
||||
CREATE INDEX Skus_item_type_IDX ON Skus (item_type);
|
||||
CREATE INDEX Skus_item_id_IDX ON Skus (item_id);
|
||||
CREATE INDEX Skus_variant_IDX ON Skus (variant);
|
||||
CREATE INDEX Skus_description_IDX ON Skus (description);
|
||||
CREATE INDEX Skus_price_IDX ON Skus (price);
|
||||
CREATE INDEX Skus_requires_shipping_IDX ON Skus (requires_shipping);
|
||||
CREATE INDEX Skus_shipping_charge_IDX ON Skus (shipping_charge);
|
||||
```
|
||||
|
||||
# LineItems
|
||||
The LineItems table will contain individual SKUs and their associated quantites as part of a Purchase.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE LineItems (
|
||||
id TEXT(36),
|
||||
sku_id TEXT(36),
|
||||
quantity INTEGER DEFAULT (1),
|
||||
CONSTRAINT LineItems_PK PRIMARY KEY (id),
|
||||
CONSTRAINT LineItems_FK FOREIGN KEY (sku_id) REFERENCES Skus(id)
|
||||
);
|
||||
CREATE INDEX LineItems_sku_id_IDX ON LineItems (sku_id);
|
||||
CREATE INDEX LineItems_quantity_IDX ON LineItems (quantity);
|
||||
```
|
||||
|
||||
# CouponCodes
|
||||
The CouponCodes table will contain coupon codes that can be redeemed for a discount, either by amount or percentage, on a Purchase.
|
||||
|
||||
``` sql
|
||||
CREATE TABLE CouponCodes (
|
||||
id TEXT(36),
|
||||
name TEXT,
|
||||
code TEXT,
|
||||
uses INTEGER DEFAULT (0),
|
||||
max_uses INTEGER DEFAULT (0),
|
||||
expiration INTEGER,
|
||||
discount_flat NUMERIC DEFAULT (0.00),
|
||||
discount_percentage NUMERIC DEFAULT (0.00),
|
||||
is_sku_specific INTEGER DEFAULT (0),
|
||||
is_active INTEGER DEFAULT (0),
|
||||
created_by TEXT(36),
|
||||
created_at INTEGER,
|
||||
modified_by TEXT(36),
|
||||
modified_at INTEGER,
|
||||
deleted_by TEXT(36),
|
||||
deleted_at INTEGER,
|
||||
CONSTRAINT CouponCodes_PK PRIMARY KEY (id),
|
||||
CONSTRAINT CouponCodes_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
|
||||
CONSTRAINT CouponCodes_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
|
||||
CONSTRAINT CouponCodes_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
|
||||
);
|
||||
CREATE INDEX CouponCodes_name_IDX ON CouponCodes (name);
|
||||
CREATE UNIQUE INDEX CouponCodes_code_IDX ON CouponCodes (code);
|
||||
CREATE INDEX CouponCodes_uses_IDX ON CouponCodes (uses);
|
||||
CREATE INDEX CouponCodes_max_uses_IDX ON CouponCodes (max_uses);
|
||||
CREATE INDEX CouponCodes_expiration_IDX ON CouponCodes (expiration);
|
||||
CREATE INDEX CouponCodes_is_sku_specific_IDX ON CouponCodes (is_sku_specific);
|
||||
CREATE INDEX CouponCodes_is_active_IDX ON CouponCodes (is_active);
|
||||
CREATE INDEX CouponCodes_created_by_IDX ON CouponCodes (created_by);
|
||||
CREATE INDEX CouponCodes_created_at_IDX ON CouponCodes (created_at);
|
||||
CREATE INDEX CouponCodes_modified_by_IDX ON CouponCodes (modified_by);
|
||||
CREATE INDEX CouponCodes_modified_at_IDX ON CouponCodes (modified_at);
|
||||
CREATE INDEX CouponCodes_deleted_by_IDX ON CouponCodes (deleted_by);
|
||||
CREATE INDEX CouponCodes_deleted_at_IDX ON CouponCodes (deleted_at);
|
||||
```
|
||||
|
||||
# CouponCodeSkus
|
||||
The CouponCodeSkus table will relate a CouponCode to one or more Skus the CouponCode can be applied to, if CouponCode.is_sku_specific is true. (If CouponCode.is_sku_specific is false the CouponCode can be applied to an entire Purchase regardless of the Skus being purchased.)
|
||||
|
||||
``` sql
|
||||
CREATE TABLE CouponCodeSkus (
|
||||
coupon_code_id TEXT(36),
|
||||
sku_id TEXT(36),
|
||||
CONSTRAINT CouponCodeSkus_PK PRIMARY KEY (coupon_code_id,sku_id),
|
||||
CONSTRAINT CouponCodeSkus_FK FOREIGN KEY (coupon_code_id) REFERENCES CouponCodes(id),
|
||||
CONSTRAINT CouponCodeSkus_FK_1 FOREIGN KEY (sku_id) REFERENCES Skus(id)
|
||||
);
|
||||
```
|
7
ci/Dockerfile
Normal file
7
ci/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM rust:1.73-alpine3.18
|
||||
|
||||
#install build tooling
|
||||
RUN apk add musl-dev && rustup component add rustfmt
|
||||
|
||||
# install gitea act_runner dependencies
|
||||
RUN apk add nodejs git
|
@ -2,10 +2,7 @@ use warp::Filter;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let hello = warp::get()
|
||||
.map(|| format!("Hello world!"));
|
||||
let hello = warp::get().map(|| format!("Hello world!"));
|
||||
|
||||
warp::serve(hello)
|
||||
.run(([127, 0, 0, 1], 5309))
|
||||
.await;
|
||||
}
|
||||
warp::serve(hello).run(([127, 0, 0, 1], 5309)).await;
|
||||
}
|
||||
|
Reference in New Issue
Block a user