Skip to main content

Database Structure

This Database helps AWS Lambda to index importing tasks.

Date Indexing Table

CREATE TABLE indices.s3_date_hns (
	id bigserial NOT NULL,
	date_hns timestamp NULL,
	is_imported bool DEFAULT false NULL,
	started_at timestamp NULL,
	finished_at timestamp NULL,
	skip_flag bool DEFAULT false NULL,
	CONSTRAINT s3_date_hns_pk PRIMARY KEY (id)
);

Execution Lock Table

CREATE TABLE indices.s3_execution (
	is_executing bool DEFAULT false NULL,
	started_at timestamp NULL,
	finished_at timestamp NULL,
	last_executed_date_hns timestamp NULL,
	id serial4 NOT NULL,
	last_error varchar(255) NULL,
	CONSTRAINT s3_execution_pk PRIMARY KEY (id)
);

CSV File Importing Index

CREATE TABLE indices.s3_file_importing (
	id int4 DEFAULT nextval('indices.s3_importing_id_seq'::regclass) NOT NULL,
	date_hns timestamp NULL,
	imported_at timestamp NULL,
	filename varchar(255) NULL,
	is_successful bool DEFAULT true NULL,
	CONSTRAINT s3_importing_pk PRIMARY KEY (id)
);