import * as Bluebird from 'bluebird'
-import { QueryTypes, Transaction } from 'sequelize'
+import { fn, QueryTypes, Transaction, col } from 'sequelize'
import { AllowNull, BelongsToMany, Column, CreatedAt, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
import { isVideoTagValid } from '../../helpers/custom-validators/videos'
import { throwIfNotValid } from '../utils'
import { VideoModel } from './video'
import { VideoTagModel } from './video-tag'
import { VideoPrivacy, VideoState } from '../../../shared/models/videos'
-import { MTag } from '@server/typings/models'
+import { MTag } from '@server/types/models'
@Table({
tableName: 'tag',
{
fields: [ 'name' ],
unique: true
+ },
+ {
+ name: 'tag_lower_name',
+ fields: [ fn('lower', col('name')) ] as any // FIXME: typings
}
]
})