Allow lifetime gift code creation in the admin interface

(#3819) Feature Closed: Shipped self-hosting

7 votes Locked

Thread

Comment by Jonah
Jonah 1 vote 1 reply
Could you share how you did that in the database? I accomplished the same thing by changing premium status from 1 to 2 for a user, but I'm not sure that is the most complete way to do this. Your way sounds better, but I couldn't figure it out last night.
Comment by Zoey
Zoey OP2 votes
The SQL command I use is the following: UPDATE public.fluxer_kv SET row_data = row_data || '{"duration_months": 0, "duration_quantity": 0}'::jsonb, updated_at = NOW() WHERE table_name = 'gift_codes' AND row_key = '"ABCDEF"'; ABCDEF is the gift code you created Have my PostgreSQL database hosted on a seperate server and executing the command via pgAdmin. If you use docker it should work with this (UNTESTED): cat << 'EOF' | docker compose exec -T fluxer-postgres-1 psql -U <db_user> -d <db_name> UPDATE public.fluxer_kv SET row_data = row_data || '{"duration_months": 0, "duration_quantity": 0}'::jsonb, updated_at = NOW() WHERE table_name = 'gift_codes' AND row_key = '"ABCDEF"'; EOF