aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/application/application.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/application/application.ts')
-rw-r--r--server/models/application/application.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/server/models/application/application.ts b/server/models/application/application.ts
index a479de5d2..d4590e001 100644
--- a/server/models/application/application.ts
+++ b/server/models/application/application.ts
@@ -1,5 +1,6 @@
1import memoizee from 'memoizee' 1import memoizee from 'memoizee'
2import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript' 2import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript'
3import { getNodeABIVersion } from '@server/helpers/version'
3import { AttributesOnly } from '@shared/typescript-utils' 4import { AttributesOnly } from '@shared/typescript-utils'
4import { AccountModel } from '../account/account' 5import { AccountModel } from '../account/account'
5 6
@@ -37,6 +38,14 @@ export class ApplicationModel extends Model<Partial<AttributesOnly<ApplicationMo
37 @Column 38 @Column
38 latestPeerTubeVersion: string 39 latestPeerTubeVersion: string
39 40
41 @AllowNull(false)
42 @Column
43 nodeVersion: string
44
45 @AllowNull(false)
46 @Column
47 nodeABIVersion: number
48
40 @HasOne(() => AccountModel, { 49 @HasOne(() => AccountModel, {
41 foreignKey: { 50 foreignKey: {
42 allowNull: true 51 allowNull: true
@@ -52,4 +61,17 @@ export class ApplicationModel extends Model<Partial<AttributesOnly<ApplicationMo
52 static load () { 61 static load () {
53 return ApplicationModel.findOne() 62 return ApplicationModel.findOne()
54 } 63 }
64
65 static async nodeABIChanged () {
66 const application = await this.load()
67
68 return application.nodeABIVersion !== getNodeABIVersion()
69 }
70
71 static async updateNodeVersions () {
72 const application = await this.load()
73
74 application.nodeABIVersion = getNodeABIVersion()
75 application.nodeVersion = process.version
76 }
55} 77}