is it possible to see the plpgsql that the ui wrot...
# help
j
is it possible to see the plpgsql that the ui wrote for me undernieth the hood. I want to start using editor with more freedoms but looking at that would help me learn
n
Hello @jar! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
j
for example trying something like this to replace my first shot with ui for a profile
Copy code
create table persons (
  id uuid references users(id) not null unique primary key on delete cascade,
  created_at timestamp default timezone('utc'::text, now()) not null,
  email varchar(42) citext unique check ( value ~ '^[a-zA-Z0-9.!#$%&''*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$' );
  permission_status text check (status in ('active','timeout','banned'))
);
g
https://uibakery.io/postgresql-gui-tools If you have grown beyond what the UI can do, many use a Postgres management tool. I happen to have Datagrip as part of my IDE, but pgadmin is very popular. They connect to your data base thru the postgres connection. Other wise you need to save your sql to an editor, or use the sql snippets. I still use the UI for quick stuff and when I'm on my ipad. This is Datagrip when I asked for sql of my function, I can do the same for a table and get all columns definitions, triggers, foreign keys, etc.
n
jar (2022-04-15)
g
Part of the table sql created initially in UI then added to in SQL editor and in Datagrip:
j
Thank you for this advice. Do you by chance know if I reference users table with public or no?
like in my above example I'm playing around with
and I believe delete casade in this sense means that if I delete the user then the person deletes right
g
Sorry too late in the evening for me to process your code, but it does not look correct with users(id). The auth.users table is where users are tracked. The reference normal by default uses the primary key.
j
No problem youve done way more than I couldve hoped for and helped me a bunch the last few days I will keep messing with it for a bit and getting late for me as well