Skip to content

Commit

Permalink
feat: add migration for otlp settings
Browse files Browse the repository at this point in the history
  • Loading branch information
TBonnin committed Oct 24, 2024
1 parent a4ba67b commit d28197c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
exports.config = { transaction: false };

/**
* @param {import('knex').Knex} knex
*/
exports.up = async function (knex) {
await knex.schema.raw(`ALTER TABLE _nango_environments ADD COLUMN otlp_settings JSONB DEFAULT NULL;`);
await knex.schema.raw(
`CREATE INDEX CONCURRENTLY IF NOT EXISTS "idx_environment_otlp_settings" ON "_nango_environments" USING BTREE ("id") WHERE "otlp_settings" IS NOT NULL;`
);
};

/**
* @param {import('knex').Knex} knex
*/
exports.down = async function (knex) {
await knex.schema.raw(`ALTER TABLE _nango_environments DROP COLUMN otlp_settings;`);
await knex.schema.raw(`DROP INDEX CONCURRENTLY IF EXISTS "idx_environment_otlp_settings"`);
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ describe('Environment service', () => {
updated_at: expect.toBeIsoDate(),
uuid: expect.any(String),
webhook_url: null,
webhook_url_secondary: null
webhook_url_secondary: null,
otlp_settings: null
});

expect(env.secret_key).not.toEqual(env.secret_key_hashed);
Expand Down
1 change: 1 addition & 0 deletions packages/types/lib/environment/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface DBEnvironment extends Timestamps {
slack_notifications: boolean;

webhook_receive_url?: string;
otlp_settings?: { endpoint: string; headers: Record<string, string> } | null;
}

export interface ExternalWebhook extends Timestamps {
Expand Down

0 comments on commit d28197c

Please sign in to comment.