feat(channel-donation-calculate): 채널 후원 정산 조회 기능을 추가한다
This commit is contained in:
49
docs/20260226_channel_donation_settlement_index_ddl.sql
Normal file
49
docs/20260226_channel_donation_settlement_index_ddl.sql
Normal file
@@ -0,0 +1,49 @@
|
||||
SET @schema_name := DATABASE();
|
||||
|
||||
SET @use_can_index_exists := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = @schema_name
|
||||
AND table_name = 'use_can'
|
||||
AND index_name = 'idx_use_can_channel_donation_filter'
|
||||
);
|
||||
SET @use_can_index_sql := IF(
|
||||
@use_can_index_exists = 0,
|
||||
'ALTER TABLE use_can ADD INDEX idx_use_can_channel_donation_filter (can_usage, is_refund, created_at, id)',
|
||||
'SELECT "idx_use_can_channel_donation_filter already exists"'
|
||||
);
|
||||
PREPARE use_can_index_stmt FROM @use_can_index_sql;
|
||||
EXECUTE use_can_index_stmt;
|
||||
DEALLOCATE PREPARE use_can_index_stmt;
|
||||
|
||||
SET @use_can_calculate_join_index_exists := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = @schema_name
|
||||
AND table_name = 'use_can_calculate'
|
||||
AND index_name = 'idx_use_can_calculate_settlement_join'
|
||||
);
|
||||
SET @use_can_calculate_join_index_sql := IF(
|
||||
@use_can_calculate_join_index_exists = 0,
|
||||
'ALTER TABLE use_can_calculate ADD INDEX idx_use_can_calculate_settlement_join (use_can_id, status, recipient_creator_id)',
|
||||
'SELECT "idx_use_can_calculate_settlement_join already exists"'
|
||||
);
|
||||
PREPARE use_can_calculate_join_index_stmt FROM @use_can_calculate_join_index_sql;
|
||||
EXECUTE use_can_calculate_join_index_stmt;
|
||||
DEALLOCATE PREPARE use_can_calculate_join_index_stmt;
|
||||
|
||||
SET @use_can_calculate_creator_index_exists := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = @schema_name
|
||||
AND table_name = 'use_can_calculate'
|
||||
AND index_name = 'idx_use_can_calculate_creator_settlement'
|
||||
);
|
||||
SET @use_can_calculate_creator_index_sql := IF(
|
||||
@use_can_calculate_creator_index_exists = 0,
|
||||
'ALTER TABLE use_can_calculate ADD INDEX idx_use_can_calculate_creator_settlement (recipient_creator_id, status, use_can_id)',
|
||||
'SELECT "idx_use_can_calculate_creator_settlement already exists"'
|
||||
);
|
||||
PREPARE use_can_calculate_creator_index_stmt FROM @use_can_calculate_creator_index_sql;
|
||||
EXECUTE use_can_calculate_creator_index_stmt;
|
||||
DEALLOCATE PREPARE use_can_calculate_creator_index_stmt;
|
||||
Reference in New Issue
Block a user