Add pivot table

This commit is contained in:
2021-08-16 23:24:39 +02:00
parent 9a438587e0
commit 5c3dd37758
5 changed files with 64 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
import {DateTime} from 'luxon'
import {BaseModel, BelongsTo, belongsTo, column} from '@ioc:Adonis/Lucid/Orm'
import {BaseModel, BelongsTo, belongsTo, column, ManyToMany, manyToMany} from '@ioc:Adonis/Lucid/Orm'
import File from "App/Models/File";
import Tag from "App/Models/Tag";
export default class Project extends BaseModel {
@column({ isPrimary: true })
@@ -24,6 +25,9 @@ export default class Project extends BaseModel {
@column()
public fileId: number
@manyToMany(() => Tag)
public tags: ManyToMany<typeof Tag>
@column.dateTime({ autoCreate: true })
public createdAt: DateTime