105 lines
6.6 KiB
SQL
105 lines
6.6 KiB
SQL
-- Seed data for development environment
|
||
-- Run after all migrations
|
||
|
||
-- Admin user (password: admin123)
|
||
INSERT INTO users (id, phone, email, password_hash, nickname, kyc_level, role, status) VALUES
|
||
('00000000-0000-0000-0000-000000000001', '13800000001', 'admin@gogenex.com',
|
||
'$2b$10$XkVVYGq8R0HqL8xKxLqNnOQ.pTR9Kf5r0tB3iZxQfHqhLrM0B0xKy',
|
||
'System Admin', 3, 'admin', 'active')
|
||
ON CONFLICT (id) DO NOTHING;
|
||
|
||
-- Test users (password: test123)
|
||
INSERT INTO users (id, phone, email, password_hash, nickname, kyc_level, role, status) VALUES
|
||
('00000000-0000-0000-0000-000000000002', '13800000002', 'user1@test.com',
|
||
'$2b$10$XkVVYGq8R0HqL8xKxLqNnOQ.pTR9Kf5r0tB3iZxQfHqhLrM0B0xKy',
|
||
'Test User 1', 2, 'user', 'active'),
|
||
('00000000-0000-0000-0000-000000000003', '13800000003', 'user2@test.com',
|
||
'$2b$10$XkVVYGq8R0HqL8xKxLqNnOQ.pTR9Kf5r0tB3iZxQfHqhLrM0B0xKy',
|
||
'Test User 2', 1, 'user', 'active'),
|
||
('00000000-0000-0000-0000-000000000004', '13800000004', 'issuer1@test.com',
|
||
'$2b$10$XkVVYGq8R0HqL8xKxLqNnOQ.pTR9Kf5r0tB3iZxQfHqhLrM0B0xKy',
|
||
'Test Issuer 1', 3, 'issuer', 'active'),
|
||
('00000000-0000-0000-0000-000000000005', '13800000005', 'mm@test.com',
|
||
'$2b$10$XkVVYGq8R0HqL8xKxLqNnOQ.pTR9Kf5r0tB3iZxQfHqhLrM0B0xKy',
|
||
'Market Maker 1', 3, 'market_maker', 'active')
|
||
ON CONFLICT (id) DO NOTHING;
|
||
|
||
-- Wallets for all users
|
||
INSERT INTO wallets (user_id, balance, frozen, currency) VALUES
|
||
('00000000-0000-0000-0000-000000000001', 0, 0, 'USD'),
|
||
('00000000-0000-0000-0000-000000000002', 10000.00, 0, 'USD'),
|
||
('00000000-0000-0000-0000-000000000003', 5000.00, 0, 'USD'),
|
||
('00000000-0000-0000-0000-000000000004', 50000.00, 0, 'USD'),
|
||
('00000000-0000-0000-0000-000000000005', 100000.00, 0, 'USD')
|
||
ON CONFLICT (user_id) DO NOTHING;
|
||
|
||
-- Test issuers
|
||
INSERT INTO issuers (id, user_id, company_name, business_license, credit_rating, credit_score, issuance_quota, tier, status) VALUES
|
||
('10000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000004',
|
||
'Genex Coffee Co.', 'BL-2024-001', 'A', 75.00, 500000, 'gold', 'active'),
|
||
('10000000-0000-0000-0000-000000000002', NULL,
|
||
'Digital Mall Inc.', 'BL-2024-002', 'AA', 85.00, 1000000, 'platinum', 'active'),
|
||
('10000000-0000-0000-0000-000000000003', NULL,
|
||
'Fresh Mart Ltd.', 'BL-2024-003', 'BBB', 62.00, 200000, 'silver', 'active'),
|
||
('10000000-0000-0000-0000-000000000004', NULL,
|
||
'Cloud Cinema Group', 'BL-2024-004', 'AAA', 92.00, 2000000, 'diamond', 'active')
|
||
ON CONFLICT (id) DO NOTHING;
|
||
|
||
-- Test stores
|
||
INSERT INTO stores (issuer_id, name, address, phone) VALUES
|
||
('10000000-0000-0000-0000-000000000001', 'Genex Coffee 旗舰店', '上海市浦东新区陆家嘴环路1000号', '021-12345678'),
|
||
('10000000-0000-0000-0000-000000000001', 'Genex Coffee 南京路店', '上海市黄浦区南京东路100号', '021-87654321'),
|
||
('10000000-0000-0000-0000-000000000002', 'Digital Mall 线上商城', 'https://mall.digitalmall.com', '400-123-4567'),
|
||
('10000000-0000-0000-0000-000000000003', 'Fresh Mart 超市总店', '北京市朝阳区建国路88号', '010-11223344'),
|
||
('10000000-0000-0000-0000-000000000004', 'Cloud Cinema IMAX', '深圳市南山区科技园路200号', '0755-55667788')
|
||
ON CONFLICT DO NOTHING;
|
||
|
||
-- Test coupons
|
||
INSERT INTO coupons (id, issuer_id, name, description, face_value, current_price, issue_price, total_supply, remaining_supply, expiry_date, coupon_type, category, status) VALUES
|
||
('20000000-0000-0000-0000-000000000001', '10000000-0000-0000-0000-000000000001',
|
||
'咖啡畅饮券', '任意门店任意饮品一杯', 50.00, 42.50, 45.00, 1000, 800,
|
||
CURRENT_DATE + INTERVAL '180 days', 'utility', '餐饮', 'listed'),
|
||
('20000000-0000-0000-0000-000000000002', '10000000-0000-0000-0000-000000000001',
|
||
'精品手冲体验券', '指定门店精品手冲咖啡体验', 128.00, 108.80, 118.00, 500, 350,
|
||
CURRENT_DATE + INTERVAL '90 days', 'utility', '餐饮', 'listed'),
|
||
('20000000-0000-0000-0000-000000000003', '10000000-0000-0000-0000-000000000002',
|
||
'数码商城100元代金券', '全场通用,满500可用', 100.00, 85.00, 90.00, 5000, 3200,
|
||
CURRENT_DATE + INTERVAL '365 days', 'utility', '购物', 'listed'),
|
||
('20000000-0000-0000-0000-000000000004', '10000000-0000-0000-0000-000000000003',
|
||
'生鲜超市50元券', '满200减50,不含酒水', 50.00, 40.00, 42.00, 2000, 1500,
|
||
CURRENT_DATE + INTERVAL '60 days', 'utility', '生鲜', 'listed'),
|
||
('20000000-0000-0000-0000-000000000005', '10000000-0000-0000-0000-000000000004',
|
||
'IMAX电影票', '任意场次IMAX 3D电影一张', 120.00, 96.00, 100.00, 800, 600,
|
||
CURRENT_DATE + INTERVAL '120 days', 'utility', '娱乐', 'listed'),
|
||
('20000000-0000-0000-0000-000000000006', '10000000-0000-0000-0000-000000000004',
|
||
'年度影院会员卡', '全年无限次观影', 999.00, 849.15, 899.00, 200, 150,
|
||
CURRENT_DATE + INTERVAL '365 days', 'utility', '娱乐', 'listed')
|
||
ON CONFLICT (id) DO NOTHING;
|
||
|
||
-- Test coupon rules
|
||
INSERT INTO coupon_rules (coupon_id, rule_type, rule_value) VALUES
|
||
('20000000-0000-0000-0000-000000000001', 'transferable', '{"enabled": true}'),
|
||
('20000000-0000-0000-0000-000000000001', 'resale_limit', '{"max_count": 3}'),
|
||
('20000000-0000-0000-0000-000000000001', 'per_user_limit', '{"max_quantity": 5}'),
|
||
('20000000-0000-0000-0000-000000000003', 'min_purchase', '{"min_amount": 500}'),
|
||
('20000000-0000-0000-0000-000000000003', 'transferable', '{"enabled": true}'),
|
||
('20000000-0000-0000-0000-000000000003', 'resale_limit', '{"max_count": 2}'),
|
||
('20000000-0000-0000-0000-000000000004', 'store_restriction', '{"store_ids": ["all_fresh_mart"]}'),
|
||
('20000000-0000-0000-0000-000000000004', 'stacking', '{"enabled": false}')
|
||
ON CONFLICT DO NOTHING;
|
||
|
||
-- Test messages
|
||
INSERT INTO messages (user_id, title, content, type) VALUES
|
||
('00000000-0000-0000-0000-000000000002', '欢迎加入Genex', '您已成功注册Genex账户,开始探索券金融的世界吧!', 'system'),
|
||
('00000000-0000-0000-0000-000000000002', 'KYC认证通过', '您的KYC L2认证已通过,现在可以进行更多交易。', 'kyc'),
|
||
('00000000-0000-0000-0000-000000000003', '欢迎加入Genex', '您已成功注册Genex账户。', 'system')
|
||
ON CONFLICT DO NOTHING;
|
||
|
||
-- Address mappings
|
||
INSERT INTO address_mappings (user_id, chain_address) VALUES
|
||
('00000000-0000-0000-0000-000000000002', '0x1234567890abcdef1234567890abcdef12345678'),
|
||
('00000000-0000-0000-0000-000000000003', '0xabcdef1234567890abcdef1234567890abcdef12'),
|
||
('00000000-0000-0000-0000-000000000004', '0x567890abcdef1234567890abcdef1234567890ab'),
|
||
('00000000-0000-0000-0000-000000000005', '0x890abcdef1234567890abcdef1234567890abcdef')
|
||
ON CONFLICT (user_id) DO NOTHING;
|