24 lines
1.2 KiB
SQL
24 lines
1.2 KiB
SQL
-- Admin-editable texts shown to clients around a visa/master/sber payout
|
|
-- (e.g. the warning before paying). Clients look a text up by its fixed
|
|
-- code, so codes are seeded here and never created/deleted from the admin
|
|
-- UI - only name/text/is_active are editable. text is {"tm","ru","en"}.
|
|
CREATE TABLE IF NOT EXISTS payment_texts (
|
|
id bigserial PRIMARY KEY,
|
|
code character varying(64) NOT NULL,
|
|
name character varying(255) NOT NULL,
|
|
text jsonb NOT NULL DEFAULT '{"tm":"","ru":"","en":""}'::jsonb,
|
|
is_active boolean NOT NULL DEFAULT true,
|
|
updated_by bigint,
|
|
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
|
CONSTRAINT payment_texts_code_key UNIQUE (code),
|
|
CONSTRAINT payment_texts_updated_by_fkey
|
|
FOREIGN KEY (updated_by) REFERENCES users(id) ON DELETE SET NULL
|
|
);
|
|
|
|
INSERT INTO payment_texts (code, name, text) VALUES
|
|
('payment_warning_text', 'Visa/Master töleg duýduryş',
|
|
'{"tm":"Dogry töleg aýyny saýlamagyňyzy haýyş edýäris","ru":"","en":""}'::jsonb),
|
|
('sber_payment_warning', 'Sber töleg duýduryş',
|
|
'{"tm":"Sber töleg duýduryş","ru":"","en":""}'::jsonb)
|
|
ON CONFLICT (code) DO NOTHING;
|