add schema for MediaFile
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type Publisher struct {
|
||||
bun.BaseModel `bun:"table:publisher"`
|
||||
|
||||
ID string `bun:"id,pk"`
|
||||
CreatedAt time.Time `bun:"created_date,nullzero,notnull,default:current_timestamp"`
|
||||
UpdatedAt time.Time `bun:"last_modified_date,nullzero,notnull,default:current_timestamp"`
|
||||
Version int `bun:"version,default:0"`
|
||||
Name string `bun:"name,unique:name"`
|
||||
WebLink string `bun:"weblink"`
|
||||
|
||||
ParentPublisherID *string `bun:"parent_publisher_id"`
|
||||
ParentPublisher *Publisher `bun:"rel:belongs-to,join:parent_publisher_id=id"`
|
||||
Imprints []Publisher `bun:"rel:has-many,join:id=parent_publisher_id"`
|
||||
Comics []Comic `bun:"rel:has-many,join:id=publisher_id"`
|
||||
}
|
||||
|
||||
type Comic struct {
|
||||
bun.BaseModel `bun:"table:comic"`
|
||||
|
||||
ID string `bun:"id,pk"`
|
||||
CreatedAt time.Time `bun:"created_date,nullzero,notnull,default:current_timestamp"`
|
||||
UpdatedAt time.Time `bun:"last_modified_date,nullzero,notnull,default:current_timestamp"`
|
||||
Version int `bun:"version,default:0"`
|
||||
Title string `bun:"title,unique:title,notnull"`
|
||||
CurrentOrder bool `bun:"current_order"`
|
||||
Completed bool `bun:"completed"`
|
||||
WebLink string `bun:"weblink"`
|
||||
|
||||
PublisherID *string `bun:"publisher_id"`
|
||||
Publisher *Publisher `bun:"rel:belongs-to,join:publisher_id=id"`
|
||||
|
||||
// Issues []Issue `bun:"rel:has-many,join:id=comic_id"`
|
||||
// StoryArcs []StoryArc `bun:"rel:has-many,join:id=comic_id"`
|
||||
// TradePaperbacks []TradePaperback `bun:"rel:has-many,join:id=comic_id"`
|
||||
// Volumes []Volume `bun:"rel:has-many,join:id=comic_id"`
|
||||
// ComicWorks []ComicWork `bun:"rel:has-many,join:id=comic_id"`
|
||||
}
|
||||
Reference in New Issue
Block a user