feat(실적): 틱톡 탭 삭제 + [말레이시아 실적] 모듈 추가
- 실적 틱톡 탭·tiktok_ads 광고 API·테스트 삭제, 틱톡 데이터 삭제 SQL(performance_db 012) - 말레이시아 실적: 실적 라우터·화면을 /malaysia/performance 에 한 번 더 마운트, 차이는 performance/variant.py(KR·MY) 한 곳 — 저장소·권한키·주소·광고 채널·통화 - 틱톡·쇼피·라자다 그룹(쇼핑몰 + 라이브커머스 하위, 그룹 열 = 합계), 광고비 채널 3개 - 금액 RM 소수 2자리 = 센 정수 저장(입력·엑셀 scale, 화면 num/money, JS money) - malaysia_performance_db = performance_db 구조 복사 + seed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
-- =====================================================================
|
||||
-- malaysia_performance_db 쇼핑몰 seed — [말레이시아 실적](2026-11-20)
|
||||
-- =====================================================================
|
||||
-- 말레이시아 실적은 실적 모듈 코드를 그대로 쓰므로 표 구조 = performance_db(마이그레이션 012 까지)와 같다.
|
||||
-- 그래서 DB 를 만들 때 performance_db 의 **구조만**(데이터 없이) 복사하고, 이 파일로 쇼핑몰만 넣는다.
|
||||
-- 멱등(ON CONFLICT DO NOTHING). DROP/DELETE 없음. 역할은 실적과 같은 performance_app 을 쓴다.
|
||||
--
|
||||
-- 실행 순서(운영 PostgreSQL 컨테이너 postgres-db, 경로 /opt/www/main — 사용자 승인 후):
|
||||
-- 1) 빈 DB 만들기 + 접속 권한
|
||||
-- docker exec -i postgres-db psql -U postgres -c "CREATE DATABASE malaysia_performance_db ENCODING 'UTF8' TEMPLATE template0"
|
||||
-- docker exec -i postgres-db psql -U postgres -c "GRANT CONNECT ON DATABASE malaysia_performance_db TO performance_app"
|
||||
-- 2) performance_db 구조만 복사(표·인덱스·트리거·권한, 데이터 없음)
|
||||
-- docker exec postgres-db pg_dump -U postgres --schema-only performance_db \
|
||||
-- | docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d malaysia_performance_db
|
||||
-- 3) 이 파일
|
||||
-- docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d malaysia_performance_db < scripts/sql/malaysia_performance_db_seed.sql
|
||||
-- 4) .env 에 MALAYSIA_PERFORMANCE_DB_URL=postgresql://performance_app:<실적과 같은 비밀번호>@postgres-db:5432/malaysia_performance_db
|
||||
--
|
||||
-- 코드는 app/modules/performance/variant.py MY 와 같아야 한다(광고비 ROAS·매출 칸 아래 광고비 줄이 이 코드로 찾음).
|
||||
-- group_<쇼핑몰> = 합계 열(매출 없음), custom_<쇼핑몰>_shop = 쇼핑몰 매출, custom_<쇼핑몰>_live = 라이브커머스 매출.
|
||||
-- 금액은 센(0.01 RM) 정수로 저장된다(화면 = RM 소수 2자리).
|
||||
-- =====================================================================
|
||||
|
||||
\set ON_ERROR_STOP on
|
||||
|
||||
INSERT INTO perf_marketplaces (code, name, sort_order, manual_input, include_in_sales, is_custom, is_group, parent_code) VALUES
|
||||
('group_tiktok', '틱톡', 10, FALSE, FALSE, TRUE, TRUE, NULL),
|
||||
('custom_tiktok_shop', '틱톡 쇼핑몰', 11, TRUE, TRUE, TRUE, FALSE, 'group_tiktok'),
|
||||
('custom_tiktok_live', '틱톡 라이브커머스', 12, TRUE, TRUE, TRUE, FALSE, 'group_tiktok'),
|
||||
('group_shopee', '쇼피', 20, FALSE, FALSE, TRUE, TRUE, NULL),
|
||||
('custom_shopee_shop', '쇼피 쇼핑몰', 21, TRUE, TRUE, TRUE, FALSE, 'group_shopee'),
|
||||
('custom_shopee_live', '쇼피 라이브커머스', 22, TRUE, TRUE, TRUE, FALSE, 'group_shopee'),
|
||||
('group_lazada', '라자다', 30, FALSE, FALSE, TRUE, TRUE, NULL),
|
||||
('custom_lazada_shop', '라자다 쇼핑몰', 31, TRUE, TRUE, TRUE, FALSE, 'group_lazada'),
|
||||
('custom_lazada_live', '라자다 라이브커머스', 32, TRUE, TRUE, TRUE, FALSE, 'group_lazada')
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
|
||||
SELECT 'malaysia_performance_db seed ready' AS status;
|
||||
Reference in New Issue
Block a user