341 lines
7.9 KiB
SQL
341 lines
7.9 KiB
SQL
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
-- Locations Initial Data
|
|
INSERT INTO branch_locations (key, value)
|
|
VALUES ('addis_ababa', 'Addis Ababa'),
|
|
('dire_dawa', 'Dire Dawa'),
|
|
('mekelle', 'Mekelle'),
|
|
('adama', 'Adama'),
|
|
('awassa', 'Awassa'),
|
|
('bahir_dar', 'Bahir Dar'),
|
|
('gonder', 'Gonder'),
|
|
('dessie', 'Dessie'),
|
|
('jimma', 'Jimma'),
|
|
('jijiga', 'Jijiga'),
|
|
('shashamane', 'Shashamane'),
|
|
('bishoftu', 'Bishoftu'),
|
|
('sodo', 'Sodo'),
|
|
('arba_minch', 'Arba Minch'),
|
|
('hosaena', 'Hosaena'),
|
|
('harar', 'Harar'),
|
|
('dilla', 'Dilla'),
|
|
('nekemte', 'Nekemte'),
|
|
('debre_birhan', 'Debre Birhan'),
|
|
('asella', 'Asella'),
|
|
('debre_markos', 'Debre Markos'),
|
|
('kombolcha', 'Kombolcha'),
|
|
('debre_tabor', 'Debre Tabor'),
|
|
('adigrat', 'Adigrat'),
|
|
('areka', 'Areka'),
|
|
('weldiya', 'Weldiya'),
|
|
('sebeta', 'Sebeta'),
|
|
('burayu', 'Burayu'),
|
|
('shire', 'Shire'),
|
|
('ambo', 'Ambo'),
|
|
('arsi_negele', 'Arsi Negele'),
|
|
('aksum', 'Aksum'),
|
|
('gambela', 'Gambela'),
|
|
('bale_robe', 'Bale Robe'),
|
|
('butajira', 'Butajira'),
|
|
('batu', 'Batu'),
|
|
('boditi', 'Boditi'),
|
|
('adwa', 'Adwa'),
|
|
('yirgalem', 'Yirgalem'),
|
|
('waliso', 'Waliso'),
|
|
('welkite', 'Welkite'),
|
|
('gode', 'Gode'),
|
|
('meki', 'Meki'),
|
|
('negele_borana', 'Negele Borana'),
|
|
('alaba_kulito', 'Alaba Kulito'),
|
|
('alamata,', 'Alamata,'),
|
|
('chiro', 'Chiro'),
|
|
('tepi', 'Tepi'),
|
|
('durame', 'Durame'),
|
|
('goba', 'Goba'),
|
|
('assosa', 'Assosa'),
|
|
('gimbi', 'Gimbi'),
|
|
('wukro', 'Wukro'),
|
|
('haramaya', 'Haramaya'),
|
|
('mizan_teferi', 'Mizan Teferi'),
|
|
('sawla', 'Sawla'),
|
|
('mojo', 'Mojo'),
|
|
('dembi_dolo', 'Dembi Dolo'),
|
|
('aleta_wendo', 'Aleta Wendo'),
|
|
('metu', 'Metu'),
|
|
('mota', 'Mota'),
|
|
('fiche', 'Fiche'),
|
|
('finote_selam', 'Finote Selam'),
|
|
('bule_hora_town', 'Bule Hora Town'),
|
|
('bonga', 'Bonga'),
|
|
('kobo', 'Kobo'),
|
|
('jinka', 'Jinka'),
|
|
('dangila', 'Dangila'),
|
|
('degehabur', 'Degehabur'),
|
|
('bedessa', 'Bedessa'),
|
|
('agaro', 'Agaro') ON CONFLICT (key) DO
|
|
UPDATE
|
|
SET value = EXCLUDED.value;
|
|
-- Settings Initial Data
|
|
INSERT INTO global_settings (key, value)
|
|
VALUES ('sms_provider', 'afro_message'),
|
|
('max_number_of_outcomes', '30'),
|
|
('bet_amount_limit', '10000000'),
|
|
('daily_ticket_limit', '50'),
|
|
('total_winnings_limit', '1000000'),
|
|
('amount_for_bet_referral', '1000000'),
|
|
('cashback_amount_cap', '1000'),
|
|
('default_winning_limit', '5000000') ON CONFLICT (key) DO NOTHING;
|
|
-- Users
|
|
INSERT INTO users (
|
|
id,
|
|
first_name,
|
|
last_name,
|
|
email,
|
|
phone_number,
|
|
password,
|
|
role,
|
|
email_verified,
|
|
phone_verified,
|
|
created_at,
|
|
updated_at,
|
|
suspended,
|
|
company_id
|
|
)
|
|
VALUES (
|
|
1,
|
|
'John',
|
|
'Doe',
|
|
'john.doe@example.com',
|
|
NULL,
|
|
crypt('password@123', gen_salt('bf'))::bytea,
|
|
'customer',
|
|
TRUE,
|
|
FALSE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP,
|
|
FALSE,
|
|
1
|
|
),
|
|
(
|
|
2,
|
|
'Test',
|
|
'Admin',
|
|
'test.admin@gmail.com',
|
|
'0988554466',
|
|
crypt('password@123', gen_salt('bf'))::bytea,
|
|
'admin',
|
|
TRUE,
|
|
TRUE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP,
|
|
FALSE,
|
|
1
|
|
),
|
|
(
|
|
3,
|
|
'Samuel',
|
|
'Tariku',
|
|
'cybersamt@gmail.com',
|
|
'0911111111',
|
|
crypt('password@123', gen_salt('bf'))::bytea,
|
|
'super_admin',
|
|
TRUE,
|
|
TRUE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP,
|
|
FALSE,
|
|
NULL
|
|
),
|
|
(
|
|
4,
|
|
'Kirubel',
|
|
'Kibru',
|
|
'kirubel.jkl679@gmail.com',
|
|
'0911554486',
|
|
crypt('password@123', gen_salt('bf'))::bytea,
|
|
'super_admin',
|
|
TRUE,
|
|
TRUE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP,
|
|
FALSE,
|
|
NULL
|
|
) ON CONFLICT (id) DO
|
|
UPDATE
|
|
SET first_name = EXCLUDED.first_name,
|
|
last_name = EXCLUDED.last_name,
|
|
email = EXCLUDED.email,
|
|
phone_number = EXCLUDED.phone_number,
|
|
password = EXCLUDED.password,
|
|
role = EXCLUDED.role,
|
|
email_verified = EXCLUDED.email_verified,
|
|
phone_verified = EXCLUDED.phone_verified,
|
|
created_at = EXCLUDED.created_at,
|
|
updated_at = EXCLUDED.updated_at,
|
|
suspended = EXCLUDED.suspended,
|
|
company_id = EXCLUDED.company_id;
|
|
-- Supported Operations
|
|
INSERT INTO supported_operations (id, name, description)
|
|
VALUES (1, 'SportBook', 'Sportbook operations'),
|
|
(2, 'Virtual', 'Virtual operations') ON CONFLICT (id) DO
|
|
UPDATE
|
|
SET name = EXCLUDED.name,
|
|
description = EXCLUDED.description;
|
|
-- Wallets
|
|
INSERT INTO wallets (
|
|
id,
|
|
balance,
|
|
is_withdraw,
|
|
is_bettable,
|
|
is_transferable,
|
|
user_id,
|
|
type,
|
|
currency,
|
|
is_active,
|
|
created_at,
|
|
updated_at
|
|
)
|
|
VALUES (
|
|
1,
|
|
10000,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
1,
|
|
'regular_wallet',
|
|
'ETB',
|
|
TRUE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
),
|
|
(
|
|
2,
|
|
5000,
|
|
FALSE,
|
|
TRUE,
|
|
TRUE,
|
|
1,
|
|
'static_wallet',
|
|
'ETB',
|
|
TRUE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
),
|
|
(
|
|
3,
|
|
100000000 ,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
2,
|
|
'company_wallet',
|
|
'ETB',
|
|
TRUE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
),
|
|
(
|
|
4,
|
|
50000000,
|
|
TRUE,
|
|
TRUE,
|
|
TRUE,
|
|
2,
|
|
'branch_wallet',
|
|
'ETB',
|
|
TRUE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
) ON CONFLICT (id) DO
|
|
UPDATE
|
|
SET balance = EXCLUDED.balance,
|
|
is_withdraw = EXCLUDED.is_withdraw,
|
|
is_bettable = EXCLUDED.is_bettable,
|
|
is_transferable = EXCLUDED.is_transferable,
|
|
user_id = EXCLUDED.user_id,
|
|
type = EXCLUDED.type,
|
|
currency = EXCLUDED.currency,
|
|
is_active = EXCLUDED.is_active,
|
|
created_at = EXCLUDED.created_at,
|
|
updated_at = EXCLUDED.updated_at;
|
|
-- Customer Wallets
|
|
INSERT INTO customer_wallets (
|
|
id,
|
|
customer_id,
|
|
regular_wallet_id,
|
|
static_wallet_id
|
|
)
|
|
VALUES (1, 1, 1, 2) ON CONFLICT (id) DO
|
|
UPDATE
|
|
SET customer_id = EXCLUDED.customer_id,
|
|
regular_wallet_id = EXCLUDED.regular_wallet_id,
|
|
static_wallet_id = EXCLUDED.static_wallet_id;
|
|
-- Company
|
|
INSERT INTO companies (
|
|
id,
|
|
name,
|
|
slug,
|
|
admin_id,
|
|
wallet_id,
|
|
deducted_percentage,
|
|
is_active,
|
|
created_at,
|
|
updated_at
|
|
)
|
|
VALUES (
|
|
1,
|
|
'FortuneBets',
|
|
'fortunebets',
|
|
2,
|
|
3,
|
|
0.10,
|
|
TRUE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
) ON CONFLICT (id) DO
|
|
UPDATE
|
|
SET name = EXCLUDED.name,
|
|
slug = EXCLUDED.slug,
|
|
admin_id = EXCLUDED.admin_id,
|
|
wallet_id = EXCLUDED.wallet_id,
|
|
deducted_percentage = EXCLUDED.deducted_percentage,
|
|
is_active = EXCLUDED.is_active,
|
|
created_at = EXCLUDED.created_at,
|
|
updated_at = EXCLUDED.updated_at;
|
|
-- Branch
|
|
INSERT INTO branches (
|
|
id,
|
|
name,
|
|
location,
|
|
wallet_id,
|
|
branch_manager_id,
|
|
company_id,
|
|
is_self_owned,
|
|
profit_percent,
|
|
is_active,
|
|
created_at,
|
|
updated_at
|
|
)
|
|
VALUES (
|
|
1,
|
|
'Test Branch',
|
|
'addis_ababa',
|
|
4,
|
|
2,
|
|
1,
|
|
TRUE,
|
|
0.10,
|
|
TRUE,
|
|
CURRENT_TIMESTAMP,
|
|
CURRENT_TIMESTAMP
|
|
) ON CONFLICT (id) DO
|
|
UPDATE
|
|
SET name = EXCLUDED.name,
|
|
location = EXCLUDED.location,
|
|
wallet_id = EXCLUDED.wallet_id,
|
|
branch_manager_id = EXCLUDED.branch_manager_id,
|
|
company_id = EXCLUDED.company_id,
|
|
is_self_owned = EXCLUDED.is_self_owned,
|
|
profit_percent = EXCLUDED.profit_percent,
|
|
is_active = EXCLUDED.is_active,
|
|
created_at = EXCLUDED.created_at,
|
|
updated_at = EXCLUDED.updated_at; |