diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-11 21:50:51 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-19 21:22:28 +0100 |
commit | feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c (patch) | |
tree | 2abc9fbc9569760e218fd52835850b757344b420 /server/models/author.js | |
parent | 108626609eda75e4ecc0a83a650a4d53c46220e0 (diff) | |
download | PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.gz PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.zst PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.zip |
First version with PostgreSQL
Diffstat (limited to 'server/models/author.js')
-rw-r--r-- | server/models/author.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/server/models/author.js b/server/models/author.js new file mode 100644 index 000000000..493c2ca11 --- /dev/null +++ b/server/models/author.js | |||
@@ -0,0 +1,28 @@ | |||
1 | module.exports = function (sequelize, DataTypes) { | ||
2 | const Author = sequelize.define('Author', | ||
3 | { | ||
4 | name: { | ||
5 | type: DataTypes.STRING | ||
6 | } | ||
7 | }, | ||
8 | { | ||
9 | classMethods: { | ||
10 | associate | ||
11 | } | ||
12 | } | ||
13 | ) | ||
14 | |||
15 | return Author | ||
16 | } | ||
17 | |||
18 | // --------------------------------------------------------------------------- | ||
19 | |||
20 | function associate (models) { | ||
21 | this.belongsTo(models.Pod, { | ||
22 | foreignKey: { | ||
23 | name: 'podId', | ||
24 | allowNull: true | ||
25 | }, | ||
26 | onDelete: 'cascade' | ||
27 | }) | ||
28 | } | ||