v0.5.3-pre.003
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_keys_index_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_keys_index_non_negative to k_sol_core_account_keys when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_keys_index_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_account_keys')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_keys ADD CONSTRAINT ck_k_sol_core_account_keys_index_non_negative CHECK (account_index >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_keys_key_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_keys_key_not_empty to k_sol_core_account_keys when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_keys_key_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_account_keys')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_keys ADD CONSTRAINT ck_k_sol_core_account_keys_key_not_empty CHECK (length(btrim(account_key)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_keys_signature_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_keys_signature_not_empty to k_sol_core_account_keys when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_keys_signature_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_account_keys')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_keys ADD CONSTRAINT ck_k_sol_core_account_keys_signature_not_empty CHECK (length(btrim(signature)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_keys_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_keys_slot_non_negative to k_sol_core_account_keys when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_keys_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_account_keys')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_keys ADD CONSTRAINT ck_k_sol_core_account_keys_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_keys_source.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_keys_source to k_sol_core_account_keys when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_keys_source'
|
||||
AND conrelid = to_regclass('k_sol_core_account_keys')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_keys ADD CONSTRAINT ck_k_sol_core_account_keys_source CHECK (source IN ('static', 'loaded_writable', 'loaded_readonly'));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_states_account_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_states_account_not_empty to k_sol_core_account_states when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_states_account_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_account_states')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_states ADD CONSTRAINT ck_k_sol_core_account_states_account_not_empty CHECK (length(btrim(account_key)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_states_hash_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_states_hash_not_empty to k_sol_core_account_states when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_states_hash_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_account_states')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_states ADD CONSTRAINT ck_k_sol_core_account_states_hash_not_empty CHECK (length(btrim(data_hash)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_states_lamports_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_states_lamports_non_negative to k_sol_core_account_states when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_states_lamports_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_account_states')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_states ADD CONSTRAINT ck_k_sol_core_account_states_lamports_non_negative CHECK (lamports >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_states_owner_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_states_owner_not_empty to k_sol_core_account_states when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_states_owner_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_account_states')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_states ADD CONSTRAINT ck_k_sol_core_account_states_owner_not_empty CHECK (length(btrim(owner)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_states_rent_epoch_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_states_rent_epoch_non_negative to k_sol_core_account_states when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_states_rent_epoch_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_account_states')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_states ADD CONSTRAINT ck_k_sol_core_account_states_rent_epoch_non_negative CHECK (rent_epoch >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_states_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_states_slot_non_negative to k_sol_core_account_states when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_states_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_account_states')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_states ADD CONSTRAINT ck_k_sol_core_account_states_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_account_states_space_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_account_states_space_non_negative to k_sol_core_account_states when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_account_states_space_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_account_states')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_account_states ADD CONSTRAINT ck_k_sol_core_account_states_space_non_negative CHECK (space >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_balance_changes_account_index_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_balance_changes_account_index_non_negative to k_sol_core_balance_changes when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_balance_changes_account_index_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_balance_changes')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_balance_changes ADD CONSTRAINT ck_k_sol_core_balance_changes_account_index_non_negative CHECK (account_index IS NULL OR account_index >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_balance_changes_account_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_balance_changes_account_not_empty to k_sol_core_balance_changes when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_balance_changes_account_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_balance_changes')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_balance_changes ADD CONSTRAINT ck_k_sol_core_balance_changes_account_not_empty CHECK (account_key IS NULL OR length(btrim(account_key)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_balance_changes_index_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_balance_changes_index_non_negative to k_sol_core_balance_changes when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_balance_changes_index_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_balance_changes')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_balance_changes ADD CONSTRAINT ck_k_sol_core_balance_changes_index_non_negative CHECK (balance_change_index >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_balance_changes_kind.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_balance_changes_kind to k_sol_core_balance_changes when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_balance_changes_kind'
|
||||
AND conrelid = to_regclass('k_sol_core_balance_changes')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_balance_changes ADD CONSTRAINT ck_k_sol_core_balance_changes_kind CHECK (balance_kind IN ('native_lamports', 'token_amount'));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_balance_changes_mint_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_balance_changes_mint_not_empty to k_sol_core_balance_changes when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_balance_changes_mint_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_balance_changes')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_balance_changes ADD CONSTRAINT ck_k_sol_core_balance_changes_mint_not_empty CHECK (mint IS NULL OR length(btrim(mint)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_balance_changes_owner_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_balance_changes_owner_not_empty to k_sol_core_balance_changes when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_balance_changes_owner_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_balance_changes')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_balance_changes ADD CONSTRAINT ck_k_sol_core_balance_changes_owner_not_empty CHECK (owner IS NULL OR length(btrim(owner)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_balance_changes_signature_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_balance_changes_signature_not_empty to k_sol_core_balance_changes when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_balance_changes_signature_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_balance_changes')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_balance_changes ADD CONSTRAINT ck_k_sol_core_balance_changes_signature_not_empty CHECK (length(btrim(signature)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_balance_changes_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_balance_changes_slot_non_negative to k_sol_core_balance_changes when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_balance_changes_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_balance_changes')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_balance_changes ADD CONSTRAINT ck_k_sol_core_balance_changes_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_inner_instructions_parent_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_inner_instructions_parent_not_empty to k_sol_core_inner_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_inner_instructions_parent_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_inner_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_inner_instructions ADD CONSTRAINT ck_k_sol_core_inner_instructions_parent_not_empty CHECK (length(btrim(parent_instruction_path)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_inner_instructions_path_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_inner_instructions_path_not_empty to k_sol_core_inner_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_inner_instructions_path_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_inner_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_inner_instructions ADD CONSTRAINT ck_k_sol_core_inner_instructions_path_not_empty CHECK (length(btrim(instruction_path)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_inner_instructions_processing_state.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_inner_instructions_processing_state to k_sol_core_inner_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_inner_instructions_processing_state'
|
||||
AND conrelid = to_regclass('k_sol_core_inner_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_inner_instructions ADD CONSTRAINT ck_k_sol_core_inner_instructions_processing_state CHECK (processing_state IN ('pending', 'decoded', 'materialized', 'ignored', 'failed', 'replay_requested'));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_inner_instructions_processor_pair.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_inner_instructions_processor_pair to k_sol_core_inner_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_inner_instructions_processor_pair'
|
||||
AND conrelid = to_regclass('k_sol_core_inner_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_inner_instructions ADD CONSTRAINT ck_k_sol_core_inner_instructions_processor_pair CHECK ((processor_name IS NULL AND processor_version IS NULL) OR (length(btrim(processor_name)) > 0 AND length(btrim(processor_version)) > 0));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_inner_instructions_program_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_inner_instructions_program_not_empty to k_sol_core_inner_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_inner_instructions_program_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_inner_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_inner_instructions ADD CONSTRAINT ck_k_sol_core_inner_instructions_program_not_empty CHECK (length(btrim(program_id)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_inner_instructions_signature_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_inner_instructions_signature_not_empty to k_sol_core_inner_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_inner_instructions_signature_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_inner_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_inner_instructions ADD CONSTRAINT ck_k_sol_core_inner_instructions_signature_not_empty CHECK (length(btrim(signature)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_inner_instructions_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_inner_instructions_slot_non_negative to k_sol_core_inner_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_inner_instructions_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_inner_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_inner_instructions ADD CONSTRAINT ck_k_sol_core_inner_instructions_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_inner_instructions_stack_height_positive.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_inner_instructions_stack_height_positive to k_sol_core_inner_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_inner_instructions_stack_height_positive'
|
||||
AND conrelid = to_regclass('k_sol_core_inner_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_inner_instructions ADD CONSTRAINT ck_k_sol_core_inner_instructions_stack_height_positive CHECK (stack_height IS NULL OR stack_height > 1);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_instructions_path_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_instructions_path_not_empty to k_sol_core_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_instructions_path_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_instructions ADD CONSTRAINT ck_k_sol_core_instructions_path_not_empty CHECK (length(btrim(instruction_path)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_instructions_processing_state.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_instructions_processing_state to k_sol_core_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_instructions_processing_state'
|
||||
AND conrelid = to_regclass('k_sol_core_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_instructions ADD CONSTRAINT ck_k_sol_core_instructions_processing_state CHECK (processing_state IN ('pending', 'decoded', 'materialized', 'ignored', 'failed', 'replay_requested'));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_instructions_processor_pair.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_instructions_processor_pair to k_sol_core_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_instructions_processor_pair'
|
||||
AND conrelid = to_regclass('k_sol_core_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_instructions ADD CONSTRAINT ck_k_sol_core_instructions_processor_pair CHECK ((processor_name IS NULL AND processor_version IS NULL) OR (length(btrim(processor_name)) > 0 AND length(btrim(processor_version)) > 0));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_instructions_program_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_instructions_program_not_empty to k_sol_core_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_instructions_program_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_instructions ADD CONSTRAINT ck_k_sol_core_instructions_program_not_empty CHECK (length(btrim(program_id)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_instructions_signature_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_instructions_signature_not_empty to k_sol_core_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_instructions_signature_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_instructions ADD CONSTRAINT ck_k_sol_core_instructions_signature_not_empty CHECK (length(btrim(signature)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_instructions_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_instructions_slot_non_negative to k_sol_core_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_instructions_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_instructions ADD CONSTRAINT ck_k_sol_core_instructions_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_instructions_stack_height_positive.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_instructions_stack_height_positive to k_sol_core_instructions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_instructions_stack_height_positive'
|
||||
AND conrelid = to_regclass('k_sol_core_instructions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_instructions ADD CONSTRAINT ck_k_sol_core_instructions_stack_height_positive CHECK (stack_height IS NULL OR stack_height > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_logs_index_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_logs_index_non_negative to k_sol_core_logs when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_logs_index_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_logs')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_logs ADD CONSTRAINT ck_k_sol_core_logs_index_non_negative CHECK (log_index >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_logs_path_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_logs_path_not_empty to k_sol_core_logs when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_logs_path_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_logs')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_logs ADD CONSTRAINT ck_k_sol_core_logs_path_not_empty CHECK (instruction_path IS NULL OR length(btrim(instruction_path)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_logs_program_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_logs_program_not_empty to k_sol_core_logs when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_logs_program_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_logs')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_logs ADD CONSTRAINT ck_k_sol_core_logs_program_not_empty CHECK (program_id IS NULL OR length(btrim(program_id)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_logs_signature_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_logs_signature_not_empty to k_sol_core_logs when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_logs_signature_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_logs')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_logs ADD CONSTRAINT ck_k_sol_core_logs_signature_not_empty CHECK (length(btrim(signature)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_logs_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_logs_slot_non_negative to k_sol_core_logs when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_logs_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_logs')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_logs ADD CONSTRAINT ck_k_sol_core_logs_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_return_data_program_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_return_data_program_not_empty to k_sol_core_return_data when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_return_data_program_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_return_data')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_return_data ADD CONSTRAINT ck_k_sol_core_return_data_program_not_empty CHECK (length(btrim(program_id)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_return_data_signature_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_return_data_signature_not_empty to k_sol_core_return_data when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_return_data_signature_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_return_data')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_return_data ADD CONSTRAINT ck_k_sol_core_return_data_signature_not_empty CHECK (length(btrim(signature)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_return_data_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_return_data_slot_non_negative to k_sol_core_return_data when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_return_data_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_return_data')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_return_data ADD CONSTRAINT ck_k_sol_core_return_data_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_transactions_signature_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_transactions_signature_not_empty to k_sol_core_transactions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_transactions_signature_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_core_transactions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_transactions ADD CONSTRAINT ck_k_sol_core_transactions_signature_not_empty CHECK (length(btrim(signature)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_core_transactions_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_core_transactions_slot_non_negative to k_sol_core_transactions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_core_transactions_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_core_transactions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_core_transactions ADD CONSTRAINT ck_k_sol_core_transactions_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_decode_coverage_observations_counts_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_decode_coverage_observations_counts_non_negative to k_sol_decode_coverage_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_decode_coverage_observations_counts_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_decode_coverage_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_decode_coverage_observations ADD CONSTRAINT ck_k_sol_decode_coverage_observations_counts_non_negative CHECK (decoded_count >= 0 AND materialized_count >= 0 AND error_count >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_decode_coverage_observations_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_decode_coverage_observations_slot_non_negative to k_sol_decode_coverage_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_decode_coverage_observations_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_decode_coverage_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_decode_coverage_observations ADD CONSTRAINT ck_k_sol_decode_coverage_observations_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_decode_events_failed_not_committed.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_decode_events_failed_not_committed to k_sol_decode_events when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_decode_events_failed_not_committed'
|
||||
AND conrelid = to_regclass('k_sol_decode_events')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_decode_events ADD CONSTRAINT ck_k_sol_decode_events_failed_not_committed CHECK (NOT transaction_failed OR NOT observation_committed);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_decode_events_schema_provenance.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_decode_events_schema_provenance to k_sol_decode_events when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_decode_events_schema_provenance'
|
||||
AND conrelid = to_regclass('k_sol_decode_events')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_decode_events ADD CONSTRAINT ck_k_sol_decode_events_schema_provenance CHECK ((schema_kind IS NULL AND schema_id IS NULL AND schema_version IS NULL AND schema_hash IS NULL) OR (length(btrim(schema_kind)) > 0 AND length(btrim(schema_id)) > 0 AND length(btrim(schema_hash)) > 0 AND (schema_version IS NULL OR length(btrim(schema_version)) > 0)));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_decode_events_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_decode_events_slot_non_negative to k_sol_decode_events when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_decode_events_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_decode_events')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_decode_events ADD CONSTRAINT ck_k_sol_decode_events_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_mat_outputs_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_mat_outputs_slot_non_negative to k_sol_mat_outputs when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_mat_outputs_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_mat_outputs')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_mat_outputs ADD CONSTRAINT ck_k_sol_mat_outputs_slot_non_negative CHECK (slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_account_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_account_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_account_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_account_not_empty CHECK (length(btrim(account_key)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_commitment_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_commitment_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_commitment_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_commitment_not_empty CHECK (commitment IS NULL OR length(btrim(commitment)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_endpoint_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_endpoint_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_endpoint_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_endpoint_not_empty CHECK (endpoint_code IS NULL OR length(btrim(endpoint_code)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_error_code_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_error_code_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_error_code_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_error_code_not_empty CHECK (error_code IS NULL OR length(btrim(error_code)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_error_message_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_error_message_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_error_message_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_error_message_not_empty CHECK (error_message IS NULL OR length(btrim(error_message)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_filter_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_filter_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_filter_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_filter_not_empty CHECK (filter_code IS NULL OR length(btrim(filter_code)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_hash_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_hash_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_hash_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_hash_not_empty CHECK (data_hash IS NULL OR length(btrim(data_hash)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_key_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_key_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_key_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_key_not_empty CHECK (length(btrim(observation_key)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_lamports_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_lamports_non_negative to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_lamports_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_lamports_non_negative CHECK (lamports IS NULL OR lamports >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_method_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_method_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_method_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_method_not_empty CHECK (length(btrim(acquisition_method)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_origin.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_origin to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_origin'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_origin CHECK (origin IN ('live', 'backfill', 'replay', 'repair', 'migration'));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_owner_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_owner_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_owner_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_owner_not_empty CHECK (owner IS NULL OR length(btrim(owner)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_payload_size_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_payload_size_non_negative to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_payload_size_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_payload_size_non_negative CHECK (payload_size_bytes IS NULL OR payload_size_bytes >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_protocol_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_protocol_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_protocol_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_protocol_not_empty CHECK (length(btrim(protocol)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_provider_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_provider_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_provider_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_provider_not_empty CHECK (length(btrim(provider)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_rent_epoch_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_rent_epoch_non_negative to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_rent_epoch_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_rent_epoch_non_negative CHECK (rent_epoch IS NULL OR rent_epoch >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_session_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_session_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_session_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_session_not_empty CHECK (capture_session_id IS NULL OR length(btrim(capture_session_id)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_slot_non_negative to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_slot_non_negative CHECK (context_slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_source_hash_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_source_hash_not_empty to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_source_hash_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_source_hash_not_empty CHECK (source_payload_hash IS NULL OR length(btrim(source_payload_hash)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_space_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_space_non_negative to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_space_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_space_non_negative CHECK (space IS NULL OR space >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_state_shape.sql
|
||||
-- version: 1
|
||||
|
||||
-- Require a captured account state to be either complete or absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_state_shape'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_state_shape CHECK ((owner IS NULL AND lamports IS NULL AND executable IS NULL AND rent_epoch IS NULL AND space IS NULL AND data_base64 IS NULL AND data_hash IS NULL) OR (owner IS NOT NULL AND lamports IS NOT NULL AND executable IS NOT NULL AND rent_epoch IS NOT NULL AND space IS NOT NULL AND data_base64 IS NOT NULL AND data_hash IS NOT NULL));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_account_observations_status.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_account_observations_status to k_sol_obs_account_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_account_observations_status'
|
||||
AND conrelid = to_regclass('k_sol_obs_account_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_account_observations ADD CONSTRAINT ck_k_sol_obs_account_observations_status CHECK (status IN ('detected', 'received', 'normalized', 'persisted', 'failed', 'missing'));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_commitment_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_commitment_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_commitment_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_commitment_not_empty CHECK (commitment IS NULL OR length(btrim(commitment)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_endpoint_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_endpoint_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_endpoint_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_endpoint_not_empty CHECK (endpoint_code IS NULL OR length(btrim(endpoint_code)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_error_code_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_error_code_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_error_code_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_error_code_not_empty CHECK (error_code IS NULL OR length(btrim(error_code)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_error_message_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_error_message_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_error_message_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_error_message_not_empty CHECK (error_message IS NULL OR length(btrim(error_message)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_filter_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_filter_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_filter_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_filter_not_empty CHECK (filter_code IS NULL OR length(btrim(filter_code)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_hash_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_hash_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_hash_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_hash_not_empty CHECK (source_payload_hash IS NULL OR length(btrim(source_payload_hash)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_key_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_key_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_key_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_key_not_empty CHECK (length(btrim(observation_key)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_method_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_method_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_method_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_method_not_empty CHECK (length(btrim(acquisition_method)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_origin.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_origin to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_origin'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_origin CHECK (origin IN ('live', 'backfill', 'replay', 'repair', 'migration'));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_payload_size_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_payload_size_non_negative to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_payload_size_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_payload_size_non_negative CHECK (payload_size_bytes IS NULL OR payload_size_bytes >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_protocol_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_protocol_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_protocol_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_protocol_not_empty CHECK (length(btrim(protocol)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_provider_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_provider_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_provider_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_provider_not_empty CHECK (length(btrim(provider)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_session_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_session_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_session_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_session_not_empty CHECK (capture_session_id IS NULL OR length(btrim(capture_session_id)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_signature_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_signature_not_empty to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_signature_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_signature_not_empty CHECK (signature IS NULL OR length(btrim(signature)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_slot_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_slot_non_negative to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_slot_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_slot_non_negative CHECK (slot IS NULL OR slot >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_obs_transaction_observations_status.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_obs_transaction_observations_status to k_sol_obs_transaction_observations when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_obs_transaction_observations_status'
|
||||
AND conrelid = to_regclass('k_sol_obs_transaction_observations')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_obs_transaction_observations ADD CONSTRAINT ck_k_sol_obs_transaction_observations_status CHECK (status IN ('detected', 'received', 'normalized', 'persisted', 'failed', 'missing'));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_ops_processing_ledger_attempt_count_non_negative.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_ops_processing_ledger_attempt_count_non_negative to k_sol_ops_processing_ledger when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_ops_processing_ledger_attempt_count_non_negative'
|
||||
AND conrelid = to_regclass('k_sol_ops_processing_ledger')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_ops_processing_ledger ADD CONSTRAINT ck_k_sol_ops_processing_ledger_attempt_count_non_negative CHECK (attempt_count >= 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_ops_processing_ledger_error_code_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_ops_processing_ledger_error_code_not_empty to k_sol_ops_processing_ledger when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_ops_processing_ledger_error_code_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_ops_processing_ledger')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_ops_processing_ledger ADD CONSTRAINT ck_k_sol_ops_processing_ledger_error_code_not_empty CHECK (error_code IS NULL OR length(btrim(error_code)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_ops_processing_ledger_error_message_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_ops_processing_ledger_error_message_not_empty to k_sol_ops_processing_ledger when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_ops_processing_ledger_error_message_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_ops_processing_ledger')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_ops_processing_ledger ADD CONSTRAINT ck_k_sol_ops_processing_ledger_error_message_not_empty CHECK (error_message IS NULL OR length(btrim(error_message)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_ops_processing_ledger_input_hash_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_ops_processing_ledger_input_hash_not_empty to k_sol_ops_processing_ledger when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_ops_processing_ledger_input_hash_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_ops_processing_ledger')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_ops_processing_ledger ADD CONSTRAINT ck_k_sol_ops_processing_ledger_input_hash_not_empty CHECK (length(btrim(input_hash)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_ops_processing_ledger_input_key_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_ops_processing_ledger_input_key_not_empty to k_sol_ops_processing_ledger when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_ops_processing_ledger_input_key_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_ops_processing_ledger')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_ops_processing_ledger ADD CONSTRAINT ck_k_sol_ops_processing_ledger_input_key_not_empty CHECK (length(btrim(input_key)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_ops_processing_ledger_processor_name_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_ops_processing_ledger_processor_name_not_empty to k_sol_ops_processing_ledger when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_ops_processing_ledger_processor_name_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_ops_processing_ledger')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_ops_processing_ledger ADD CONSTRAINT ck_k_sol_ops_processing_ledger_processor_name_not_empty CHECK (length(btrim(processor_name)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_ops_processing_ledger_processor_version_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_ops_processing_ledger_processor_version_not_empty to k_sol_ops_processing_ledger when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_ops_processing_ledger_processor_version_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_ops_processing_ledger')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_ops_processing_ledger ADD CONSTRAINT ck_k_sol_ops_processing_ledger_processor_version_not_empty CHECK (length(btrim(processor_version)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_ops_processing_ledger_stage_not_empty.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_ops_processing_ledger_stage_not_empty to k_sol_ops_processing_ledger when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_ops_processing_ledger_stage_not_empty'
|
||||
AND conrelid = to_regclass('k_sol_ops_processing_ledger')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_ops_processing_ledger ADD CONSTRAINT ck_k_sol_ops_processing_ledger_stage_not_empty CHECK (length(btrim(stage)) > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_ops_processing_ledger_status.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_ops_processing_ledger_status to k_sol_ops_processing_ledger when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_ops_processing_ledger_status'
|
||||
AND conrelid = to_regclass('k_sol_ops_processing_ledger')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_ops_processing_ledger ADD CONSTRAINT ck_k_sol_ops_processing_ledger_status CHECK (status IN ('running', 'succeeded', 'failed'));
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_raw_transactions_format_version_positive.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_raw_transactions_format_version_positive to k_sol_raw_transactions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_raw_transactions_format_version_positive'
|
||||
AND conrelid = to_regclass('k_sol_raw_transactions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_raw_transactions ADD CONSTRAINT ck_k_sol_raw_transactions_format_version_positive CHECK (canonical_format_version > 0);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- file: migrations/postgres/schema/constraints/add_constraint_if_not_exists_ck_k_sol_raw_transactions_full_has_json.sql
|
||||
-- version: 1
|
||||
|
||||
-- Add ck_k_sol_raw_transactions_full_has_json to k_sol_raw_transactions when absent.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'ck_k_sol_raw_transactions_full_has_json'
|
||||
AND conrelid = to_regclass('k_sol_raw_transactions')
|
||||
) THEN
|
||||
ALTER TABLE k_sol_raw_transactions ADD CONSTRAINT ck_k_sol_raw_transactions_full_has_json CHECK (retention_state <> 'full' OR canonical_json IS NOT NULL);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user