Created
August 8, 2025 15:31
-
-
Save guhkun13/92e4d4a5b0380889d78477528d56d57f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This script was generated by the ERD tool in pgAdmin 4. | |
-- Please log an issue at https://github.com/pgadmin-org/pgadmin4/issues/new/choose if you find any bugs, including reproduction steps. | |
BEGIN; | |
CREATE TABLE IF NOT EXISTS public.auto_compress | |
( | |
id serial NOT NULL, | |
secure_id character varying(50) COLLATE pg_catalog."default" NOT NULL, | |
source_path text COLLATE pg_catalog."default" NOT NULL, | |
destination_path text COLLATE pg_catalog."default" NOT NULL, | |
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
updated_at timestamp without time zone, | |
is_backup_original_file boolean DEFAULT false, | |
quality character varying COLLATE pg_catalog."default" DEFAULT ''::character varying, | |
CONSTRAINT auto_compress_pkey PRIMARY KEY (id), | |
CONSTRAINT auto_compress_secure_id_key UNIQUE (secure_id) | |
); | |
CREATE TABLE IF NOT EXISTS public.cron_spec | |
( | |
id serial NOT NULL, | |
auto_compress_id integer NOT NULL, | |
entry_id integer NOT NULL, | |
spec character varying(50) COLLATE pg_catalog."default" NOT NULL, | |
is_active integer NOT NULL, | |
url text COLLATE pg_catalog."default" NOT NULL, | |
cron_format character varying(25) COLLATE pg_catalog."default" NOT NULL, | |
cron_type character varying(25) COLLATE pg_catalog."default" NOT NULL, | |
cron_repetition character varying(25) COLLATE pg_catalog."default" NOT NULL, | |
cron_value character varying(25) COLLATE pg_catalog."default", | |
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
updated_at timestamp without time zone, | |
CONSTRAINT cron_spec_pkey PRIMARY KEY (id) | |
); | |
CREATE TABLE IF NOT EXISTS public.log_cron | |
( | |
id serial NOT NULL, | |
auto_compress_id integer, | |
total_files integer DEFAULT 0, | |
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, | |
updated_at timestamp without time zone, | |
CONSTRAINT log_cron_pkey PRIMARY KEY (id) | |
); | |
CREATE TABLE IF NOT EXISTS public.log_failed_job | |
( | |
id serial NOT NULL, | |
auto_compress_id integer, | |
log_job_id character varying(50) COLLATE pg_catalog."default", | |
source_path text COLLATE pg_catalog."default" NOT NULL, | |
destination_path text COLLATE pg_catalog."default" NOT NULL, | |
file_format character varying(50) COLLATE pg_catalog."default", | |
status character varying(20) COLLATE pg_catalog."default", | |
message text COLLATE pg_catalog."default", | |
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
updated_at timestamp without time zone, | |
upload_compress_id character varying(50) COLLATE pg_catalog."default" DEFAULT NULL::character varying, | |
CONSTRAINT log_failed_job_pkey PRIMARY KEY (id) | |
); | |
CREATE TABLE IF NOT EXISTS public.log_job | |
( | |
id character varying(50) COLLATE pg_catalog."default" NOT NULL, | |
input_path text COLLATE pg_catalog."default" NOT NULL, | |
output_path text COLLATE pg_catalog."default" NOT NULL, | |
status character varying(30) COLLATE pg_catalog."default" NOT NULL, | |
message text COLLATE pg_catalog."default", | |
auto_compress_id integer DEFAULT 0, | |
log_cron_id integer, | |
published_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
completed_at timestamp without time zone, | |
upload_compress_id character varying(50) COLLATE pg_catalog."default", | |
job_type character varying COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying, | |
user_id integer, | |
CONSTRAINT log_job_pkey PRIMARY KEY (id) | |
); | |
CREATE TABLE IF NOT EXISTS public.log_statistic | |
( | |
id serial NOT NULL, | |
log_job_id character varying(50) COLLATE pg_catalog."default", | |
engine_id character varying(50) COLLATE pg_catalog."default" NOT NULL, | |
filename text COLLATE pg_catalog."default" NOT NULL, | |
file_format character varying(20) COLLATE pg_catalog."default" NOT NULL, | |
original_size double precision NOT NULL DEFAULT 0, | |
compressed_size double precision NOT NULL DEFAULT 0, | |
compress_duration double precision NOT NULL DEFAULT 0, | |
space_saving_percentage double precision NOT NULL DEFAULT 0, | |
started_at timestamp without time zone NOT NULL, | |
finished_at timestamp without time zone NOT NULL, | |
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
job_type character varying COLLATE pg_catalog."default" DEFAULT ''::character varying, | |
CONSTRAINT log_statistic_pkey PRIMARY KEY (id) | |
); | |
CREATE TABLE IF NOT EXISTS public.settings | |
( | |
id serial NOT NULL, | |
name character varying COLLATE pg_catalog."default" NOT NULL, | |
value character varying COLLATE pg_catalog."default", | |
unit character varying COLLATE pg_catalog."default", | |
status character varying COLLATE pg_catalog."default", | |
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, | |
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, | |
CONSTRAINT settings_pkey PRIMARY KEY (id), | |
CONSTRAINT unique_name_constraint UNIQUE (name) | |
); | |
CREATE TABLE IF NOT EXISTS public.upload_compress | |
( | |
id character varying(50) COLLATE pg_catalog."default" NOT NULL, | |
job_id character varying(50) COLLATE pg_catalog."default" NOT NULL, | |
source_path text COLLATE pg_catalog."default" NOT NULL, | |
destination_path text COLLATE pg_catalog."default" NOT NULL, | |
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
download_count integer NOT NULL, | |
deleted_at timestamp without time zone, | |
quality character varying COLLATE pg_catalog."default" DEFAULT ''::character varying, | |
ip_address character varying COLLATE pg_catalog."default" DEFAULT ''::character varying, | |
browser character varying COLLATE pg_catalog."default" DEFAULT ''::character varying, | |
os character varying COLLATE pg_catalog."default" DEFAULT ''::character varying, | |
device_type character varying COLLATE pg_catalog."default" DEFAULT ''::character varying, | |
role character varying(100) COLLATE pg_catalog."default" NOT NULL DEFAULT 'guest'::character varying, | |
username character varying(255) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying, | |
CONSTRAINT upload_compress_pkey PRIMARY KEY (job_id) | |
); | |
CREATE TABLE IF NOT EXISTS public.users | |
( | |
id serial NOT NULL, | |
name character varying(50) COLLATE pg_catalog."default", | |
username character varying(50) COLLATE pg_catalog."default" NOT NULL, | |
email character varying(100) COLLATE pg_catalog."default" NOT NULL, | |
password text COLLATE pg_catalog."default" NOT NULL, | |
phone_number character varying(20) COLLATE pg_catalog."default", | |
is_active boolean DEFAULT true, | |
role integer NOT NULL DEFAULT 0, | |
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP, | |
updated_at timestamp without time zone, | |
CONSTRAINT users_pkey PRIMARY KEY (id), | |
CONSTRAINT users_email_key UNIQUE (email), | |
CONSTRAINT users_phone_number_key UNIQUE (phone_number), | |
CONSTRAINT users_username_key UNIQUE (username) | |
); | |
ALTER TABLE IF EXISTS public.cron_spec | |
ADD CONSTRAINT cron_spec_auto_compress_id_fkey FOREIGN KEY (auto_compress_id) | |
REFERENCES public.auto_compress (id) MATCH SIMPLE | |
ON UPDATE NO ACTION | |
ON DELETE CASCADE; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment