Skip to main content

POST functions

For Reference

Creating Tables

create table random (
id bigint generated by default as identity primary key,
name varchar not null,
slug varchar(50) not null unique,
website varchar,
deleted_at timestamp null,
inserted_at timestamp with time zone default timezone('ist'::text, now()) not null,
updated_at timestamp with time zone default timezone('ist'::text, now()) not null
);

Deleting Tables

drop table random
create table brand_users (
id bigint generated by default as identity primary key,
brand_id bigint references brands not null,
user_id uuid references auth.users not null,
created_by uuid references auth.users not null,
is_admin boolean default false not null,
inserted_at timestamp with time zone default timezone('ist'::text, now()) not null,
updated_at timestamp with time zone default timezone('ist'::text, now()) not null
);

Altering Table Name

ALTER TABLE customers
RENAME COLUMN phone TO contact_phone;

Add Column

ALTER TABLE stores
ADD COLUMN delete_at timestamp with time zone default timezone('ist'::text, now()) null;