feat: introduce singleton webhook URL
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { Knex } from 'knex';
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
return knex.schema.table('steps', (table) => {
|
||||
table.string('webhook_path');
|
||||
});
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
return knex.schema.table('steps', (table) => {
|
||||
table.dropColumn('webhook_path');
|
||||
});
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
import { Knex } from 'knex';
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
return await knex('steps')
|
||||
.where('type', 'trigger')
|
||||
.whereIn('app_key', ['gitlab', 'typeform', 'twilio', 'flowers-software', 'webhook'])
|
||||
.update({
|
||||
webhook_path: knex.raw('? || ??', ['/webhooks/flows/', knex.ref('flow_id')]),
|
||||
});
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
return await knex('steps').update({
|
||||
webhook_path: null
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user