refactor: migrate to PostgreSQL + Sequelize
This commit is contained in:
38
server/models/right.js
Normal file
38
server/models/right.js
Normal file
@@ -0,0 +1,38 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Right schema
|
||||
*/
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
let rightSchema = sequelize.define('right', {
|
||||
path: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
role: {
|
||||
type: DataTypes.ENUM('read', 'write', 'manage'),
|
||||
allowNull: false,
|
||||
defaultValue: 'read'
|
||||
},
|
||||
exact: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
defaultValue: false
|
||||
},
|
||||
allow: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
defaultValue: false
|
||||
}
|
||||
}, {
|
||||
timestamps: true,
|
||||
version: true,
|
||||
indexes: [
|
||||
{
|
||||
fields: ['path']
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
return rightSchema
|
||||
}
|
Reference in New Issue
Block a user