forked from all-in-aigc/melodisco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sql
96 lines (90 loc) · 2.34 KB
/
install.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
CREATE TABLE users (
id SERIAL PRIMARY KEY,
uuid VARCHAR(255) UNIQUE NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
created_at timestamptz,
nickname VARCHAR(255),
avatar_url VARCHAR(255),
locale VARCHAR(50),
signin_type VARCHAR(50),
signin_ip VARCHAR(255),
signin_provider VARCHAR(50),
signin_openid VARCHAR(255)
);
CREATE TABLE songs (
id SERIAL PRIMARY KEY,
uuid VARCHAR(255) UNIQUE NOT NULL,
video_url VARCHAR(255),
audio_url VARCHAR(255),
image_url VARCHAR(255),
image_large_url VARCHAR(255),
llm_model VARCHAR(50),
tags VARCHAR(255),
lyrics TEXT,
description TEXT,
duration DOUBLE PRECISION,
type VARCHAR(50),
user_uuid VARCHAR(255),
title VARCHAR(255),
play_count INT,
upvote_count INT,
created_at timestamptz,
status VARCHAR(50),
is_public BOOLEAN,
is_trending BOOLEAN,
provider VARCHAR(50),
artist VARCHAR(100),
prompt TEXT
);
CREATE TABLE favorite_songs (
song_uuid VARCHAR(255) NOT NULL,
user_uuid VARCHAR(255) NOT NULL,
created_at timestamptz,
updated_at timestamptz,
status VARCHAR(50),
CONSTRAINT unique_favorite_song UNIQUE (song_uuid, user_uuid)
);
CREATE TABLE play_songs (
song_uuid VARCHAR(255) NOT NULL,
user_uuid VARCHAR(255) NOT NULL,
created_at timestamptz
);
CREATE TABLE upvote_songs (
song_uuid VARCHAR(255) NOT NULL,
user_uuid VARCHAR(255) NOT NULL,
created_at timestamptz,
updated_at timestamptz,
is_signin BOOLEAN,
status VARCHAR(50)
)
CREATE TABLE song_tasks (
uuid VARCHAR(255) UNIQUE NOT NULL,
user_uuid VARCHAR(255) NOT NULL,
created_at timestamptz,
updated_at timestamptz,
status VARCHAR(50),
description TEXT,
title VARCHAR(255),
lyrics TEXT,
tags VARCHAR(255),
is_no_lyrics BOOLEAN,
lyrics_provider VARCHAR(50),
lyrics_uuid VARCHAR(50),
song_provider VARCHAR(50),
song_model VARCHAR(50),
song_uuids TEXT
);
CREATE TABLE orders (
order_no VARCHAR(255) UNIQUE NOT NULL,
created_at timestamptz,
user_uuid VARCHAR(255) NOT NULL,
user_email VARCHAR(255) NOT NULL,
amount INT NOT NULL,
plan VARCHAR(50),
expired_at timestamptz,
order_status SMALLINT NOT NULL,
paied_at timestamptz,
stripe_session_id VARCHAR(255),
credits INT NOT NULL,
currency VARCHAR(50)
);