Further....
db81c034f66d9c4cc29c7811bb89b95f24=> \d links
Table "public.links"
Column | Type | Collation | Nullable | Default
--------------+--------------------------+-----------+----------+-----------------------------------
id | integer | | not null | nextval('links_id_seq'::regclass)
address | character varying(255) | | not null |
description | character varying(255) | | |
banned | boolean | | not null | false
banned_by_id | integer | | |
domain_id | integer | | |
password | character varying(255) | | |
expire_in | timestamp with time zone | | |
target | character varying(2040) | | not null |
user_id | integer | | |
visit_count | integer | | not null | 0
created_at | timestamp with time zone | | not null | CURRENT_TIMESTAMP
updated_at | timestamp with time zone | | not null | CURRENT_TIMESTAMP
uuid | uuid | | not null | uuid_generate_v4()
Indexes:
"links_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
"links_banned_by_id_foreign" FOREIGN KEY (banned_by_id) REFERENCES users(id)
"links_domain_id_foreign" FOREIGN KEY (domain_id) REFERENCES domains(id)
"links_user_id_foreign" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
Referenced by:
TABLE "visits" CONSTRAINT "visits_link_id_foreign" FOREIGN KEY (link_id) REFERENCES links(id) ON DELETE CASCADE
So, then, I tried
db81c034f66d9c4cc29c7811bb89b95f24=> INSERT INTO links (address, target, user_id) VALUES ('x1234', 'https://blog.cloudron.io', 2);
INSERT 0 1
Visiting x1234 redirects properly. So, quite easy to script this. Note that 2 is the user id, might have to check the db what the user id is in your case.