<commit_before>sqlite3 ${DEFAULT_SQLITE_DB_FILE} << EOF
ATTACH DATABASE '${DEFAULT_SQLITE_DB_FILE}' AS 'foglamp';

drop table if exists foglamp.test;

create table foglamp.test (
	id	bigint,
	key	character(5),
	description	character varying(255),
	data    JSON	
);

--drop table if exists foglamp.readings;
drop table if exists foglamp.test2;

insert into foglamp.test values (1, 'TEST1',  'A test row', '{ "json" : "test1" }');

-- Readings table
-- This tables contains the readings for assets.
-- An asset can be a south with multiple sensor, a single sensor,
-- a software or anything that generates data that is sent to FogLAMP
CREATE TABLE IF NOT EXISTS foglamp.readings (
    id         INTEGER                PRIMARY KEY AUTOINCREMENT,
    asset_code character varying(50)       NOT NULL,               -- The provided asset code. Not necessarily located in the
                                                                   -- assets table.
    read_key   uuid                        UNIQUE,                 -- An optional unique key used to avoid double-loading.
    reading    JSON                        NOT NULL DEFAULT '{}',  -- The json object received
    user_ts    DATETIME DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW'), -- UTC time
    ts         DATETIME DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')  -- UTC time
);

-- CREATE INDEX fki_readings_fk1
--    ON readings (asset_code);

-- CREATE INDEX readings_ix1
--    ON readings (read_key);

delete from foglamp.readings;
delete from foglamp.configuration;

CREATE TABLE IF NOT EXISTS foglamp.configuration (
       key         character varying(255)      NOT NULL, -- Primary key
       description character varying(255)      NOT NULL,                              -- Description, in plain text<commit_msg>FOGL-2430: fix testSetup.sh in case of the creation of the reading table<commit_after>sqlite3 ${DEFAULT_SQLITE_DB_FILE} << EOF
ATTACH DATABASE '${DEFAULT_SQLITE_DB_FILE}' AS 'foglamp';

drop table if exists foglamp.test;

create table foglamp.test (
	id	bigint,
	key	character(5),
	description	character varying(255),
	data    JSON	
);

--drop table if exists foglamp.readings;
drop table if exists foglamp.test2;

insert into foglamp.test values (1, 'TEST1',  'A test row', '{ "json" : "test1" }');

-- Readings table
-- This tables contains the readings for assets.
-- An asset can be a south with multiple sensor, a single sensor,
-- a software or anything that generates data that is sent to FogLAMP
CREATE TABLE IF NOT EXISTS foglamp.readings (
    id         INTEGER                PRIMARY KEY AUTOINCREMENT,
    asset_code character varying(50)       NOT NULL,               -- The provided asset code. Not necessarily located in the
                                                                   -- assets table.
    read_key   uuid                        UNIQUE,                 -- An optional unique key used to avoid double-loading.
    reading    JSON                        NOT NULL DEFAULT '{}',  -- The json object received
    user_ts    DATETIME DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), -- UTC time
    ts         DATETIME DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW'))  -- UTC time
);

-- CREATE INDEX fki_readings_fk1
--    ON readings (asset_code);

-- CREATE INDEX readings_ix1
--    ON readings (read_key);

delete from foglamp.readings;
delete from foglamp.configuration;

CREATE TABLE IF NOT EXISTS foglamp.configuration (
       key         character varying(255)      NOT NULL, -- Primary key
       description character varying(255)      NOT NULL,                              -- Description, in plain text
{'fraction_non_alphanumeric': 0.09176081565169468, 'fraction_numerical': 0.011573436208321852, 'mean_word_length': 2.2123893805309733, 'pattern_counts': {'":': 0, '<': 7, '<?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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6640552', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1020, 'n_words': 374}