ooni-probe-cli/data/migrations/1_create_msmt_results.sql
2018-02-13 18:11:22 +02:00

43 lines
975 B
SQL

-- +migrate Down
-- +migrate StatementBegin
DROP TABLE `results`;
DROP TABLE `measurements`;
-- +migrate StatementEnd
-- +migrate Up
-- +migrate StatementBegin
CREATE TABLE `results` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` VARCHAR(255),
`start_time` DATETIME,
`end_time` DATETIME,
`summary` JSON,
`done` TINYINT(1),
`data_usage_up` INTEGER,
`data_usage_down` INTEGER
);
CREATE TABLE `measurements` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` VARCHAR(255),
`start_time` DATETIME,
`end_time` DATETIME,
`summary` JSON,
`ip` VARCHAR(255),
`asn` INTEGER,
`country` VARCHAR(2),
`network_name` VARCHAR(255),
`state` TEXT,
`failure` VARCHAR(255),
`report_file` VARCHAR(255),
`report_id` VARCHAR(255),
`input` VARCHAR(255),
`measurement_id` VARCHAR(255),
`result_id` INTEGER REFERENCES `results` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
);
-- +migrate StatementEnd