accounting-postgresql-utili.../src/main/resources/StorageUsageRecordTable.sql

24 lines
927 B
MySQL
Raw Normal View History

2021-03-18 13:13:48 +01:00
-- CREATE TYPE operation_result AS ENUM ('SUCCESS', 'FAILED');
CREATE TYPE operation_type AS ENUM ('CREATE', 'READ', 'UPDATE', 'DELETE');
2021-04-15 14:56:02 +02:00
CREATE TYPE data_type AS ENUM ('STORAGE', 'TREE', 'GEO', 'DATABASE', 'LOCAL', 'OTHER', 'JUPYTER', 'KUBERNETES');
2021-03-18 13:13:48 +01:00
CREATE TABLE "storageusagerecord"(
id UUID NOT NULL PRIMARY KEY,
consumer_id TEXT NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE NOT NULL,
scope TEXT NOT NULL,
operation_result operation_result NOT NULL,
resource_owner TEXT NOT NULL,
provider_uri TEXT NOT NULL,
operation_type operation_type NOT NULL,
data_type data_type NOT NULL,
data_volume NUMERIC NOT NULL,
operation_count INTEGER NOT NULL DEFAULT 1,
aggregated BOOLEAN NOT NULL DEFAULT true,
start_time TIMESTAMP WITH TIME ZONE NOT NULL,
2021-04-15 14:56:02 +02:00
end_time TIMESTAMP WITH TIME ZONE NOT NULL,
-- Deprecated and to be removed
resource_scope TEXT DEFAULT 'NOT_NEEDED',
resource_uri TEXT DEFAULT 'NOT_NEEDED'
2021-03-18 13:13:48 +01:00
);