Split types and typings
[oweals/peertube.git] / server / models / video / tag.ts
index b110f2a436e55dc8044c19de1feb547867d1ec6a..adbc4fb7d6c22b2d2015399cafbdef4589575ec4 100644 (file)
@@ -1,12 +1,12 @@
 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',
@@ -15,6 +15,10 @@ import { MTag } from '@server/typings/models'
     {
       fields: [ 'name' ],
       unique: true
+    },
+    {
+      name: 'tag_lower_name',
+      fields: [ fn('lower', col('name')) ] as any // FIXME: typings
     }
   ]
 })