<commit_before>\set ON_ERROR_STOP 1

CREATE OR REPLACE FUNCTION crontabber_timestamp ()
RETURNS trigger
LANGUAGE plpgsql
AS $f$
BEGIN
	
	NEW.last_updated = now();
	RETURN NEW;
	
END; $f$;

CREATE OR REPLACE FUNCTION crontabber_nodelete ()
RETURNS trigger
LANGUAGE plpgsql
AS $f$
BEGIN

	RAISE EXCEPTION 'you are not allowed to add or delete records from the crontabber table';

END;
$f$;

SELECT create_table_if_not_exists ( 'crontabber_state',
	$x$
	CREATE TABLE crontabber_state (
		state TEXT not null,
		last_updated timestamptz not null primary key
	);
	
	INSERT INTO crontabber_state VALUES ( '{ "initialized" }', now() );
	
	CREATE TRIGGER crontabber_timestamp BEFORE UPDATE ON crontabber_state
	FOR EACH ROW EXECUTE PROCEDURE crontabber_timestamp();
	
	CREATE TRIGGER crontabber_nodelete BEFORE INSERT OR DELETE ON crontabber_state
	FOR EACH ROW EXECUTE PROCEDURE crontabber_nodelete();	
	$x$,'breakpad_rw' );
	

DROP TABLE IF EXISTS cronjobs;<commit_msg>fix per PeterB for JSON string.<commit_after>\set ON_ERROR_STOP 1

CREATE OR REPLACE FUNCTION crontabber_timestamp ()
RETURNS trigger
LANGUAGE plpgsql
AS $f$
BEGIN
	
	NEW.last_updated = now();
	RETURN NEW;
	
END; $f$;

CREATE OR REPLACE FUNCTION crontabber_nodelete ()
RETURNS trigger
LANGUAGE plpgsql
AS $f$
BEGIN

	RAISE EXCEPTION 'you are not allowed to add or delete records from the crontabber table';

END;
$f$;

SELECT create_table_if_not_exists ( 'crontabber_state',
	$x$
	CREATE TABLE crontabber_state (
		state TEXT not null,
		last_updated timestamptz not null primary key
	);
	
	INSERT INTO crontabber_state VALUES ( '{}', now() );
	
	CREATE TRIGGER crontabber_timestamp BEFORE UPDATE ON crontabber_state
	FOR EACH ROW EXECUTE PROCEDURE crontabber_timestamp();
	
	CREATE TRIGGER crontabber_nodelete BEFORE INSERT OR DELETE ON crontabber_state
	FOR EACH ROW EXECUTE PROCEDURE crontabber_nodelete();	
	$x$,'breakpad_rw' );
	

DROP TABLE IF EXISTS cronjobs;
{'fraction_non_alphanumeric': 0.06687402799377916, 'fraction_numerical': 0.0010368066355624676, 'mean_word_length': 5.166134185303514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3296216', 'n_tokens_mistral': 738, 'n_tokens_neox': 679, 'n_words': 217}