-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
juan
committed
May 18, 2020
1 parent
f1af9db
commit 81c6e15
Showing
8 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict' | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('Resources', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
name: { | ||
type: Sequelize.STRING | ||
}, | ||
path: { | ||
type: Sequelize.STRING | ||
}, | ||
size: { | ||
type: Sequelize.STRING | ||
}, | ||
owner: { | ||
type: Sequelize.STRING | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}) | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('Resources') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict' | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('Metadata', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
title: { | ||
type: Sequelize.STRING | ||
}, | ||
description: { | ||
type: Sequelize.STRING | ||
}, | ||
location: { | ||
type: Sequelize.STRING | ||
}, | ||
visibility: { | ||
type: Sequelize.STRING | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}) | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('Metadata') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict' | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('Comments', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
message: { | ||
type: Sequelize.STRING | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}) | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('Comments') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict' | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('Reactions', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
status: { | ||
type: Sequelize.STRING | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}) | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('Reactions') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict' | ||
module.exports = (sequelize, DataTypes) => { | ||
const Comment = sequelize.define('Comment', { | ||
message: DataTypes.STRING | ||
}, {}) | ||
Comment.associate = function (models) { | ||
Comment.belongsTo(models.Resource) | ||
|
||
// associations can be defined here | ||
} | ||
return Comment | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = (sequelize, DataTypes) => { | ||
const Metadata = sequelize.define('Metadata', { | ||
title: DataTypes.STRING, | ||
description: DataTypes.STRING, | ||
location: DataTypes.STRING, | ||
visibility: DataTypes.STRING | ||
}, {}) | ||
Metadata.associate = function (models) { | ||
Metadata.belongsTo(models.Resource) | ||
// associations can be defined here | ||
} | ||
return Metadata | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = (sequelize, DataTypes) => { | ||
const Reaction = sequelize.define('Reaction', { | ||
status: DataTypes.STRING | ||
}, {}) | ||
Reaction.associate = function (models) { | ||
Reaction.belongsTo(models.Resource) | ||
// associations can be defined here | ||
} | ||
return Reaction | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = (sequelize, DataTypes) => { | ||
const Resource = sequelize.define('Resource', { | ||
name: DataTypes.STRING, | ||
path: DataTypes.STRING, | ||
size: DataTypes.STRING, | ||
owner: DataTypes.STRING | ||
}, {}) | ||
Resource.associate = function (models) { | ||
Resource.hasOne(models.Metadata) | ||
Resource.hasMany(models.Comment) | ||
Resource.hasMany(models.Reaction) | ||
// associations can be defined here | ||
} | ||
return Resource | ||
} |