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-04-06-092008_create_merchant_ek/up.sql
.sql
CREATE TABLE merchant_key_store( merchant_id VARCHAR(255) NOT NULL PRIMARY KEY, key bytea NOT NULL, created_at TIMESTAMP NOT NULL );
35
500
hyperswitch
migrations/2023-04-06-092008_create_merchant_ek/down.sql
.sql
DROP TABLE merchant_key_store;
6
501
hyperswitch
migrations/2023-02-21-065628_update_merchant_account/up.sql
.sql
ALTER TABLE merchant_account ADD COLUMN IF NOT EXISTS primary_business_details JSON NOT NULL DEFAULT '{"country": ["US"], "business": ["default"]}';
30
502
hyperswitch
migrations/2023-02-21-065628_update_merchant_account/down.sql
.sql
ALTER TABLE merchant_account DROP COLUMN primary_business_details;
11
503
hyperswitch
migrations/2024-12-02-095127_add_new_table_dynamic_routing_stats/up.sql
.sql
--- Your SQL goes here CREATE TYPE "SuccessBasedRoutingConclusiveState" AS ENUM( 'true_positive', 'false_positive', 'true_negative', 'false_negative' ); CREATE TABLE IF NOT EXISTS dynamic_routing_stats ( payment_id VARCHAR(64) NOT NULL, attempt_id VARCHAR(64) NOT NULL, merchant_id VARCHAR(64) NOT NULL, profile_id VARCHAR(64) NOT NULL, amount BIGINT NOT NULL, success_based_routing_connector VARCHAR(64) NOT NULL, payment_connector VARCHAR(64) NOT NULL, currency "Currency", payment_method VARCHAR(64), capture_method "CaptureMethod", authentication_type "AuthenticationType", payment_status "AttemptStatus" NOT NULL, conclusive_classification "SuccessBasedRoutingConclusiveState" NOT NULL, created_at TIMESTAMP NOT NULL, PRIMARY KEY(attempt_id, merchant_id) ); CREATE INDEX profile_id_index ON dynamic_routing_stats (profile_id);
206
504
hyperswitch
migrations/2024-12-02-095127_add_new_table_dynamic_routing_stats/down.sql
.sql
-- This file should undo anything in `up.sql` DROP TABLE IF EXISTS dynamic_routing_stats; DROP TYPE IF EXISTS "SuccessBasedRoutingConclusiveState";
31
505
hyperswitch
migrations/2023-07-01-184850_payment-intent-add-metadata-fields/up.sql
.sql
-- Your SQL goes here ALTER TABLE payment_intent ADD COLUMN allowed_payment_method_types JSON, ADD COLUMN connector_metadata JSON, ADD COLUMN feature_metadata JSON;
31
506
hyperswitch
migrations/2023-07-01-184850_payment-intent-add-metadata-fields/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE payment_intent DROP COLUMN allowed_payment_method_types, DROP COLUMN connector_metadata, DROP COLUMN feature_metadata;
33
507
hyperswitch
migrations/2024-10-24-123318_update-entity-type-column-in-roles/up.sql
.sql
-- Your SQL goes here UPDATE roles SET entity_type = 'merchant' WHERE entity_type IS NULL; ALTER TABLE roles ALTER COLUMN entity_type SET DEFAULT 'merchant'; ALTER TABLE roles ALTER COLUMN entity_type SET NOT NULL;
44
508
hyperswitch
migrations/2024-10-24-123318_update-entity-type-column-in-roles/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE roles ALTER COLUMN entity_type DROP DEFAULT; ALTER TABLE roles ALTER COLUMN entity_type DROP NOT NULL;
32
509
hyperswitch
migrations/2023-08-16-112847_add_profile_id_in_affected_tables/up.sql
.sql
-- Your SQL goes here ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS profile_id VARCHAR(64); ALTER TABLE merchant_connector_account ADD COLUMN IF NOT EXISTS profile_id VARCHAR(64); ALTER TABLE merchant_account ADD COLUMN IF NOT EXISTS default_profile VARCHAR(64); -- Profile id is needed in refunds for listing refunds by business profile ALTER TABLE refund ADD COLUMN IF NOT EXISTS profile_id VARCHAR(64); -- For listing disputes by business profile ALTER TABLE dispute ADD COLUMN IF NOT EXISTS profile_id VARCHAR(64); -- For a similar use case as to payments ALTER TABLE payout_attempt ADD COLUMN IF NOT EXISTS profile_id VARCHAR(64);
139
510
hyperswitch
migrations/2023-08-16-112847_add_profile_id_in_affected_tables/down.sql
.sql
ALTER TABLE payment_intent DROP COLUMN IF EXISTS profile_id; ALTER TABLE merchant_connector_account DROP COLUMN IF EXISTS profile_id; ALTER TABLE merchant_account DROP COLUMN IF EXISTS default_profile; ALTER TABLE refund DROP COLUMN IF EXISTS profile_id; ALTER TABLE dispute DROP COLUMN IF EXISTS profile_id; ALTER TABLE payout_attempt DROP COLUMN IF EXISTS profile_id;
65
511
hyperswitch
migrations/2024-04-24-111807_add-is-connector_agnostic_mit/up.sql
.sql
-- Your SQL goes here ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS is_connector_agnostic_mit_enabled BOOLEAN DEFAULT FALSE;
26
512
hyperswitch
migrations/2024-04-24-111807_add-is-connector_agnostic_mit/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE business_profile DROP COLUMN IF EXISTS is_connector_agnostic_mit_enabled;
27
513
hyperswitch
migrations/2023-04-26-062424_alter_dispute_table/up.sql
.sql
ALTER TABLE dispute ALTER COLUMN challenge_required_by TYPE TIMESTAMP USING dispute_created_at::TIMESTAMP, ALTER COLUMN dispute_created_at TYPE TIMESTAMP USING dispute_created_at::TIMESTAMP, ALTER COLUMN updated_at TYPE TIMESTAMP USING dispute_created_at::TIMESTAMP
47
514
hyperswitch
migrations/2023-04-26-062424_alter_dispute_table/down.sql
.sql
ALTER TABLE dispute ALTER COLUMN challenge_required_by TYPE VARCHAR(255), ALTER COLUMN dispute_created_at TYPE VARCHAR(255), ALTER COLUMN updated_at TYPE VARCHAR(255)
39
515
hyperswitch
migrations/2023-04-04-061926_add_dispute_api_schema/up.sql
.sql
-- Your SQL goes here CREATE TABLE file_metadata ( file_id VARCHAR(64) NOT NULL, merchant_id VARCHAR(255) NOT NULL, file_name VARCHAR(255), file_size INTEGER NOT NULL, file_type VARCHAR(255) NOT NULL, provider_file_id VARCHAR(255), file_upload_provider VARCHAR(255), available BOOLEAN NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP, PRIMARY KEY (file_id, merchant_id) );
112
516
hyperswitch
migrations/2023-04-04-061926_add_dispute_api_schema/down.sql
.sql
DROP TABLE file_metadata;
5
517
hyperswitch
migrations/2025-01-09-135057_add_processor_transaction_data/up.sql
.sql
ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS processor_transaction_data TEXT; ALTER TABLE refund ADD COLUMN IF NOT EXISTS processor_refund_data TEXT; ALTER TABLE refund ADD COLUMN IF NOT EXISTS processor_transaction_data TEXT; ALTER TABLE captures ADD COLUMN IF NOT EXISTS processor_capture_data TEXT;
58
518
hyperswitch
migrations/2025-01-09-135057_add_processor_transaction_data/down.sql
.sql
ALTER TABLE payment_attempt DROP COLUMN IF EXISTS processor_transaction_data; ALTER TABLE refund DROP COLUMN IF EXISTS processor_refund_data; ALTER TABLE refund DROP COLUMN IF EXISTS processor_transaction_data; ALTER TABLE captures DROP COLUMN IF EXISTS processor_capture_data;
47
519
hyperswitch
migrations/2023-10-13-090450_add_updated_by_for_tables/up.sql
.sql
ALTER TABLE payment_intent ADD column updated_by VARCHAR(32) NOT NULL DEFAULT 'postgres_only'; ALTER TABLE payment_attempt ADD column updated_by VARCHAR(32) NOT NULL DEFAULT 'postgres_only'; ALTER TABLE refund ADD column updated_by VARCHAR(32) NOT NULL DEFAULT 'postgres_only'; ALTER TABLE connector_response ADD column updated_by VARCHAR(32) NOT NULL DEFAULT 'postgres_only'; ALTER TABLE reverse_lookup ADD column updated_by VARCHAR(32) NOT NULL DEFAULT 'postgres_only'; ALTER TABLE address ADD column updated_by VARCHAR(32) NOT NULL DEFAULT 'postgres_only';
118
520
hyperswitch
migrations/2023-10-13-090450_add_updated_by_for_tables/down.sql
.sql
ALTER TABLE payment_intent DROP column updated_by; ALTER TABLE payment_attempt DROP column updated_by; ALTER TABLE reverse_lookup DROP column updated_by; ALTER TABLE address DROP column updated_by; ALTER TABLE connector_response DROP column updated_by; ALTER TABLE refund DROP column updated_by;
52
521
hyperswitch
migrations/2025-02-27-171444_add-clear-pan-retries-enabled-to-profile/up.sql
.sql
-- Your SQL goes here ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS is_clear_pan_retries_enabled BOOLEAN NOT NULL DEFAULT FALSE;
27
522
hyperswitch
migrations/2025-02-27-171444_add-clear-pan-retries-enabled-to-profile/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE business_profile DROP COLUMN IF EXISTS is_clear_pan_retries_enabled;
26
523
hyperswitch
migrations/2025-03-21-113624_add-recon-status-enum-variant-dashboard-metadata/up.sql
.sql
-- Your SQL goes here ALTER TYPE "DashboardMetadata" ADD VALUE IF NOT EXISTS 'recon_status';
22
524
hyperswitch
migrations/2025-03-21-113624_add-recon-status-enum-variant-dashboard-metadata/down.sql
.sql
-- This file should undo anything in `up.sql` SELECT 1;
15
525
hyperswitch
migrations/2024-03-16-170320_add_events_indexes/up.sql
.sql
CREATE UNIQUE INDEX events_merchant_id_event_id_index ON events (merchant_id, event_id); CREATE INDEX events_merchant_id_initial_attempt_id_index ON events (merchant_id, initial_attempt_id); CREATE INDEX events_merchant_id_initial_events_index ON events (merchant_id, (event_id = initial_attempt_id)); CREATE INDEX events_business_profile_id_initial_attempt_id_index ON events (business_profile_id, initial_attempt_id); CREATE INDEX events_business_profile_id_initial_events_index ON events ( business_profile_id, (event_id = initial_attempt_id) ); CREATE TYPE "WebhookDeliveryAttempt" AS ENUM ( 'initial_attempt', 'automatic_retry', 'manual_retry' ); ALTER TABLE events ADD COLUMN delivery_attempt "WebhookDeliveryAttempt" DEFAULT NULL;
154
526
hyperswitch
migrations/2024-03-16-170320_add_events_indexes/down.sql
.sql
DROP INDEX events_merchant_id_event_id_index; DROP INDEX events_merchant_id_initial_attempt_id_index; DROP INDEX events_merchant_id_initial_events_index; DROP INDEX events_business_profile_id_initial_attempt_id_index; DROP INDEX events_business_profile_id_initial_events_index; ALTER TABLE events DROP COLUMN delivery_attempt; DROP TYPE "WebhookDeliveryAttempt";
68
527
hyperswitch
migrations/2024-05-15-133715_add_client_info_columns_in_payment_attempts/up.sql
.sql
-- Your SQL goes here ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS client_source VARCHAR(64) DEFAULT NULL; ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS client_version VARCHAR(64) DEFAULT NULL;
44
528
hyperswitch
migrations/2024-05-15-133715_add_client_info_columns_in_payment_attempts/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE payment_attempt DROP COLUMN IF EXISTS client_version; ALTER TABLE payment_attempt DROP COLUMN IF EXISTS client_source;
33
529
hyperswitch
migrations/2022-12-14-162701_update_payment_method/up.sql
.sql
-- Your SQL goes here ALTER TABLE payment_methods ADD COLUMN metadata JSON;
16
530
hyperswitch
migrations/2022-12-14-162701_update_payment_method/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE payment_methods DROP COLUMN metadata;
20
531
hyperswitch
migrations/2024-09-12-112019_add_is_network_tokenization_enabled_in_business_profile/up.sql
.sql
-- Your SQL goes here ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS is_network_tokenization_enabled BOOLEAN NOT NULL DEFAULT FALSE;
26
532
hyperswitch
migrations/2024-09-12-112019_add_is_network_tokenization_enabled_in_business_profile/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE business_profile DROP COLUMN IF EXISTS is_network_tokenization_enabled;
25
533
hyperswitch
migrations/2022-11-24-095709_add_browser_info_to_payment_attempt/up.sql
.sql
ALTER TABLE payment_attempt ADD COLUMN browser_info JSONB DEFAULT NULL;
14
534
hyperswitch
migrations/2022-11-24-095709_add_browser_info_to_payment_attempt/down.sql
.sql
ALTER TABLE payment_attempt DROP COLUMN browser_info;
10
535
hyperswitch
migrations/2024-07-21-120246_add_version_mapping/up.sql
.sql
-- Your SQL goes here CREATE TYPE "ApiVersion" AS ENUM ('v1', 'v2'); ALTER TABLE customers ADD COLUMN IF NOT EXISTS version "ApiVersion" NOT NULL DEFAULT 'v1';
42
536
hyperswitch
migrations/2024-07-21-120246_add_version_mapping/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE customers DROP COLUMN version; DROP TYPE "ApiVersion";
24
537
hyperswitch
migrations/2024-11-15-171347_add_capture_method_sequential_automatic/up.sql
.sql
DO $$ BEGIN IF NOT EXISTS ( SELECT 1 FROM pg_enum WHERE enumlabel = 'sequential_automatic' AND enumtypid = (SELECT oid FROM pg_type WHERE typname = 'CaptureMethod') ) THEN ALTER TYPE "CaptureMethod" ADD VALUE 'sequential_automatic' AFTER 'manual'; END IF; END $$;
80
538
hyperswitch
migrations/2024-11-15-171347_add_capture_method_sequential_automatic/down.sql
.sql
-- This file should undo anything in `up.sql` SELECT 1;
15
539
hyperswitch
migrations/2023-10-23-101023_add_organization_table/up.sql
.sql
-- Your SQL goes here CREATE TABLE IF NOT EXISTS ORGANIZATION ( org_id VARCHAR(32) PRIMARY KEY NOT NULL, org_name TEXT );
34
540
hyperswitch
migrations/2023-10-23-101023_add_organization_table/down.sql
.sql
-- This file should undo anything in `up.sql` DROP TABLE IF EXISTS ORGANIZATION;
19
541
hyperswitch
migrations/2025-01-07-101337_global_sr_connector_dynamic_routing/up.sql
.sql
-- Your SQL goes here ALTER TABLE dynamic_routing_stats ADD COLUMN IF NOT EXISTS global_success_based_connector VARCHAR(64);
26
542
hyperswitch
migrations/2025-01-07-101337_global_sr_connector_dynamic_routing/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE dynamic_routing_stats DROP COLUMN IF EXISTS global_success_based_connector;
26
543
hyperswitch
migrations/2024-02-28-103308_add_dispute_amount_to_dispute/up.sql
.sql
-- Your SQL goes here -- Add the new column with a default value ALTER TABLE dispute ADD COLUMN dispute_amount BIGINT NOT NULL DEFAULT 0; -- Update existing rows to set the default value based on the integer equivalent of the amount column UPDATE dispute SET dispute_amount = CAST(amount AS BIGINT);
64
544
hyperswitch
migrations/2024-02-28-103308_add_dispute_amount_to_dispute/down.sql
.sql
-- This file should undo anything in `up.sql` -- Drop the new column ALTER TABLE dispute DROP COLUMN IF EXISTS dispute_amount; -- Optionally, if you want to revert the UPDATE statement as well (assuming you have a backup) -- You can restore the original data from the backup or use the old values to update the table -- For example, if you have a backup and want to revert the changes made by the UPDATE statement -- You can replace the data with the backup data or the original values -- For demonstration purposes, we're assuming you have a backup table named dispute_backup -- Restore the original values from the backup or any other source -- UPDATE dispute -- SET dispute_amount = backup.dispute_amount -- FROM dispute_backup AS backup -- WHERE dispute.id = backup.id;
163
545
hyperswitch
migrations/2023-10-13-100447_add-payment-cancelled-event-type/up.sql
.sql
-- Your SQL goes here ALTER TYPE "EventType" ADD VALUE 'payment_cancelled';
18
546
hyperswitch
migrations/2023-10-13-100447_add-payment-cancelled-event-type/down.sql
.sql
-- This file should undo anything in `up.sql` Select 1;
15
547
hyperswitch
migrations/2023-03-14-123541_add_cards_info_table/up.sql
.sql
-- Your SQL goes here CREATE TABLE cards_info ( card_iin VARCHAR(16) PRIMARY KEY, card_issuer TEXT, card_network TEXT, card_type TEXT, card_subtype TEXT, card_issuing_country TEXT, bank_code_id VARCHAR(32), bank_code VARCHAR(32), country_code VARCHAR(32), date_created TIMESTAMP NOT NULL, last_updated TIMESTAMP, last_updated_provider TEXT )
96
548
hyperswitch
migrations/2023-03-14-123541_add_cards_info_table/down.sql
.sql
-- This file should undo anything in `up.sql` DROP TABLE IF EXISTS cards_info;
18
549
hyperswitch
migrations/2023-02-28-112730_add_refund_webhook_types/up.sql
.sql
-- Your SQL goes here ALTER TYPE "EventClass" ADD VALUE 'refunds'; ALTER TYPE "EventObjectType" ADD VALUE 'refund_details'; ALTER TYPE "EventType" ADD VALUE 'refund_succeeded'; ALTER TYPE "EventType" ADD VALUE 'refund_failed';
53
550
hyperswitch
migrations/2023-02-28-112730_add_refund_webhook_types/down.sql
.sql
SELECT 1;
4
551
hyperswitch
migrations/2022-12-22-091431_attempt_status_rename/up.sql
.sql
ALTER TYPE "AttemptStatus" RENAME VALUE 'juspay_declined' TO 'router_declined'; ALTER TYPE "AttemptStatus" RENAME VALUE 'pending_vbv' TO 'authentication_successful'; ALTER TYPE "AttemptStatus" RENAME VALUE 'vbv_successful' TO 'authentication_pending';
60
552
hyperswitch
migrations/2022-12-22-091431_attempt_status_rename/down.sql
.sql
ALTER TYPE "AttemptStatus" RENAME VALUE 'router_declined' TO 'juspay_declined'; ALTER TYPE "AttemptStatus" RENAME VALUE 'authentication_successful' TO 'pending_vbv'; ALTER TYPE "AttemptStatus" RENAME VALUE 'authentication_pending' TO 'vbv_successful';
60
553
hyperswitch
migrations/2024-09-10-080050_add_shipping_cost_and_order_tax_amount_to_payment_attempt/up.sql
.sql
-- Your SQL goes here ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS shipping_cost BIGINT; ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS order_tax_amount BIGINT;
36
554
hyperswitch
migrations/2024-09-10-080050_add_shipping_cost_and_order_tax_amount_to_payment_attempt/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE payment_attempt DROP COLUMN IF EXISTS shipping_cost; ALTER TABLE payment_attempt DROP COLUMN IF EXISTS order_tax_amount;
34
555
hyperswitch
migrations/2023-04-03-082335_update_mca_frm_configs/up.sql
.sql
ALTER TABLE "merchant_connector_account" ADD COLUMN frm_configs jsonb;
14
556
hyperswitch
migrations/2023-04-03-082335_update_mca_frm_configs/down.sql
.sql
ALTER TABLE "merchant_connector_account" DROP COLUMN frm_configs;
12
557
hyperswitch
migrations/2022-12-11-190755_update_mock_up/up.sql
.sql
-- Your SQL goes here ALTER TABLE locker_mock_up ADD COLUMN card_cvc VARCHAR(8);
21
558
hyperswitch
migrations/2022-12-11-190755_update_mock_up/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE locker_mock_up DROP COLUMN card_cvc;
23
559
hyperswitch
migrations/2024-07-17-174449_change_primary_key_for_blocklist_table/up.sql
.sql
-- Your SQL goes here -- The below query will lock the blocklist 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 blocklist DROP CONSTRAINT blocklist_pkey; -- Use the `merchant_id, fingerprint_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 blocklist ADD PRIMARY KEY (merchant_id, fingerprint_id);
122
560
hyperswitch
migrations/2024-07-17-174449_change_primary_key_for_blocklist_table/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE blocklist DROP CONSTRAINT blocklist_pkey; ALTER TABLE blocklist ADD PRIMARY KEY (id);
33
561
hyperswitch
migrations/2025-03-25-090203_add_id_column_to_profile_mca/up.sql
.sql
-- Your SQL goes here ALTER TABLE business_profile ADD COLUMN id VARCHAR(64); ALTER TABLE merchant_connector_account ADD COLUMN id VARCHAR(64);
33
562
hyperswitch
migrations/2025-03-25-090203_add_id_column_to_profile_mca/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE business_profile DROP COLUMN id; ALTER TABLE merchant_connector_account DROP COLUMN id;
30
563
hyperswitch
migrations/2023-10-27-064512_alter_payout_profile_id/up.sql
.sql
ALTER TABLE payout_attempt ALTER COLUMN profile_id SET NOT NULL;
20
564
hyperswitch
migrations/2023-10-27-064512_alter_payout_profile_id/down.sql
.sql
ALTER TABLE payout_attempt ALTER COLUMN profile_id DROP NOT NULL;
17
565
hyperswitch
migrations/2024-10-13-182546_add_connector_mandate_id_in_payment_attempt/up.sql
.sql
-- Your SQL goes here ALTER TABLE payment_attempt ADD COLUMN connector_mandate_detail JSONB DEFAULT NULL;
27
566
hyperswitch
migrations/2024-10-13-182546_add_connector_mandate_id_in_payment_attempt/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE payment_attempt DROP COLUMN connector_mandate_detail;
25
567
hyperswitch
migrations/2025-01-27-113914_add_card_testing_guard_config_column_to_business_profile/up.sql
.sql
-- Your SQL goes here ALTER TABLE business_profile ADD COLUMN card_testing_guard_config JSONB DEFAULT NULL; ALTER TABLE business_profile ADD COLUMN card_testing_secret_key BYTEA DEFAULT NULL;
40
568
hyperswitch
migrations/2025-01-27-113914_add_card_testing_guard_config_column_to_business_profile/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE business_profile DROP COLUMN IF EXISTS card_testing_guard_config; ALTER TABLE business_profile DROP COLUMN IF EXISTS card_testing_secret_key;
39
569
hyperswitch
migrations/2023-06-16-073615_add_ron_currency_to_db/up.sql
.sql
-- Your SQL goes here ALTER TYPE "Currency" ADD VALUE IF NOT EXISTS 'RON' AFTER 'QAR'; ALTER TYPE "Currency" ADD VALUE IF NOT EXISTS 'TRY' AFTER 'TTD';
42
570
hyperswitch
migrations/2023-06-16-073615_add_ron_currency_to_db/down.sql
.sql
SELECT 1;
4
571
hyperswitch
migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/up.sql
.sql
-- Your SQL goes here ALTER TABLE authentication ADD COLUMN merchant_connector_id VARCHAR(128) NOT NULL;
23
572
hyperswitch
migrations/2024-04-15-101918_add_merchant_connector_id_in_authentication_table/down.sql
.sql
ALTER TABLE authentication DROP COLUMN IF EXISTS merchant_connector_id;
11
573
hyperswitch
migrations/2024-08-20-112035_add-profile-id-to-txn-tables/up.sql
.sql
-- Your SQL goes here ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS profile_id VARCHAR(64) NOT NULL DEFAULT 'default_profile'; -- Add organization_id to payment_attempt table ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS organization_id VARCHAR(32) NOT NULL DEFAULT 'default_org'; -- Add organization_id to payment_intent table ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS organization_id VARCHAR(32) NOT NULL DEFAULT 'default_org'; -- Add organization_id to refund table ALTER TABLE refund ADD COLUMN IF NOT EXISTS organization_id VARCHAR(32) NOT NULL DEFAULT 'default_org'; -- Add organization_id to dispute table ALTER TABLE dispute ADD COLUMN IF NOT EXISTS organization_id VARCHAR(32) NOT NULL DEFAULT 'default_org'; -- This doesn't work on V2 -- The below backfill step has to be run after the code deployment -- UPDATE payment_attempt pa -- SET organization_id = ma.organization_id -- FROM merchant_account ma -- WHERE pa.merchant_id = ma.merchant_id; -- UPDATE payment_intent pi -- SET organization_id = ma.organization_id -- FROM merchant_account ma -- WHERE pi.merchant_id = ma.merchant_id; -- UPDATE refund r -- SET organization_id = ma.organization_id -- FROM merchant_account ma -- WHERE r.merchant_id = ma.merchant_id; -- UPDATE payment_attempt pa -- SET profile_id = pi.profile_id -- FROM payment_intent pi -- WHERE pa.payment_id = pi.payment_id -- AND pa.merchant_id = pi.merchant_id -- AND pi.profile_id IS NOT NULL;
334
574
hyperswitch
migrations/2024-08-20-112035_add-profile-id-to-txn-tables/down.sql
.sql
-- This file should undo anything in `up.sql` -- Remove profile_id from payment_attempt table ALTER TABLE payment_attempt DROP COLUMN IF EXISTS profile_id; -- Remove organization_id from payment_attempt table ALTER TABLE payment_attempt DROP COLUMN IF EXISTS organization_id; -- Remove organization_id from payment_intent table ALTER TABLE payment_intent DROP COLUMN IF EXISTS organization_id; -- Remove organization_id from refund table ALTER TABLE refund DROP COLUMN IF EXISTS organization_id; -- Remove organization_id from dispute table ALTER TABLE dispute DROP COLUMN IF EXISTS organization_id;
112
575
hyperswitch
migrations/2023-02-02-062215_remove_redirect_and_payment_flow_from_payment_attempt/up.sql
.sql
ALTER TABLE payment_attempt DROP COLUMN IF EXISTS redirect; ALTER TABLE payment_attempt DROP COLUMN IF EXISTS payment_flow; DROP TYPE IF EXISTS "PaymentFlow";
29
576
hyperswitch
migrations/2023-02-02-062215_remove_redirect_and_payment_flow_from_payment_attempt/down.sql
.sql
CREATE TYPE "PaymentFlow" AS ENUM ( 'vsc', 'emi', 'otp', 'upi_intent', 'upi_collect', 'upi_scan_and_pay', 'sdk' ); ALTER TABLE payment_attempt ADD COLUMN payment_flow "PaymentFlow"; ALTER TABLE payment_attempt ADD COLUMN redirect BOOLEAN;
70
577
hyperswitch
migrations/2022-11-30-084736_update-index-in-mca/up.sql
.sql
CREATE UNIQUE INDEX merchant_connector_account_merchant_id_connector_name_index ON merchant_connector_account (merchant_id, connector_name);
23
578
hyperswitch
migrations/2022-11-30-084736_update-index-in-mca/down.sql
.sql
DROP INDEX merchant_connector_account_merchant_id_connector_name_index;
12
579
hyperswitch
migrations/2025-03-10-103959_add_is_debit_routing_enabled_to_profile/up.sql
.sql
-- Your SQL goes here ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS is_debit_routing_enabled BOOLEAN NOT NULL DEFAULT FALSE;
27
580
hyperswitch
migrations/2025-03-10-103959_add_is_debit_routing_enabled_to_profile/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE business_profile DROP COLUMN is_debit_routing_enabled;
24
581
hyperswitch
migrations/2023-11-06-113726_create_user_roles_table/up.sql
.sql
-- Your SQL goes here CREATE TABLE IF NOT EXISTS user_roles ( id SERIAL PRIMARY KEY, user_id VARCHAR(64) NOT NULL, merchant_id VARCHAR(64) NOT NULL, role_id VARCHAR(64) NOT NULL, org_id VARCHAR(64) NOT NULL, status VARCHAR(64) NOT NULL, created_by VARCHAR(64) NOT NULL, last_modified_by VARCHAR(64) NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT now(), last_modified_at TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT user_merchant_unique UNIQUE (user_id, merchant_id) ); CREATE INDEX IF NOT EXISTS user_id_roles_index ON user_roles (user_id); CREATE INDEX IF NOT EXISTS user_mid_roles_index ON user_roles (merchant_id);
162
582
hyperswitch
migrations/2023-11-06-113726_create_user_roles_table/down.sql
.sql
-- This file should undo anything in `up.sql` -- Drop the table DROP TABLE IF EXISTS user_roles;
23
583
hyperswitch
migrations/2023-12-01-090834_add-authorization_count-in-payment_intent/up.sql
.sql
-- Your SQL goes here ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS authorization_count INTEGER;
19
584
hyperswitch
migrations/2023-12-01-090834_add-authorization_count-in-payment_intent/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE payment_intent DROP COLUMN IF EXISTS authorization_count;
22
585
hyperswitch
migrations/2022-12-07-133736_make_connector_field_optional/up.sql
.sql
ALTER TABLE payment_attempt ALTER COLUMN connector DROP NOT NULL; ALTER TABLE connector_response ALTER COLUMN connector_name DROP NOT NULL;
23
586
hyperswitch
migrations/2022-12-07-133736_make_connector_field_optional/down.sql
.sql
ALTER TABLE payment_attempt ALTER COLUMN connector SET NOT NULL; ALTER TABLE connector_response ALTER COLUMN connector_name SET NOT NULL;
23
587
hyperswitch
migrations/2023-07-11-140347_add_is_recon_enabled_field_in_merchant_account/up.sql
.sql
-- Your SQL goes here ALTER TABLE merchant_account ADD COLUMN "is_recon_enabled" BOOLEAN NOT NULL DEFAULT FALSE;
24
588
hyperswitch
migrations/2023-07-11-140347_add_is_recon_enabled_field_in_merchant_account/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE merchant_account DROP COLUMN is_recon_enabled;
22
589
hyperswitch
migrations/2025-03-21-134323_add_merchant_business_country_in_business_profile/up.sql
.sql
-- Your SQL goes here ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS merchant_business_country "CountryAlpha2" DEFAULT NULL;
27
590
hyperswitch
migrations/2025-03-21-134323_add_merchant_business_country_in_business_profile/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE business_profile DROP COLUMN IF EXISTS merchant_business_country;
24
591
hyperswitch
migrations/2023-04-11-084958_pii-migration/up.sql
.sql
-- Your SQL goes here ALTER TABLE merchant_connector_account ALTER COLUMN connector_account_details TYPE bytea USING convert_to(connector_account_details::text, 'UTF8'); ALTER TABLE merchant_account ALTER COLUMN merchant_name TYPE bytea USING convert_to(merchant_name, 'UTF8'), ALTER merchant_details TYPE bytea USING convert_to(merchant_details::text, 'UTF8'); ALTER TABLE address ALTER COLUMN line1 TYPE bytea USING convert_to(line1, 'UTF8'), ALTER COLUMN line2 TYPE bytea USING convert_to(line2, 'UTF8'), ALTER COLUMN line3 TYPE bytea USING convert_to(line3, 'UTF8'), ALTER COLUMN state TYPE bytea USING convert_to(state, 'UTF8'), ALTER COLUMN zip TYPE bytea USING convert_to(zip, 'UTF8'), ALTER COLUMN first_name TYPE bytea USING convert_to(first_name, 'UTF8'), ALTER COLUMN last_name TYPE bytea USING convert_to(last_name, 'UTF8'), ALTER COLUMN phone_number TYPE bytea USING convert_to(phone_number, 'UTF8'); ALTER TABLE customers ALTER COLUMN name TYPE bytea USING convert_to(name, 'UTF8'), ALTER COLUMN email TYPE bytea USING convert_to(email, 'UTF8'), ALTER COLUMN phone TYPE bytea USING convert_to(phone, 'UTF8');
277
592
hyperswitch
migrations/2023-04-11-084958_pii-migration/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE merchant_connector_account ALTER COLUMN connector_account_details TYPE JSON USING convert_from(connector_account_details, 'UTF8')::json; ALTER TABLE merchant_account ALTER COLUMN merchant_name TYPE VARCHAR(128) USING convert_from(merchant_name, 'UTF8')::text, ALTER merchant_details TYPE JSON USING convert_from(merchant_details, 'UTF8')::json; ALTER TABLE address ALTER COLUMN line1 TYPE VARCHAR(255) USING convert_from(line1, 'UTF8')::text, ALTER COLUMN line2 TYPE VARCHAR(255) USING convert_from(line2, 'UTF8')::text, ALTER COLUMN line3 TYPE VARCHAR(255) USING convert_from(line3, 'UTF8')::text, ALTER COLUMN state TYPE VARCHAR(128) USING convert_from(state, 'UTF8')::text, ALTER COLUMN zip TYPE VARCHAR(16) USING convert_from(zip, 'UTF8')::text, ALTER COLUMN first_name TYPE VARCHAR(255) USING convert_from(first_name, 'UTF8')::text, ALTER COLUMN last_name TYPE VARCHAR(255) USING convert_from(last_name, 'UTF8')::text, ALTER COLUMN phone_number TYPE VARCHAR(32) USING convert_from(phone_number, 'UTF8')::text; ALTER TABLE customers ALTER COLUMN name TYPE VARCHAR(255) USING convert_from(name, 'UTF8')::text, ALTER COLUMN email TYPE VARCHAR(255) USING convert_from(email, 'UTF8')::text, ALTER COLUMN phone TYPE VARCHAR(32) USING convert_from(phone, 'UTF8')::text;
363
593
hyperswitch
migrations/2024-07-19-100936_change_primary_key_for_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 roles DROP CONSTRAINT roles_pkey; -- Use the `role_id` column as primary key -- These are already unique, not null column -- So this query should not fail for not null or duplicate value reasons ALTER TABLE roles ADD PRIMARY KEY (role_id);
113
594
hyperswitch
migrations/2024-07-19-100936_change_primary_key_for_roles/down.sql
.sql
-- This file should undo anything in `up.sql` ALTER TABLE roles DROP CONSTRAINT roles_pkey; ALTER TABLE roles ADD PRIMARY KEY (id);
30
595
hyperswitch
migrations/2022-12-14-090419_add_payment_token_in_payment_attempt/up.sql
.sql
ALTER TABLE payment_attempt ADD COLUMN payment_token VARCHAR(255);
14
596
hyperswitch
migrations/2022-12-14-090419_add_payment_token_in_payment_attempt/down.sql
.sql
ALTER TABLE payment_attempt DROP COLUMN payment_token;
9
597
hyperswitch
migrations/2024-07-17-064610_add_allowed_domains_to_link_data/up.sql
.sql
UPDATE generic_link SET link_data = jsonb_set(link_data, '{allowed_domains}', '["*"]'::jsonb) WHERE NOT link_data ? 'allowed_domains' AND link_type = 'payout_link';
48
598
hyperswitch
migrations/2024-07-17-064610_add_allowed_domains_to_link_data/down.sql
.sql
UPDATE generic_link SET link_data = link_data - 'allowed_domains' WHERE link_data -> 'allowed_domains' = '["*"]'::jsonb AND link_type = 'payout_link';
41
599