aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-26 10:45:10 +0200
committerChocobozzz <me@florianbigard.com>2018-07-26 11:02:04 +0200
commit2cebd797014561ebc0bfee07ee8b5d83820adb66 (patch)
treefe912e29c7321c3c29e94691520615a741899e71 /server/initializers
parentc1e791bad0b079af67398f6407221e6dcbb573dd (diff)
downloadPeerTube-2cebd797014561ebc0bfee07ee8b5d83820adb66.tar.gz
PeerTube-2cebd797014561ebc0bfee07ee8b5d83820adb66.tar.zst
PeerTube-2cebd797014561ebc0bfee07ee8b5d83820adb66.zip
Fix last commit
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/database.ts9
-rw-r--r--server/initializers/migrations/0055-video-uuid.ts5
2 files changed, 8 insertions, 6 deletions
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index d95e34bce..1a9ce5a61 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -125,10 +125,11 @@ async function checkPostgresExtensions () {
125} 125}
126 126
127async function createFunctions () { 127async function createFunctions () {
128 const query = `CREATE OR REPLACE FUNCTION immutable_unaccent(varchar) 128 const query = `CREATE OR REPLACE FUNCTION immutable_unaccent(text)
129 RETURNS text AS $$ 129 RETURNS text AS
130 SELECT unaccent($1) 130$func$
131 $$ LANGUAGE sql IMMUTABLE;` 131SELECT public.unaccent('public.unaccent', $1::text)
132$func$ LANGUAGE sql IMMUTABLE;`
132 133
133 return sequelizeTypescript.query(query, { raw: true }) 134 return sequelizeTypescript.query(query, { raw: true })
134} 135}
diff --git a/server/initializers/migrations/0055-video-uuid.ts b/server/initializers/migrations/0055-video-uuid.ts
index 6db25f193..e0f904080 100644
--- a/server/initializers/migrations/0055-video-uuid.ts
+++ b/server/initializers/migrations/0055-video-uuid.ts
@@ -1,5 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations'
3 4
4function up (utils: { 5function up (utils: {
5 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction,
@@ -12,7 +13,7 @@ function up (utils: {
12 type: Sequelize.UUID, 13 type: Sequelize.UUID,
13 defaultValue: Sequelize.UUIDV4, 14 defaultValue: Sequelize.UUIDV4,
14 allowNull: true 15 allowNull: true
15 } 16 } as Migration.UUID
16 17
17 return q.addColumn('Videos', 'uuid', dataUUID) 18 return q.addColumn('Videos', 'uuid', dataUUID)
18 .then(() => { 19 .then(() => {
@@ -24,7 +25,7 @@ function up (utils: {
24 return utils.sequelize.query(query) 25 return utils.sequelize.query(query)
25 }) 26 })
26 .then(() => { 27 .then(() => {
27 dataUUID.defaultValue = null // FIXME:default value cannot be null if string 28 dataUUID.defaultValue = null
28 29
29 return q.changeColumn('Videos', 'uuid', dataUUID) 30 return q.changeColumn('Videos', 'uuid', dataUUID)
30 }) 31 })