You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
764 B
31 lines
764 B
from database import DB as db
|
|
|
|
|
|
def init():
|
|
db.create_table(
|
|
"artists",
|
|
[
|
|
("id", "SERIAL", "PRIMARY KEY"),
|
|
("name", "TEXT", "NOT NULL"),
|
|
("url", "TEXT", "UNIQUE"),
|
|
("thumbnail", "BYTEA", ""),
|
|
("json", "JSON", ""),
|
|
],
|
|
primary_key="id",
|
|
)
|
|
|
|
db.create_table(
|
|
"albums",
|
|
[
|
|
("id", "SERIAL", "PRIMARY KEY"),
|
|
("artist_id", "SERIAL", "REFERENCES artists(id) ON DELETE CASCADE"),
|
|
("name", "TEXT", "NOT NULL"),
|
|
("url", "TEXT", "UNIQUE"),
|
|
("thumbnail", "BYTEA", ""),
|
|
("done", "BOOLEAN", ""),
|
|
("json", "JSON", ""),
|
|
],
|
|
primary_key="id",
|
|
)
|
|
return True
|