applied_limit_classes (#606)

This commit is contained in:
Michael Quigley 2024-05-13 12:50:14 -04:00
parent 1238c4981c
commit 4d67598acb
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 25 additions and 7 deletions

View File

@ -3,7 +3,7 @@
create type limit_scope as enum ('account', 'environment', 'share');
create type limit_action as enum ('warning', 'limit');
create table limits_classes (
create table limit_classes (
id serial primary key,
limit_scope limit_scope not null default ('account'),
limit_action limit_action not null default ('limit'),
@ -16,4 +16,13 @@ create table limits_classes (
created_at timestamptz not null default(current_timestamp),
updated_at timestamptz not null default(current_timestamp),
deleted boolean not null default(false)
)
);
create table applied_limit_classes (
id serial primary key,
account_id integer not null references accounts (id),
limit_class_id integer not null references limit_classes (id),
created_at timestamptz not null default(current_timestamp),
updated_at timestamptz not null default(current_timestamp),
deleted boolean not null default(false)
);

View File

@ -1,16 +1,25 @@
-- +migrate Up
create table limits_classes (
create table limit_classes (
id serial primary key,
limit_scope string not null default ('account'),
limit_action string not null default ('limit'),
share_mode string,
backend_mode string,
period_minutes int not null default (1440),
period_minutes integer not null default (1440),
rx_bytes bigint not null default (-1),
tx_bytes bigint not null default (-1),
total_bytes bigint not null default (-1),
created_at timestamptz not null default(current_timestamp),
updated_at timestamptz not null default(current_timestamp),
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
deleted boolean not null default(false)
)
);
create table applied_limit_classes (
id serial primary key,
account_id integer not null references accounts (id),
limit_class_id integer not null references limit_classes (id),
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
deleted boolean not null default(false)
);