2018-07-16 12:30:41 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
up: function(migration, DataTypes) {
|
2019-05-19 22:37:35 +02:00
|
|
|
return Promise.all([
|
2018-07-16 12:30:41 +02:00
|
|
|
migration.changeColumn('memberships', 'space_id',
|
|
|
|
{
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
references: {
|
|
|
|
model: 'spaces',
|
|
|
|
key: '_id'
|
|
|
|
},
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
onUpdate: 'CASCADE'
|
|
|
|
}
|
|
|
|
),
|
|
|
|
migration.changeColumn('artifacts', 'space_id',
|
|
|
|
{
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
references: {
|
|
|
|
model: 'spaces',
|
|
|
|
key: '_id'
|
|
|
|
},
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
onUpdate: 'CASCADE'
|
|
|
|
}
|
|
|
|
),
|
|
|
|
migration.changeColumn('messages', 'space_id',
|
|
|
|
{
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
references: {
|
|
|
|
model: 'spaces',
|
|
|
|
key: '_id'
|
|
|
|
},
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
onUpdate: 'CASCADE'
|
|
|
|
}
|
|
|
|
)
|
2019-05-19 22:37:35 +02:00
|
|
|
])
|
2018-07-16 12:30:41 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
down: function(migration, DataTypes) {
|
2019-05-19 22:37:35 +02:00
|
|
|
return Promise.all([
|
2018-07-16 12:30:41 +02:00
|
|
|
migration.changeColumn('memberships', 'space_id',
|
|
|
|
{
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
references: {
|
|
|
|
model: 'spaces',
|
|
|
|
key: '_id'
|
|
|
|
},
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
onUpdate: 'NO ACTION'
|
|
|
|
}
|
|
|
|
),
|
|
|
|
migration.changeColumn('artifacts', 'space_id',
|
|
|
|
{
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
references: {
|
|
|
|
model: 'spaces',
|
|
|
|
key: '_id'
|
|
|
|
},
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
onUpdate: 'NO ACTION'
|
|
|
|
}
|
|
|
|
),
|
|
|
|
migration.changeColumn('messages', 'space_id',
|
|
|
|
{
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
references: {
|
|
|
|
model: 'spaces',
|
|
|
|
key: '_id'
|
|
|
|
},
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
onUpdate: 'NO ACTION'
|
|
|
|
}
|
|
|
|
)
|
2019-05-19 22:37:35 +02:00
|
|
|
])
|
2018-07-16 12:30:41 +02:00
|
|
|
}
|
2019-05-19 22:37:35 +02:00
|
|
|
}
|