]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/tag.ts
Lowercase video tags search
[github/Chocobozzz/PeerTube.git] / server / models / video / tag.ts
index b110f2a436e55dc8044c19de1feb547867d1ec6a..ed8df8b48aa84367003161035dda9256eac13c76 100644 (file)
@@ -1,5 +1,5 @@
 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'
@@ -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
     }
   ]
 })