You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Fipamo/brain/models/Bookmark.js

102 lines
2.7 KiB
JavaScript

module.exports = function (sequelize, DataTypes) {
var Bookmark = sequelize.define('Bookmark', {
id: {
type: DataTypes.INTEGER,
unique: true,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
url: {
type: DataTypes.STRING(500),
unique: false,
allowNull: true
},
source: {
type: DataTypes.STRING(500),
allowNull: true
},
title: {
type: DataTypes.STRING(500),
unique: false,
allowNull: true
},
image: {
type: DataTypes.STRING(500),
unique: false,
allowNull: true
},
comments: {
type: DataTypes.STRING,
unique: false,
allowNull: true
},
author: {
type: DataTypes.STRING,
unique: false,
allowNull: true
},
tags: {
type: DataTypes.ARRAY(DataTypes.TEXT),
unique: false,
allowNull: true
},
listed: {
type: DataTypes.BOOLEAN,
unique: false,
allowNull: true
}
}, {
timestamps: true,
// don't delete database entries but set the newly added attribute deletedAt
// to the current date (when deletion was done). paranoid will only work if
// timestamps are enabled
paranoid: true,
// don't use camelcase for automatically added attributes but underscore style
// so updatedAt will be updated_at
underscored: true,
// disable the modification of table names; By default, sequelize will automatically
// transform all passed model names (first parameter of define) into plural.
// if you don't want that, set the following
freezeTableName: false,
// define the table's name
tableName: 'Bookmarks',
// Enable optimistic locking. When enabled, sequelize will add a version count attriubte
// to the model and throw an OptimisticLockingError error when stale instances are saved.
// Set to true or a string with the attribute name you want to use to enable.
version: true
});
return Bookmark;
};
/**
var mongoose = require('mongoose');
mongoose.Promise = require('bluebird');
var Bookmark = new mongoose.Schema({
url: String,
source:String,
title:String,
image: String,
comments:Array,
created: String,
edited: String,
author:Object,
tags:Array,
listed:Boolean
}, {
collection: 'bookmarks'
});
module.exports = mongoose.model('Bookmark', Bookmark);
**/