mirror of
https://github.com/openziti/zrok.git
synced 2025-02-16 10:19:18 +01:00
skip_interstitial_grants sql structure (#704)
This commit is contained in:
parent
2755422a29
commit
275666c2b2
18
controller/store/skipInterstitialGrant.go
Normal file
18
controller/store/skipInterstitialGrant.go
Normal file
@ -0,0 +1,18 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (str *Store) IsAccountGrantedSkipInterstitial(acctId int, trx *sqlx.Tx) (bool, error) {
|
||||
stmt, err := trx.Prepare("select count(0) from skip_interstitial_grants where account_id = $1")
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "error preparing skip_interstitial_grants select statement")
|
||||
}
|
||||
var count int
|
||||
if err := stmt.QueryRow(acctId).Scan(&count); err != nil {
|
||||
return false, errors.Wrap(err, "error querying skip_interstitial_grants count")
|
||||
}
|
||||
return count > 0, nil
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
-- +migrate Up
|
||||
|
||||
create table skip_interstitial_grants (
|
||||
id serial primary key,
|
||||
|
||||
account_id integer references accounts (id) not null,
|
||||
|
||||
created_at timestamptz not null default(current_timestamp),
|
||||
updated_at timestamptz not null default(current_timestamp),
|
||||
deleted boolean not null default(false)
|
||||
);
|
||||
|
||||
create index skip_interstitial_grants_id_idx on skip_interstitial_grants (account_id);
|
@ -0,0 +1,13 @@
|
||||
-- +migrate Up
|
||||
|
||||
create table skip_interstitial_grants (
|
||||
id integer primary key,
|
||||
|
||||
account_id integer references accounts (id) not null,
|
||||
|
||||
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 index skip_interstitial_grants_id_idx on skip_interstitial_grants (account_id);
|
Loading…
Reference in New Issue
Block a user