diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /scripts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip |
Move models to typescript-sequelize
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/danger/clean/cleaner.ts | 10 | ||||
-rwxr-xr-x | scripts/reset-password.ts | 8 | ||||
-rwxr-xr-x | scripts/update-host.ts | 12 |
3 files changed, 15 insertions, 15 deletions
diff --git a/scripts/danger/clean/cleaner.ts b/scripts/danger/clean/cleaner.ts index 428333528..a22e2ed6a 100644 --- a/scripts/danger/clean/cleaner.ts +++ b/scripts/danger/clean/cleaner.ts | |||
@@ -1,12 +1,10 @@ | |||
1 | import * as rimraf from 'rimraf' | ||
2 | import * as Promise from 'bluebird' | 1 | import * as Promise from 'bluebird' |
2 | import * as rimraf from 'rimraf' | ||
3 | import { CONFIG, initDatabase, sequelizeTypescript } from '../../../server/initializers' | ||
3 | 4 | ||
4 | import { CONFIG } from '../../../server/initializers/constants' | 5 | initDatabase(true) |
5 | import { database as db } from '../../../server/initializers/database' | ||
6 | |||
7 | db.init(true) | ||
8 | .then(() => { | 6 | .then(() => { |
9 | return db.sequelize.drop() | 7 | return sequelizeTypescript.drop() |
10 | }) | 8 | }) |
11 | .then(() => { | 9 | .then(() => { |
12 | console.info('Tables of %s deleted.', CONFIG.DATABASE.DBNAME) | 10 | console.info('Tables of %s deleted.', CONFIG.DATABASE.DBNAME) |
diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts index f0c06a7bf..a6863f807 100755 --- a/scripts/reset-password.ts +++ b/scripts/reset-password.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as program from 'commander' | 1 | import * as program from 'commander' |
2 | 2 | import { initDatabase } from '../server/initializers' | |
3 | import { database as db } from '../server/initializers/database' | 3 | import { UserModel } from '../server/models/account/user' |
4 | 4 | ||
5 | program | 5 | program |
6 | .option('-u, --user [user]', 'User') | 6 | .option('-u, --user [user]', 'User') |
@@ -11,9 +11,9 @@ if (program['user'] === undefined) { | |||
11 | process.exit(-1) | 11 | process.exit(-1) |
12 | } | 12 | } |
13 | 13 | ||
14 | db.init(true) | 14 | initDatabase(true) |
15 | .then(() => { | 15 | .then(() => { |
16 | return db.User.loadByUsername(program['user']) | 16 | return UserModel.loadByUsername(program['user']) |
17 | }) | 17 | }) |
18 | .then(user => { | 18 | .then(user => { |
19 | if (!user) { | 19 | if (!user) { |
diff --git a/scripts/update-host.ts b/scripts/update-host.ts index 759443623..ba4656b75 100755 --- a/scripts/update-host.ts +++ b/scripts/update-host.ts | |||
@@ -1,12 +1,14 @@ | |||
1 | import { database as db } from '../server/initializers/database' | 1 | import { getServerAccount } from '../server/helpers' |
2 | import { getServerAccount } from '../server/helpers/utils' | 2 | import { initDatabase } from '../server/initializers' |
3 | import { AccountFollowModel } from '../server/models/account/account-follow' | ||
4 | import { VideoModel } from '../server/models/video/video' | ||
3 | 5 | ||
4 | db.init(true) | 6 | initDatabase(true) |
5 | .then(() => { | 7 | .then(() => { |
6 | return getServerAccount() | 8 | return getServerAccount() |
7 | }) | 9 | }) |
8 | .then(serverAccount => { | 10 | .then(serverAccount => { |
9 | return db.AccountFollow.listAcceptedFollowingUrlsForApi([ serverAccount.id ], undefined) | 11 | return AccountFollowModel.listAcceptedFollowingUrlsForApi([ serverAccount.id ], undefined) |
10 | }) | 12 | }) |
11 | .then(res => { | 13 | .then(res => { |
12 | return res.total > 0 | 14 | return res.total > 0 |
@@ -18,7 +20,7 @@ db.init(true) | |||
18 | } | 20 | } |
19 | 21 | ||
20 | console.log('Updating torrent files.') | 22 | console.log('Updating torrent files.') |
21 | return db.Video.list() | 23 | return VideoModel.list() |
22 | }) | 24 | }) |
23 | .then(videos => { | 25 | .then(videos => { |
24 | const tasks: Promise<any>[] = [] | 26 | const tasks: Promise<any>[] = [] |