You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
32 lines
1.0 KiB
exports.up = function(knex) {
|
|
return knex.schema.createTable('payment', (table) => {
|
|
table.increments();
|
|
table.timestamps(true, true);
|
|
|
|
// don't use an enum here because we will add random services later
|
|
table.string('system', '10').notNull();
|
|
|
|
// only four states really needed in most payment systems
|
|
table.enum('status', ['pending', 'complete', 'failed', 'refunded']).notNull().default('pending');
|
|
|
|
// this is *our* internal id that we give to the payment system
|
|
table.uuid('internal_id').notNull();
|
|
|
|
// there should always be a way to access the record in every system
|
|
table.string('sys_primary_id').notNull();
|
|
|
|
// this might not exist in some systems, so allow null
|
|
table.string('sys_secondary_id');
|
|
|
|
// not sure if this should be nullable or not
|
|
table.datetime('sys_created_on').notNull();
|
|
|
|
table.index('internal_id');
|
|
table.index('sys_primary_id');
|
|
table.index('sys_secondary_id');
|
|
});
|
|
};
|
|
|
|
exports.down = function(knex) {
|
|
return knex.schema.dropTable('payment');
|
|
};
|
|
|