Migrate all the things
* Migrates from Mongo to Postgres. * Migrates from JSPM to Webpack. * Migrates from React to Vuejs. * Migrates from Bootstrap to Bulma. Also: * Fixes rendering of meta data in the document head tag.
This commit is contained in:
parent
09706778d9
commit
7bb0497ff4
76 changed files with 6741 additions and 1760 deletions
36
models/album.js
Normal file
36
models/album.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
export default function (sequelize, DataTypes) {
|
||||
const Album = sequelize.define('album', {
|
||||
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
||||
externalId: { type: DataTypes.STRING(50), index: true }, // eslint-disable-line new-cap
|
||||
service: DataTypes.ENUM( // eslint-disable-line new-cap
|
||||
'deezer',
|
||||
'google',
|
||||
'itunes',
|
||||
'spotify',
|
||||
'xbox',
|
||||
'youtube'
|
||||
),
|
||||
name: DataTypes.TEXT,
|
||||
artistId: DataTypes.INTEGER,
|
||||
}, {
|
||||
paranoid: true,
|
||||
classMethods: {
|
||||
associate: (models) => {
|
||||
Album.hasMany(models.match);
|
||||
Album.belongsTo(models.artist);
|
||||
},
|
||||
},
|
||||
indexes: [
|
||||
{
|
||||
fields: ['externalId', 'service'],
|
||||
},
|
||||
],
|
||||
getterMethods: {
|
||||
type() {
|
||||
return this.getDataValue('trackId') ? 'track' : 'album';
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return Album;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue