Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
SunWuyuan committed Sep 22, 2024
1 parent 1f9341c commit f420e11
Show file tree
Hide file tree
Showing 5 changed files with 324 additions and 532 deletions.
81 changes: 25 additions & 56 deletions 1.sql

Large diffs are not rendered by default.

51 changes: 48 additions & 3 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
generator client {
provider = "prisma-client-js"
provider = "prisma-client-js"
previewFeatures = ["views"]
}

datasource db {
Expand Down Expand Up @@ -94,7 +95,7 @@ model ow_projects {
like_count Int? @default(0)
favo_count Int? @default(0)
time DateTime? @default(now()) @db.Timestamp(0)
title String? @default("Scratch新项目") @db.VarChar(50)
title String? @default("Scratch新项目") @db.VarChar(1000)
description String? @default("OurWorld上的Scratch项目") @db.VarChar(1000)
source String? @db.MediumText
history Boolean @default(true)
Expand Down Expand Up @@ -222,7 +223,7 @@ model scratch {

model ow_projects_file {
sha256 String @id @db.VarChar(64)
source String? @db.Text
source String? @db.MediumText
create_time DateTime? @default(now()) @db.DateTime(0)
}

Expand Down Expand Up @@ -325,3 +326,47 @@ model wl_users {
createdAt DateTime? @default(now()) @db.Timestamp(0)
updatedAt DateTime? @default(now()) @db.Timestamp(0)
}

/// The underlying view does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
/// This view or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
view ow_projects_view {
id Int @default(0) @db.UnsignedInt
type String? @default("text") @db.VarChar(32)
licence String? @db.VarChar(32)
authorid Int
state String? @default("private") @db.VarChar(32)
view_count Int? @default(0) @db.UnsignedInt
time DateTime? @db.Timestamp(0)
title String? @default("Scratch新项目") @db.VarChar(1000)
description String? @default("OurWorld上的Scratch项目") @db.VarChar(1000)
source String? @db.MediumText
tags String @default("") @db.VarChar(100)
author_id Int @default(0)
author_display_name String @default("OurWorld创作者") @db.Char(20)
author_motto String? @default("OurWorld创作者") @db.VarChar(1000)
author_images String? @default("fcd939e653195bb6d057e8c2519f5cc7") @db.VarChar(255)
@@ignore
}

/// The underlying view does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
/// This view or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
view ow_public_projects {
id Int @default(0) @db.UnsignedInt
type String? @default("text") @db.VarChar(32)
licence String? @db.VarChar(32)
authorid Int
state String? @default("private") @db.VarChar(32)
view_count Int? @default(0) @db.UnsignedInt
time DateTime? @db.Timestamp(0)
title String? @default("Scratch新项目") @db.VarChar(1000)
description String? @default("OurWorld上的Scratch项目") @db.VarChar(1000)
source String? @db.MediumText
tags String @default("") @db.VarChar(100)
author_id Int @default(0)
author_display_name String @default("OurWorld创作者") @db.Char(20)
author_motto String? @default("OurWorld创作者") @db.VarChar(1000)
author_images String? @default("fcd939e653195bb6d057e8c2519f5cc7") @db.VarChar(255)
@@ignore
}
21 changes: 21 additions & 0 deletions prisma/views/ow-dev/ow_projects_view.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
SELECT
`project`.`id` AS `id`,
`project`.`type` AS `type`,
`project`.`licence` AS `licence`,
`project`.`authorid` AS `authorid`,
`project`.`state` AS `state`,
`project`.`view_count` AS `view_count`,
`project`.`time` AS `time`,
`project`.`title` AS `title`,
`project`.`description` AS `description`,
`project`.`source` AS `source`,
`project`.`tags` AS `tags`,
`author`.`id` AS `author_id`,
`author`.`display_name` AS `author_display_name`,
`author`.`motto` AS `author_motto`,
`author`.`images` AS `author_images`
FROM
(
`ow-dev`.`ow_projects` `project`
JOIN `ow-dev`.`ow_users` `author` ON((`project`.`authorid` = `author`.`id`))
)
23 changes: 23 additions & 0 deletions prisma/views/ow-dev/ow_public_projects.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
SELECT
`project`.`id` AS `id`,
`project`.`type` AS `type`,
`project`.`licence` AS `licence`,
`project`.`authorid` AS `authorid`,
`project`.`state` AS `state`,
`project`.`view_count` AS `view_count`,
`project`.`time` AS `time`,
`project`.`title` AS `title`,
`project`.`description` AS `description`,
`project`.`source` AS `source`,
`project`.`tags` AS `tags`,
`author`.`id` AS `author_id`,
`author`.`display_name` AS `author_display_name`,
`author`.`motto` AS `author_motto`,
`author`.`images` AS `author_images`
FROM
(
`ow-dev`.`ow_projects` `project`
JOIN `ow-dev`.`ow_users` `author` ON((`project`.`authorid` = `author`.`id`))
)
WHERE
(`project`.`state` = 'public')
Loading

0 comments on commit f420e11

Please sign in to comment.