2022-08-12 18:01:01 +02:00
|
|
|
/** Database structure for BirdNET-stream SQLite*/
|
|
|
|
|
|
|
|
/** Taxon table */
|
|
|
|
CREATE TABLE IF NOT EXISTS taxon (
|
2022-08-24 14:12:42 +02:00
|
|
|
taxon_id INTEGER PRIMARY KEY NOT NULL,
|
2022-08-12 18:01:01 +02:00
|
|
|
scientific_name TEXT NOT NULL,
|
|
|
|
common_name TEXT NOT NULL
|
|
|
|
);
|
|
|
|
|
2022-08-13 16:00:08 +02:00
|
|
|
/** Location table */
|
|
|
|
CREATE TABLE IF NOT EXISTS location (
|
2022-08-24 14:12:42 +02:00
|
|
|
location_id INTEGER PRIMARY KEY NOT NULL,
|
2022-08-12 18:01:01 +02:00
|
|
|
latitude REAL NOT NULL,
|
|
|
|
longitude REAL NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
/** Observation table */
|
|
|
|
CREATE TABLE IF NOT EXISTS observation (
|
2022-08-24 14:12:42 +02:00
|
|
|
`observation_id` INTEGER PRIMARY KEY NOT NULL,
|
2022-08-13 16:00:08 +02:00
|
|
|
`audio_file` TEXT NOT NULL,
|
|
|
|
`start` REAL NOT NULL,
|
|
|
|
`end` REAL NOT NULL,
|
|
|
|
`taxon_id` INTEGER NOT NULL,
|
|
|
|
`location_id` INTEGER NOT NULL,
|
|
|
|
`date` TEXT NOT NULL,
|
|
|
|
`notes` TEXT,
|
|
|
|
`confidence` REAL NOT NULL,
|
2022-08-24 14:12:42 +02:00
|
|
|
`verified` BOOLEAN DEFAULT 0 CHECK (`verified` IN (0, 1)),
|
2022-08-12 18:01:01 +02:00
|
|
|
FOREIGN KEY(taxon_id) REFERENCES taxon(taxon_id),
|
2022-08-13 16:00:08 +02:00
|
|
|
FOREIGN KEY(location_id) REFERENCES location(location_id)
|
2022-08-20 05:22:07 +02:00
|
|
|
);
|