mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
Create Album endpoint
This commit is contained in:
parent
c3fca425cb
commit
967a6d1587
15 changed files with 388 additions and 85 deletions
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `placeholder` on the `albums` table. All the data in the column will be lost.
|
||||
- Made the column `status` on table `albums` required. This step will fail if there are existing NULL values in that column.
|
||||
- Made the column `headerColor` on table `albums` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
DELETE FROM `albums` WHERE `status` = "Published";
|
||||
UPDATE `albums` SET `status` = "Show" WHERE LOWER(`status`) = "show";
|
||||
UPDATE `albums` SET `status` = "Hidden" WHERE LOWER(`status`) = "hidden";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `albums` DROP COLUMN `placeholder`,
|
||||
ADD COLUMN `publishedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
MODIFY `createdAt` DATETIME(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
MODIFY `updatedAt` DATETIME(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
MODIFY `status` ENUM('Show', 'Hidden') NOT NULL DEFAULT 'Hidden',
|
||||
MODIFY `headerColor` VARCHAR(255) NOT NULL DEFAULT '#ffffff';
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `createdAt` on the `artist` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `updatedAt` on the `artist` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `createdAt` on the `discs` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `updatedAt` on the `discs` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `createdAt` on the `downloads` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `updatedAt` on the `downloads` table. All the data in the column will be lost.
|
||||
- You are about to drop the `Album_Type` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `availables` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `type` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Album_Type` DROP FOREIGN KEY `Album_Type_ibfk_1`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Album_Type` DROP FOREIGN KEY `Album_Type_ibfk_2`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `availables` DROP FOREIGN KEY `availables_ibfk_1`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `artist` DROP COLUMN `createdAt`,
|
||||
DROP COLUMN `updatedAt`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `discs` DROP COLUMN `createdAt`,
|
||||
DROP COLUMN `updatedAt`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `downloads` DROP COLUMN `createdAt`,
|
||||
DROP COLUMN `updatedAt`;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `Album_Type`;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `availables`;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `type`;
|
||||
|
|
@ -62,15 +62,6 @@ model Album_Platform {
|
|||
@@id([albumId, platformId])
|
||||
}
|
||||
|
||||
model Album_Type {
|
||||
albumId Int
|
||||
typeId Int
|
||||
album albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Type_ibfk_1")
|
||||
type type @relation(fields: [typeId], references: [id], onDelete: Cascade, map: "Album_Type_ibfk_2")
|
||||
|
||||
@@id([albumId, typeId])
|
||||
}
|
||||
|
||||
model Game_Platform {
|
||||
gameSlug String @db.VarChar(255)
|
||||
platformId Int
|
||||
|
|
@ -127,6 +118,11 @@ model albumHistories {
|
|||
album albums? @relation(fields: [albumId], references: [id], map: "albumHistories_ibfk_2")
|
||||
}
|
||||
|
||||
enum AlbumStatus {
|
||||
SHOW @map("Show")
|
||||
HIDDEN @map("Hidden")
|
||||
}
|
||||
|
||||
model albums {
|
||||
id Int @id @default(autoincrement())
|
||||
title String? @db.VarChar(255)
|
||||
|
|
@ -134,22 +130,20 @@ model albums {
|
|||
releaseDate DateTime? @db.Date
|
||||
label String? @db.VarChar(255)
|
||||
vgmdb String? @db.VarChar(255)
|
||||
createdAt DateTime @db.DateTime(0)
|
||||
updatedAt DateTime @db.DateTime(0)
|
||||
createdAt DateTime @default(now()) @db.DateTime(0)
|
||||
updatedAt DateTime @default(now()) @db.DateTime(0)
|
||||
publishedAt DateTime @default(now())
|
||||
description String? @db.VarChar(255)
|
||||
createdBy String? @db.VarChar(255)
|
||||
status String? @db.VarChar(255)
|
||||
placeholder String? @db.Text
|
||||
headerColor String? @default("#ffffff") @db.VarChar(255)
|
||||
status AlbumStatus @default(HIDDEN)
|
||||
headerColor String @default("#ffffff") @db.VarChar(255)
|
||||
animations Album_Animation[]
|
||||
artists Album_Artist[]
|
||||
categories Album_Category[]
|
||||
classifications Album_Classification[]
|
||||
games Album_Game[]
|
||||
platforms Album_Platform[]
|
||||
types Album_Type[]
|
||||
histories albumHistories[]
|
||||
availables availables[]
|
||||
comments comments[]
|
||||
discs discs[]
|
||||
downloads downloads[]
|
||||
|
|
@ -176,21 +170,9 @@ model animation {
|
|||
}
|
||||
|
||||
model artist {
|
||||
slug String @id @db.VarChar(255)
|
||||
name String? @db.VarChar(255)
|
||||
createdAt DateTime @db.DateTime(0)
|
||||
updatedAt DateTime @db.DateTime(0)
|
||||
albums Album_Artist[]
|
||||
}
|
||||
|
||||
model availables {
|
||||
id Int @id @default(autoincrement())
|
||||
url String? @db.VarChar(255)
|
||||
provider String? @db.VarChar(255)
|
||||
createdAt DateTime @db.DateTime(0)
|
||||
updatedAt DateTime @db.DateTime(0)
|
||||
albumId Int?
|
||||
album albums? @relation(fields: [albumId], references: [id], map: "availables_ibfk_1")
|
||||
slug String @id @db.VarChar(255)
|
||||
name String? @db.VarChar(255)
|
||||
albums Album_Artist[]
|
||||
}
|
||||
|
||||
model category {
|
||||
|
|
@ -227,24 +209,20 @@ model config {
|
|||
}
|
||||
|
||||
model discs {
|
||||
id Int @id @default(autoincrement())
|
||||
number Int?
|
||||
body String? @db.Text
|
||||
createdAt DateTime @db.DateTime(0)
|
||||
updatedAt DateTime @db.DateTime(0)
|
||||
albumId Int
|
||||
album albums? @relation(fields: [albumId], references: [id], map: "discs_ibfk_1")
|
||||
id Int @id @default(autoincrement())
|
||||
number Int?
|
||||
body String? @db.Text
|
||||
albumId Int
|
||||
album albums? @relation(fields: [albumId], references: [id], map: "discs_ibfk_1")
|
||||
}
|
||||
|
||||
model downloads {
|
||||
id Int @id @default(autoincrement())
|
||||
title String? @db.VarChar(255)
|
||||
small Boolean?
|
||||
createdAt DateTime @db.DateTime(0)
|
||||
updatedAt DateTime @db.DateTime(0)
|
||||
albumId Int
|
||||
album albums? @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "downloads_ibfk_1")
|
||||
links links[]
|
||||
id Int @id @default(autoincrement())
|
||||
title String? @db.VarChar(255)
|
||||
small Boolean?
|
||||
albumId Int
|
||||
album albums? @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "downloads_ibfk_1")
|
||||
links links[]
|
||||
}
|
||||
|
||||
model favorites {
|
||||
|
|
@ -425,12 +403,6 @@ model submissions {
|
|||
request requests? @relation(fields: [requestId], references: [id], map: "submissions_ibfk_2")
|
||||
}
|
||||
|
||||
model type {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @db.VarChar(255)
|
||||
albums Album_Type[]
|
||||
}
|
||||
|
||||
model users {
|
||||
id String @id @db.VarChar(255)
|
||||
name String @db.VarChar(20)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue