
/* T[ahun]A[nggaran] */
CREATE TABLE IF NOT EXISTS ta (
	tahun INTEGER NOT NULL,
	current BOOLEAN DEFAULT 'f',
	created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
	updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT ta_pk PRIMARY KEY (tahun)
);
COMMIT;

INSERT INTO ta (tahun,current) VALUES (2020,'t') ON CONFLICT DO NOTHING; COMMIT;

DO $exec$ DECLARE i INTEGER; BEGIN
   FOR i IN 2010..2020 LOOP
   	INSERT INTO ta (tahun,current) VALUES (i,'f') ON CONFLICT DO NOTHING;
   END LOOP;
END $exec$;
