repo stringclasses 4 values | file_path stringlengths 6 193 | extension stringclasses 23 values | content stringlengths 0 1.73M | token_count int64 0 724k | __index_level_0__ int64 0 10.8k |
|---|---|---|---|---|---|
hyperswitch | migrations/2023-09-08-112817_applepay_verified_domains_in_business_profile/up.sql | .sql | ALTER TABLE business_profile
ADD COLUMN IF NOT EXISTS applepay_verified_domains text[];
| 16 | 300 |
hyperswitch | migrations/2023-09-08-112817_applepay_verified_domains_in_business_profile/down.sql | .sql | ALTER TABLE business_profile DROP COLUMN IF EXISTS applepay_verified_domains;
| 13 | 301 |
hyperswitch | migrations/2023-06-26-124254_add_vnd_to_currency_enum/up.sql | .sql | -- Your SQL goes here
ALTER TYPE "Currency" ADD VALUE IF NOT EXISTS 'VND' AFTER 'UZS'; | 26 | 302 |
hyperswitch | migrations/2023-06-26-124254_add_vnd_to_currency_enum/down.sql | .sql | -- This file should undo anything in `up.sql`
SELECT 1; | 15 | 303 |
hyperswitch | migrations/2024-09-15-080630_add_addtional_payout_method_data_column_to_payout_attempt_table/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payout_attempt
ADD COLUMN IF NOT EXISTS additional_payout_method_data JSONB DEFAULT NULL; | 26 | 304 |
hyperswitch | migrations/2024-09-15-080630_add_addtional_payout_method_data_column_to_payout_attempt_table/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payout_attempt DROP COLUMN IF EXISTS additional_payout_method_data; | 25 | 305 |
hyperswitch | migrations/2023-10-05-114138_add_payment_id_in_mandate/up.sql | .sql | -- Your SQL goes here
ALTER TABLE mandate ADD COLUMN original_payment_id VARCHAR(64); | 19 | 306 |
hyperswitch | migrations/2023-10-05-114138_add_payment_id_in_mandate/down.sql | .sql | ALTER TABLE mandate DROP COLUMN original_payment_id; | 9 | 307 |
hyperswitch | migrations/2025-01-13-060852_add_card_discovery_in_payment_attempt/up.sql | .sql | -- Your SQL goes here
CREATE TYPE "CardDiscovery" AS ENUM ('manual', 'saved_card', 'click_to_pay');
ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS card_discovery "CardDiscovery";
| 42 | 308 |
hyperswitch | migrations/2025-01-13-060852_add_card_discovery_in_payment_attempt/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_attempt DROP COLUMN IF EXISTS card_discovery;
DROP TYPE IF EXISTS "CardDiscovery";
| 31 | 309 |
hyperswitch | migrations/2023-07-28-111829_update_columns_to_fix_db_diff/up.sql | .sql | ALTER TABLE dispute
ALTER COLUMN payment_id TYPE VARCHAR(64);
ALTER TABLE payment_methods
ALTER COLUMN payment_method_type TYPE VARCHAR(64);
ALTER TABLE merchant_account
ALTER COLUMN primary_business_details DROP DEFAULT; | 43 | 310 |
hyperswitch | migrations/2023-07-28-111829_update_columns_to_fix_db_diff/down.sql | .sql | ALTER TABLE dispute
ALTER COLUMN payment_id TYPE VARCHAR(255);
ALTER TABLE payment_methods
ALTER COLUMN payment_method_type TYPE VARCHAR;
ALTER TABLE merchant_account
ALTER COLUMN primary_business_details SET DEFAULT '[{"country": "US", "business": "default"}]'; | 55 | 311 |
hyperswitch | migrations/2024-10-28-125949_add_dispute_currency_column_in_dispute_table/up.sql | .sql | -- Your SQL goes here
ALTER TABLE dispute ADD COLUMN IF NOT EXISTS dispute_currency "Currency"; | 19 | 312 |
hyperswitch | migrations/2024-10-28-125949_add_dispute_currency_column_in_dispute_table/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE dispute DROP COLUMN IF EXISTS dispute_currency; | 21 | 313 |
hyperswitch | migrations/2025-01-03-104019_migrate_permission_group_for_recon/up.sql | .sql | UPDATE roles
SET groups = array_replace(groups, 'recon_ops', 'recon_ops_manage')
WHERE 'recon_ops' = ANY(groups);
| 31 | 314 |
hyperswitch | migrations/2025-01-03-104019_migrate_permission_group_for_recon/down.sql | .sql | SELECT 1;
| 4 | 315 |
hyperswitch | migrations/2023-01-10-035412_connector-metadata-payment-attempt/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_attempt ADD COLUMN connector_metadata JSONB DEFAULT NULL; | 19 | 316 |
hyperswitch | migrations/2023-01-10-035412_connector-metadata-payment-attempt/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_attempt DROP COLUMN connector_metadata; | 20 | 317 |
hyperswitch | migrations/2024-02-27-130532_add_enum_types_to_payment-source_enum/up.sql | .sql | -- Your SQL goes here
ALTER TYPE "PaymentSource" ADD VALUE 'webhook';
ALTER TYPE "PaymentSource" ADD VALUE 'external_authenticator'; | 31 | 318 |
hyperswitch | migrations/2024-02-27-130532_add_enum_types_to_payment-source_enum/down.sql | .sql | -- This file should undo anything in `up.sql`
SELECT 1; | 15 | 319 |
hyperswitch | migrations/2024-08-08-075600_add_api_version_to_merchant_account/up.sql | .sql | -- Your SQL goes here
ALTER TABLE merchant_account
ADD COLUMN IF NOT EXISTS version "ApiVersion" NOT NULL DEFAULT 'v1';
| 28 | 320 |
hyperswitch | migrations/2024-08-08-075600_add_api_version_to_merchant_account/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE merchant_account DROP COLUMN version;
| 19 | 321 |
hyperswitch | migrations/2023-10-19-101558_create_routing_algorithm_table/up.sql | .sql | -- Your SQL goes here
CREATE TYPE "RoutingAlgorithmKind" AS ENUM ('single', 'priority', 'volume_split', 'advanced');
CREATE TABLE routing_algorithm (
algorithm_id VARCHAR(64) PRIMARY KEY,
profile_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
name VARCHAR(64) NOT NULL,
description VARCHAR(256),
kind "RoutingAlgorithmKind" NOT NULL,
algorithm_data JSONB NOT NULL,
created_at TIMESTAMP NOT NULL,
modified_at TIMESTAMP NOT NULL
);
CREATE INDEX routing_algorithm_profile_id_modified_at ON routing_algorithm (profile_id, modified_at DESC);
CREATE INDEX routing_algorithm_merchant_id_modified_at ON routing_algorithm (merchant_id, modified_at DESC);
| 156 | 322 |
hyperswitch | migrations/2023-10-19-101558_create_routing_algorithm_table/down.sql | .sql | -- This file should undo anything in `up.sql`
DROP TABLE routing_algorithm;
DROP TYPE "RoutingAlgorithmKind";
| 23 | 323 |
hyperswitch | migrations/2023-08-16-103806_add_last_executed_frm_step/up.sql | .sql | alter table fraud_check add column last_step VARCHAR(64) NOT NULL DEFAULT 'processing'; | 19 | 324 |
hyperswitch | migrations/2023-08-16-103806_add_last_executed_frm_step/down.sql | .sql | alter table fraud_check drop column last_step; | 9 | 325 |
hyperswitch | migrations/2025-03-11-171330_add-force-3ds-challenge-in-payment-intent/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_intent
ADD COLUMN IF NOT EXISTS force_3ds_challenge boolean DEFAULT false; | 25 | 326 |
hyperswitch | migrations/2025-03-11-171330_add-force-3ds-challenge-in-payment-intent/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_intent
DROP COLUMN IF EXISTS force_3ds_challenge; | 26 | 327 |
hyperswitch | migrations/2024-02-05-123412_add_attempt_count_column_to_payouts/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payouts
ADD COLUMN attempt_count SMALLINT NOT NULL DEFAULT 1;
UPDATE payouts
SET attempt_count = payout_id_count.count
FROM (SELECT payout_id, count(payout_id) FROM payout_attempt GROUP BY payout_id) as payout_id_count
WHERE payouts.payout_id = payout_id_count.payout_id;
| 71 | 328 |
hyperswitch | migrations/2024-02-05-123412_add_attempt_count_column_to_payouts/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payouts DROP COLUMN attempt_count;
| 19 | 329 |
hyperswitch | migrations/2023-12-06-112810_add_intent_fullfilment_time_payment_intent/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS session_expiry TIMESTAMP DEFAULT NULL;
| 21 | 330 |
hyperswitch | migrations/2023-12-06-112810_add_intent_fullfilment_time_payment_intent/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_intent DROP COLUMN IF EXISTS session_expiry;
| 22 | 331 |
hyperswitch | migrations/2024-05-06-105026_user_key_store_table/up.sql | .sql | -- Your SQL goes here
CREATE TABLE IF NOT EXISTS user_key_store (
user_id VARCHAR(64) PRIMARY KEY,
key bytea NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT now()
);
| 43 | 332 |
hyperswitch | migrations/2024-05-06-105026_user_key_store_table/down.sql | .sql | -- This file should undo anything in `up.sql`
DROP TABLE IF EXISTS user_key_store;
| 19 | 333 |
hyperswitch | migrations/2023-10-19-102636_back_fill_n_remove_connector_response/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_attempt
ADD COLUMN authentication_data JSON,
ADD COLUMN encoded_data TEXT;
UPDATE payment_attempt
SET (authentication_data, encoded_data) = (connector_response.authentication_data, connector_response.encoded_data)
from connector_response
where payment_attempt.payment_id = connector_response.payment_id
and payment_attempt.attempt_id = connector_response.attempt_id
and payment_attempt.merchant_id = connector_response.merchant_id;
| 93 | 334 |
hyperswitch | migrations/2023-10-19-102636_back_fill_n_remove_connector_response/down.sql | .sql |
ALTER TABLE payment_attempt DROP COLUMN authentication_data, DROP COLUMN encoded_data;
| 15 | 335 |
hyperswitch | migrations/2022-12-19-085739_add_attempt_id_to_refund/up.sql | .sql | ALTER TABLE refund ADD COLUMN attempt_id VARCHAR(64) NOT NULL;
| 15 | 336 |
hyperswitch | migrations/2022-12-19-085739_add_attempt_id_to_refund/down.sql | .sql | ALTER TABLE refund DROP COLUMN attempt_id;
| 8 | 337 |
hyperswitch | migrations/2023-08-11-073905_add_frm_config_in_mca/up.sql | .sql | ALTER TABLE "merchant_connector_account" ADD COLUMN frm_config jsonb[];
-- Do not run below migration in PROD as this only makes sandbox compatible to PROD version
ALTER TABLE merchant_connector_account
ALTER COLUMN frm_configs TYPE jsonb
USING frm_configs[1]::jsonb; | 59 | 338 |
hyperswitch | migrations/2023-08-11-073905_add_frm_config_in_mca/down.sql | .sql | ALTER TABLE "merchant_connector_account" DROP COLUMN frm_config;
ALTER TABLE merchant_connector_account
ALTER COLUMN frm_configs TYPE jsonb[]
USING ARRAY[frm_configs]::jsonb[]; | 38 | 339 |
hyperswitch | migrations/2024-03-04-204051_events_store_webhook_delivery_attempt_info/up.sql | .sql | -- The following queries must be run before the newer version of the application is deployed.
ALTER TABLE events
ADD COLUMN merchant_id VARCHAR(64) DEFAULT NULL,
ADD COLUMN business_profile_id VARCHAR(64) DEFAULT NULL,
ADD COLUMN primary_object_created_at TIMESTAMP DEFAULT NULL,
ADD COLUMN idempotent_event_id VARCHAR(64) DEFAULT NULL,
ADD COLUMN initial_attempt_id VARCHAR(64) DEFAULT NULL,
ADD COLUMN request BYTEA DEFAULT NULL,
ADD COLUMN response BYTEA DEFAULT NULL;
UPDATE events
SET idempotent_event_id = event_id
WHERE idempotent_event_id IS NULL;
UPDATE events
SET initial_attempt_id = event_id
WHERE initial_attempt_id IS NULL;
ALTER TABLE events
ADD CONSTRAINT idempotent_event_id_unique UNIQUE (idempotent_event_id);
-- The following queries must be run after the newer version of the application is deployed.
-- Running these queries can even be deferred for some time (a couple of weeks or even a month) until the
-- new version being deployed is considered stable.
-- Make `event_id` primary key instead of `id`
ALTER TABLE events DROP CONSTRAINT events_pkey;
ALTER TABLE events
ADD PRIMARY KEY (event_id);
ALTER TABLE events DROP CONSTRAINT event_id_unique;
-- Dropping unused columns
ALTER TABLE events
DROP COLUMN id,
DROP COLUMN intent_reference_id;
| 281 | 340 |
hyperswitch | migrations/2024-03-04-204051_events_store_webhook_delivery_attempt_info/down.sql | .sql | -- The following queries must be run before the older version of the application is deployed.
-- Remove `event_id` as primary key and add unique constraint
ALTER TABLE events DROP CONSTRAINT events_pkey;
ALTER TABLE events
ADD CONSTRAINT event_id_unique UNIQUE (event_id);
-- Adding back unused columns, and make `id` as primary key
ALTER TABLE events
ADD COLUMN id SERIAL PRIMARY KEY,
ADD COLUMN intent_reference_id VARCHAR(64) DEFAULT NULL;
-- The following queries must be run after the older version of the application is deployed.
ALTER TABLE events
DROP COLUMN merchant_id,
DROP COLUMN business_profile_id,
DROP COLUMN primary_object_created_at,
DROP COLUMN idempotent_event_id,
DROP COLUMN initial_attempt_id,
DROP COLUMN request,
DROP COLUMN response;
| 163 | 341 |
hyperswitch | migrations/2023-11-24-115538_add_profile_id_payment_link/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_link ADD COLUMN IF NOT EXISTS profile_id VARCHAR(64) DEFAULT NULL;
| 26 | 342 |
hyperswitch | migrations/2023-11-24-115538_add_profile_id_payment_link/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_link DROP COLUMN profile_id; | 20 | 343 |
hyperswitch | migrations/2024-07-19-100016_change_primary_key_for_user_roles/up.sql | .sql | -- Your SQL goes here
-- The below query will lock the user_roles table
-- Running this query is not necessary on higher environments
-- as the application will work fine without these queries being run
-- This query should be run after the new version of application is deployed
ALTER TABLE user_roles DROP CONSTRAINT user_roles_pkey;
-- Use the `user_id, merchant_id` columns as primary key
-- These are already unique, not null columns
-- So this query should not fail for not null or duplicate value reasons
ALTER TABLE user_roles
ADD PRIMARY KEY (user_id, merchant_id);
| 122 | 344 |
hyperswitch | migrations/2024-07-19-100016_change_primary_key_for_user_roles/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE user_roles DROP CONSTRAINT user_roles_pkey;
ALTER TABLE user_roles
ADD PRIMARY KEY (id);
| 33 | 345 |
hyperswitch | migrations/2024-08-21-085916_add_tax_details_in_payment_intent_to_store_tax_amount/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS tax_details JSONB;
| 20 | 346 |
hyperswitch | migrations/2024-08-21-085916_add_tax_details_in_payment_intent_to_store_tax_amount/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_intent DROP COLUMN IF EXISTS tax_details;
| 22 | 347 |
hyperswitch | migrations/2024-09-12-123315_add_network_token_locker_id_and_network_token_payment_method_data_and_network_token_ref_id_in_payment_methods/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_methods ADD COLUMN IF NOT EXISTS network_token_requestor_reference_id VARCHAR(128) DEFAULT NULL;
ALTER TABLE payment_methods ADD COLUMN IF NOT EXISTS network_token_locker_id VARCHAR(64) DEFAULT NULL;
ALTER TABLE payment_methods ADD COLUMN IF NOT EXISTS network_token_payment_method_data BYTEA DEFAULT NULL; | 71 | 348 |
hyperswitch | migrations/2024-09-12-123315_add_network_token_locker_id_and_network_token_payment_method_data_and_network_token_ref_id_in_payment_methods/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_methods DROP COLUMN IF EXISTS network_token_requestor_reference_id;
ALTER TABLE payment_methods DROP COLUMN IF EXISTS network_token_locker_id;
ALTER TABLE payment_methods DROP COLUMN IF EXISTS network_token_payment_method_data; | 54 | 349 |
hyperswitch | migrations/2023-05-31-152153_add_connector_webhook_details_to_mca/up.sql | .sql | -- Your SQL goes here
ALTER TABLE merchant_connector_account
ADD COLUMN IF NOT EXISTS connector_webhook_details JSONB DEFAULT NULL; | 26 | 350 |
hyperswitch | migrations/2023-05-31-152153_add_connector_webhook_details_to_mca/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE merchant_connector_account DROP COLUMN connector_webhook_details; | 23 | 351 |
hyperswitch | migrations/2024-05-09-130152_collect_shipping_details_from_wallet_connector/up.sql | .sql | -- Your SQL goes here
ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS collect_shipping_details_from_wallet_connector BOOLEAN DEFAULT FALSE; | 25 | 352 |
hyperswitch | migrations/2024-05-09-130152_collect_shipping_details_from_wallet_connector/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE business_profile DROP COLUMN IF EXISTS collect_shipping_details_from_wallet_connector; | 26 | 353 |
hyperswitch | migrations/2024-12-02-110129_update-user-role-entity-type/up.sql | .sql | -- Your SQL goes here
-- Incomplete migration, also run migrations/2024-12-13-080558_entity-id-backfill-for-user-roles
UPDATE user_roles
SET
entity_type = CASE
WHEN role_id = 'org_admin' THEN 'organization'
ELSE 'merchant'
END
WHERE
version = 'v1'
AND entity_type IS NULL; | 90 | 354 |
hyperswitch | migrations/2024-12-02-110129_update-user-role-entity-type/down.sql | .sql | -- This file should undo anything in `up.sql`
UPDATE user_roles SET entity_type = NULL WHERE version = 'v1'; | 26 | 355 |
hyperswitch | migrations/2023-10-31-070509_add_payment_link_config_in_payment_link_db/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_link ADD COLUMN IF NOT EXISTS payment_link_config JSONB NULL;
| 22 | 356 |
hyperswitch | migrations/2023-10-31-070509_add_payment_link_config_in_payment_link_db/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_link DROP COLUMN IF EXISTS payment_link_config;
| 23 | 357 |
hyperswitch | migrations/2023-09-18-104900_add_pm_auth_config_mca/up.sql | .sql | -- Your SQL goes here
ALTER TABLE merchant_connector_account ADD COLUMN IF NOT EXISTS pm_auth_config JSONB DEFAULT NULL;
ALTER TYPE "ConnectorType" ADD VALUE 'payment_method_auth'; | 37 | 358 |
hyperswitch | migrations/2023-09-18-104900_add_pm_auth_config_mca/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE merchant_connector_account DROP COLUMN IF EXISTS pm_auth_config; | 24 | 359 |
hyperswitch | migrations/2023-12-06-060216_change_primary_key_for_mca/up.sql | .sql | -- Your SQL goes here
ALTER TABLE merchant_connector_account
ADD UNIQUE (profile_id, connector_label);
DROP INDEX IF EXISTS "merchant_connector_account_profile_id_connector_id_index";
| 35 | 360 |
hyperswitch | migrations/2023-12-06-060216_change_primary_key_for_mca/down.sql | .sql | -- This file should undo anything in `up.sql`
CREATE UNIQUE INDEX IF NOT EXISTS "merchant_connector_account_profile_id_connector_id_index" ON merchant_connector_account (profile_id, connector_name);
ALTER TABLE merchant_connector_account DROP CONSTRAINT IF EXISTS "merchant_connector_account_profile_id_connector_label_key";
| 57 | 361 |
hyperswitch | migrations/2024-11-06-121933_setup-themes-table/up.sql | .sql | -- Your SQL goes here
CREATE TABLE IF NOT EXISTS themes (
theme_id VARCHAR(64) PRIMARY KEY,
tenant_id VARCHAR(64) NOT NULL,
org_id VARCHAR(64),
merchant_id VARCHAR(64),
profile_id VARCHAR(64),
created_at TIMESTAMP NOT NULL,
last_modified_at TIMESTAMP NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS themes_index ON themes (
tenant_id,
COALESCE(org_id, '0'),
COALESCE(merchant_id, '0'),
COALESCE(profile_id, '0')
);
| 122 | 362 |
hyperswitch | migrations/2024-11-06-121933_setup-themes-table/down.sql | .sql | -- This file should undo anything in `up.sql`
DROP INDEX IF EXISTS themes_index;
DROP TABLE IF EXISTS themes;
| 24 | 363 |
hyperswitch | migrations/2023-12-11-075542_create_pm_fingerprint_table/up.sql | .sql | -- Your SQL goes here
CREATE TYPE "BlocklistDataKind" AS ENUM (
'payment_method',
'card_bin',
'extended_card_bin'
);
CREATE TABLE blocklist_fingerprint (
id SERIAL PRIMARY KEY,
merchant_id VARCHAR(64) NOT NULL,
fingerprint_id VARCHAR(64) NOT NULL,
data_kind "BlocklistDataKind" NOT NULL,
encrypted_fingerprint TEXT NOT NULL,
created_at TIMESTAMP NOT NULL
);
CREATE UNIQUE INDEX blocklist_fingerprint_merchant_id_fingerprint_id_index
ON blocklist_fingerprint (merchant_id, fingerprint_id);
| 124 | 364 |
hyperswitch | migrations/2023-12-11-075542_create_pm_fingerprint_table/down.sql | .sql | -- This file should undo anything in `up.sql`
DROP TABLE blocklist_fingerprint;
DROP TYPE "BlocklistDataKind";
| 26 | 365 |
hyperswitch | migrations/2024-07-15-143920_change_primary_key_for_mandate/up.sql | .sql | -- Your SQL goes here
-- The below query will lock the mandate table
-- Running this query is not necessary on higher environments
-- as the application will work fine without these queries being run
-- This query is necessary for the application to not use id in update of mandate
-- This query should be run only after the new version of application is deployed
ALTER TABLE mandate DROP CONSTRAINT mandate_pkey;
-- Use the `mandate_id` column as primary key
ALTER TABLE mandate
ADD PRIMARY KEY (mandate_id);
| 107 | 366 |
hyperswitch | migrations/2024-07-15-143920_change_primary_key_for_mandate/down.sql | .sql | ALTER TABLE mandate DROP CONSTRAINT mandate_pkey;
ALTER TABLE mandate ADD PRIMARY KEY (id); | 18 | 367 |
hyperswitch | migrations/2023-10-19-071731_add_connector_id_to_payment_attempt/up.sql | .sql | -- Your SQL goes here
-- The type is VARCHAR(32) as this will store the merchant_connector_account id
-- which will be generated by the application using default length
ALTER TABLE payment_attempt
ADD COLUMN IF NOT EXISTS merchant_connector_id VARCHAR(32);
| 55 | 368 |
hyperswitch | migrations/2023-10-19-071731_add_connector_id_to_payment_attempt/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_attempt DROP COLUMN IF EXISTS connector_id;
| 22 | 369 |
hyperswitch | migrations/2024-06-12-060604_add_customer_details_in_payment_intent/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS customer_details BYTEA DEFAULT NULL;
| 22 | 370 |
hyperswitch | migrations/2024-06-12-060604_add_customer_details_in_payment_intent/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_intent DROP COLUMN IF EXISTS customer_details;
| 22 | 371 |
hyperswitch | migrations/2023-04-21-100150_create_index_for_api_keys/up.sql | .sql | CREATE UNIQUE INDEX api_keys_merchant_id_key_id_index ON api_keys (merchant_id, key_id); | 21 | 372 |
hyperswitch | migrations/2023-04-21-100150_create_index_for_api_keys/down.sql | .sql | DROP INDEX api_keys_merchant_id_key_id_index; | 11 | 373 |
hyperswitch | migrations/2024-11-28-103344_add_split_refunds/up.sql | .sql | -- Your SQL goes here
ALTER TABLE refund ADD COLUMN IF NOT EXISTS split_refunds jsonb; | 20 | 374 |
hyperswitch | migrations/2024-11-28-103344_add_split_refunds/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE refund DROP COLUMN IF EXISTS split_refunds;
| 22 | 375 |
hyperswitch | migrations/2023-11-07-110139_add_gsm_table/up.sql | .sql | -- Your SQL goes here
-- Tables
CREATE TABLE IF NOT EXISTS gateway_status_map (
connector VARCHAR(64) NOT NULL,
flow VARCHAR(64) NOT NULL,
sub_flow VARCHAR(64) NOT NULL,
code VARCHAR(255) NOT NULL,
message VARCHAR(1024),
status VARCHAR(64) NOT NULL,
router_error VARCHAR(64),
decision VARCHAR(64) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP,
last_modified TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP,
step_up_possible BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (connector, flow, sub_flow, code, message)
);
| 149 | 376 |
hyperswitch | migrations/2023-11-07-110139_add_gsm_table/down.sql | .sql | -- Tables
DROP TABLE gateway_status_map;
| 9 | 377 |
hyperswitch | migrations/2024-03-11-102743_add_additional_authentication_fields/up.sql | .sql | -- Your SQL goes here
ALTER TABLE authentication
ADD COLUMN IF NOT EXISTS maximum_supported_version JSONB,
ADD COLUMN IF NOT EXISTS threeds_server_transaction_id VARCHAR(64),
ADD COLUMN IF NOT EXISTS cavv VARCHAR(64),
ADD COLUMN IF NOT EXISTS authentication_flow_type VARCHAR(64),
ADD COLUMN IF NOT EXISTS message_version JSONB,
ADD COLUMN IF NOT EXISTS eci VARCHAR(64),
ADD COLUMN IF NOT EXISTS trans_status VARCHAR(64),
ADD COLUMN IF NOT EXISTS acquirer_bin VARCHAR(64),
ADD COLUMN IF NOT EXISTS acquirer_merchant_id VARCHAR(64),
ADD COLUMN IF NOT EXISTS three_ds_method_data VARCHAR,
ADD COLUMN IF NOT EXISTS three_ds_method_url VARCHAR,
ADD COLUMN IF NOT EXISTS acs_url VARCHAR,
ADD COLUMN IF NOT EXISTS challenge_request VARCHAR,
ADD COLUMN IF NOT EXISTS acs_reference_number VARCHAR,
ADD COLUMN IF NOT EXISTS acs_trans_id VARCHAR,
ADD COLUMN IF NOT EXISTS three_dsserver_trans_id VARCHAR,
ADD COLUMN IF NOT EXISTS acs_signed_content VARCHAR,
ADD COLUMN IF NOT EXISTS connector_metadata JSONB; | 221 | 378 |
hyperswitch | migrations/2024-03-11-102743_add_additional_authentication_fields/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE authentication
DROP COLUMN IF EXISTS maximum_supported_version ,
DROP COLUMN IF EXISTS threeds_server_transaction_id ,
DROP COLUMN IF EXISTS cavv ,
DROP COLUMN IF EXISTS authentication_flow_type ,
DROP COLUMN IF EXISTS message_version ,
DROP COLUMN IF EXISTS eci ,
DROP COLUMN IF EXISTS trans_status ,
DROP COLUMN IF EXISTS acquirer_bin ,
DROP COLUMN IF EXISTS acquirer_merchant_id ,
DROP COLUMN IF EXISTS three_ds_method_data ,
DROP COLUMN IF EXISTS three_ds_method_url ,
DROP COLUMN IF EXISTS acs_url ,
DROP COLUMN IF EXISTS challenge_request ,
DROP COLUMN IF EXISTS acs_reference_number ,
DROP COLUMN IF EXISTS acs_trans_id ,
DROP COLUMN IF EXISTS three_dsserver_trans_id ,
DROP COLUMN IF EXISTS acs_signed_content;
| 159 | 379 |
hyperswitch | migrations/2023-08-08-144148_add_business_profile_table/up.sql | .sql | -- Your SQL goes here
CREATE TABLE IF NOT EXISTS business_profile (
profile_id VARCHAR(64) PRIMARY KEY,
merchant_id VARCHAR(64) NOT NULL,
profile_name VARCHAR(64) NOT NULL,
created_at TIMESTAMP NOT NULL,
modified_at TIMESTAMP NOT NULL,
return_url TEXT,
enable_payment_response_hash BOOLEAN NOT NULL DEFAULT TRUE,
payment_response_hash_key VARCHAR(255) DEFAULT NULL,
redirect_to_merchant_with_http_post BOOLEAN NOT NULL DEFAULT FALSE,
webhook_details JSON,
metadata JSON,
routing_algorithm JSON,
intent_fulfillment_time BIGINT,
frm_routing_algorithm JSONB,
payout_routing_algorithm JSONB,
is_recon_enabled BOOLEAN NOT NULL DEFAULT FALSE
);
| 154 | 380 |
hyperswitch | migrations/2023-08-08-144148_add_business_profile_table/down.sql | .sql | -- This file should undo anything in `up.sql`
DROP TABLE IF EXISTS business_profile;
| 18 | 381 |
hyperswitch | migrations/2025-02-11-062329_add-product-type-column-merchant-account/up.sql | .sql | -- Your SQL goes here
ALTER TABLE merchant_account
ADD COLUMN IF NOT EXISTS product_type VARCHAR(64); | 23 | 382 |
hyperswitch | migrations/2025-02-11-062329_add-product-type-column-merchant-account/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE merchant_account DROP product_type; | 19 | 383 |
hyperswitch | migrations/2025-02-06-111828_drop_int_id_column_accross_database/up.sql | .sql | -- This file contains queries to re-create the `id` column as a `VARCHAR` column instead of `SERIAL` column for tables that already have it.
-- It must be ensured that the deployed version of the application does not include the `id` column in any of its queries.
-- Drop the id column as this will be used later as the primary key with a different type
------------------------ Merchant Account -----------------------
ALTER TABLE merchant_account DROP COLUMN IF EXISTS id;
------------------------ Merchant Connector Account -----------------------
ALTER TABLE merchant_connector_account DROP COLUMN IF EXISTS id;
------------------------ Customers -----------------------
ALTER TABLE customers DROP COLUMN IF EXISTS id;
------------------------ Payment Intent -----------------------
ALTER TABLE payment_intent DROP COLUMN id;
------------------------ Payment Attempt -----------------------
ALTER TABLE payment_attempt DROP COLUMN id;
------------------------ Payment Methods -----------------------
ALTER TABLE payment_methods DROP COLUMN IF EXISTS id;
------------------------ Address -----------------------
ALTER TABLE address DROP COLUMN IF EXISTS id;
------------------------ Dispute -----------------------
ALTER TABLE dispute DROP COLUMN IF EXISTS id;
------------------------ Mandate -----------------------
ALTER TABLE mandate DROP COLUMN IF EXISTS id;
------------------------ Refund -----------------------
ALTER TABLE refund DROP COLUMN IF EXISTS id;
------------------------ BlockList -----------------------
ALTER TABLE blocklist DROP COLUMN IF EXISTS id;
------------------------ Roles -----------------------
ALTER TABLE roles DROP COLUMN IF EXISTS id;
------------------------ Users -----------------------
ALTER TABLE users DROP COLUMN IF EXISTS id;
| 274 | 384 |
hyperswitch | migrations/2025-02-06-111828_drop_int_id_column_accross_database/down.sql | .sql | -- This file contains queries to re-create the `id` column as a `VARCHAR(64)` column for tables that had it removed.
-- It must be ensured that the deployed version of the application includes the `id` column in any of its queries.
-- Re-create the id column as this was used as the primary key with a different type
------------------------ Merchant Account -----------------------
ALTER TABLE merchant_account ADD COLUMN id VARCHAR(64);
------------------------ Merchant Connector Account -----------------------
ALTER TABLE merchant_connector_account ADD COLUMN id VARCHAR(64);
------------------------ Customers -----------------------
ALTER TABLE customers ADD COLUMN id VARCHAR(64);
------------------------ Payment Intent -----------------------
ALTER TABLE payment_intent ADD COLUMN id VARCHAR(64);
------------------------ Payment Attempt -----------------------
ALTER TABLE payment_attempt ADD COLUMN id VARCHAR(64);
------------------------ Payment Methods -----------------------
ALTER TABLE payment_methods ADD COLUMN id VARCHAR(64);
------------------------ Address -----------------------
ALTER TABLE address ADD COLUMN id VARCHAR(64);
------------------------ Dispute -----------------------
ALTER TABLE dispute ADD COLUMN id VARCHAR(64);
------------------------ Mandate -----------------------
ALTER TABLE mandate ADD COLUMN id VARCHAR(64);
------------------------ Refund -----------------------
ALTER TABLE refund ADD COLUMN id VARCHAR(64);
------------------------ BlockList -----------------------
ALTER TABLE blocklist ADD COLUMN id VARCHAR(64);
------------------------ Roles -----------------------
ALTER TABLE roles ADD COLUMN id VARCHAR(64);
------------------------ Users -----------------------
ALTER TABLE users ADD COLUMN id VARCHAR(64);
| 297 | 385 |
hyperswitch | migrations/2023-11-06-110233_create_user_table/up.sql | .sql | -- Your SQL goes here
CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
user_id VARCHAR(64) NOT NULL UNIQUE,
email VARCHAR(255) NOT NULL UNIQUE,
name VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
is_verified bool NOT NULL DEFAULT false,
created_at TIMESTAMP NOT NULL DEFAULT now(),
last_modified_at TIMESTAMP NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX IF NOT EXISTS user_id_index ON users (user_id);
CREATE UNIQUE INDEX IF NOT EXISTS user_email_index ON users (email); | 123 | 386 |
hyperswitch | migrations/2023-11-06-110233_create_user_table/down.sql | .sql | -- This file should undo anything in `up.sql`
DROP TABLE users; | 15 | 387 |
hyperswitch | migrations/2023-04-05-121040_alter_mca_change_country_to_enum/up.sql | .sql | ALTER TABLE merchant_connector_account
ALTER COLUMN business_country TYPE "CountryCode" USING business_country::"CountryCode";
| 23 | 388 |
hyperswitch | migrations/2023-04-05-121040_alter_mca_change_country_to_enum/down.sql | .sql | ALTER TABLE merchant_connector_account
ALTER COLUMN business_country TYPE VARCHAR(2);
| 15 | 389 |
hyperswitch | migrations/2024-09-05-155712_add_new_variant_in_routing_algorithm_kind_type/up.sql | .sql | -- Your SQL goes here
ALTER TYPE "RoutingAlgorithmKind" ADD VALUE 'dynamic';
| 18 | 390 |
hyperswitch | migrations/2024-09-05-155712_add_new_variant_in_routing_algorithm_kind_type/down.sql | .sql | -- This file should undo anything in `up.sql`
DELETE FROM pg_enum
WHERE enumlabel = 'dynamic'
AND enumtypid = (
SELECT oid FROM pg_type WHERE typname = 'RoutingAlgorithmKind'
);
| 45 | 391 |
hyperswitch | migrations/2024-02-14-092225_create_roles_table/up.sql | .sql | -- Your SQL goes here
CREATE TYPE "RoleScope" AS ENUM ('merchant','organization');
CREATE TABLE IF NOT EXISTS roles (
id SERIAL PRIMARY KEY,
role_name VARCHAR(64) NOT NULL,
role_id VARCHAR(64) NOT NULL UNIQUE,
merchant_id VARCHAR(64) NOT NULL,
org_id VARCHAR(64) NOT NULL,
groups TEXT[] NOT NULL,
scope "RoleScope" NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT now(),
created_by VARCHAR(64) NOT NULL,
last_modified_at TIMESTAMP NOT NULL DEFAULT now(),
last_modified_by VARCHAR(64) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS role_id_index ON roles (role_id);
CREATE INDEX roles_merchant_org_index ON roles (merchant_id, org_id); | 167 | 392 |
hyperswitch | migrations/2024-02-14-092225_create_roles_table/down.sql | .sql | -- This file should undo anything in `up.sql`
DROP INDEX IF EXISTS role_id_index;
DROP INDEX IF EXISTS roles_merchant_org_index;
DROP TABLE IF EXISTS roles;
DROP TYPE "RoleScope"; | 41 | 393 |
hyperswitch | migrations/2022-12-14-092540_i32_to_i64/up.sql | .sql | -- Your SQL goes here
ALTER TABLE mandate
ALTER COLUMN mandate_amount TYPE bigint,
ALTER COLUMN amount_captured TYPE bigint;
ALTER TABLE payment_attempt
ALTER COLUMN amount TYPE bigint,
ALTER COLUMN offer_amount TYPE bigint,
ALTER COLUMN surcharge_amount TYPE bigint,
ALTER COLUMN tax_amount TYPE bigint,
ALTER COLUMN amount_to_capture TYPE bigint;
ALTER TABLE payment_intent
ALTER COLUMN amount TYPE bigint,
ALTER COLUMN amount_captured TYPE bigint;
ALTER TABLE refund
ALTER COLUMN total_amount TYPE bigint,
ALTER COLUMN refund_amount TYPE bigint;
| 114 | 394 |
hyperswitch | migrations/2022-12-14-092540_i32_to_i64/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE mandate
ALTER COLUMN mandate_amount TYPE integer,
ALTER COLUMN amount_captured TYPE integer;
ALTER TABLE payment_attempt
ALTER COLUMN amount TYPE integer,
ALTER COLUMN offer_amount TYPE integer,
ALTER COLUMN surcharge_amount TYPE integer,
ALTER COLUMN tax_amount TYPE integer,
ALTER COLUMN amount_to_capture TYPE integer;
ALTER TABLE payment_intent
ALTER COLUMN amount TYPE integer,
ALTER COLUMN amount_captured TYPE integer;
ALTER TABLE refund
ALTER COLUMN total_amount TYPE integer,
ALTER COLUMN refund_amount TYPE integer;
| 119 | 395 |
hyperswitch | migrations/2025-02-18-091645_add_api_version_for_process_tracker/up.sql | .sql | -- Your SQL goes here
ALTER TABLE
process_tracker
ADD
COLUMN IF NOT EXISTS version "ApiVersion" NOT NULL DEFAULT 'v1'; | 32 | 396 |
hyperswitch | migrations/2025-02-18-091645_add_api_version_for_process_tracker/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE
process_tracker DROP COLUMN version; | 21 | 397 |
hyperswitch | migrations/2023-09-07-113914_add_amount_capturable_field_payment_attempt/up.sql | .sql | -- Your SQL goes here
ALTER TABLE payment_attempt
ADD COLUMN IF NOT EXISTS amount_capturable BIGINT NOT NULL DEFAULT 0; | 28 | 398 |
hyperswitch | migrations/2023-09-07-113914_add_amount_capturable_field_payment_attempt/down.sql | .sql | -- This file should undo anything in `up.sql`
ALTER TABLE payment_attempt
DROP COLUMN amount_capturable; | 23 | 399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.