adding integration with payment sources table and within stripe controller
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.createTable('payment_sources', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
primaryKey: true,
|
||||
type: Sequelize.UUID
|
||||
},
|
||||
token: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
provider: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
donor_id: {
|
||||
type: Sequelize.UUID,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: 'donors',
|
||||
key: 'id'
|
||||
}
|
||||
},
|
||||
createdAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
updatedAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
}
|
||||
});
|
||||
},
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.dropTable('PaymentSources');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
/*
|
||||
Add altering commands here.
|
||||
Return a promise to correctly handle asynchronicity.
|
||||
|
||||
Example:
|
||||
return queryInterface.createTable('users', { id: Sequelize.INTEGER });
|
||||
*/
|
||||
return queryInterface
|
||||
.addColumn('grants', 'payment_source_id', Sequelize.UUID)
|
||||
.then(() =>
|
||||
queryInterface.addConstraint('grants', ['payment_source_id'], {
|
||||
type: 'foreign key',
|
||||
name: 'grants_paymentsources_fk',
|
||||
references: {
|
||||
//Required field
|
||||
table: 'payment_sources',
|
||||
field: 'id'
|
||||
},
|
||||
onDelete: 'cascade',
|
||||
onUpdate: 'cascade'
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
/*
|
||||
Add reverting commands here.
|
||||
Return a promise to correctly handle asynchronicity.
|
||||
|
||||
Example:
|
||||
return queryInterface.dropTable('users');
|
||||
*/
|
||||
return queryInterface.removeColumn('grants', 'payment_source_id');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user