Rename 'is_active' to 'is_deactivated'

Signed-off-by: Loïck Bonniot <git@lesterpig.com>
This commit is contained in:
Loïck Bonniot 2020-10-02 17:58:11 +02:00
parent 818682810e
commit 963b0076b3
No known key found for this signature in database
GPG key ID: 3BFC709CD1C72BC8
4 changed files with 9 additions and 9 deletions

View file

@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS account_accounts (
-- Identifies which application service this account belongs to, if any.
appservice_id TEXT,
-- If the account is currently active
is_active BOOLEAN DEFAULT TRUE
is_deactivated BOOLEAN DEFAULT FALSE
-- TODO:
-- is_guest, is_admin, upgraded_ts, devices, any email reset stuff?
);
@ -54,13 +54,13 @@ const updatePasswordSQL = "" +
"UPDATE account_accounts SET password_hash = $1 WHERE localpart = $2"
const deactivateAccountSQL = "" +
"UPDATE account_accounts SET is_active = FALSE WHERE localpart = $1"
"UPDATE account_accounts SET is_deactivated = TRUE WHERE localpart = $1"
const selectAccountByLocalpartSQL = "" +
"SELECT localpart, appservice_id FROM account_accounts WHERE localpart = $1"
const selectPasswordHashSQL = "" +
"SELECT password_hash FROM account_accounts WHERE localpart = $1 AND is_active = TRUE"
"SELECT password_hash FROM account_accounts WHERE localpart = $1 AND is_deactivated = FALSE"
const selectNewNumericLocalpartSQL = "" +
"SELECT nextval('numeric_username_seq')"

View file

@ -1,9 +1,9 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE account_accounts ADD COLUMN IF NOT EXISTS is_active BOOLEAN DEFAULT TRUE;
ALTER TABLE account_accounts ADD COLUMN IF NOT EXISTS is_deactivated BOOLEAN DEFAULT FALSE;
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
ALTER TABLE account_accounts DROP COLUMN is_active;
ALTER TABLE account_accounts DROP COLUMN is_deactivated;
-- +goose StatementEnd

View file

@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS account_accounts (
-- Identifies which application service this account belongs to, if any.
appservice_id TEXT,
-- If the account is currently active
is_active BOOLEAN DEFAULT 1
is_deactivated BOOLEAN DEFAULT 0
-- TODO:
-- is_guest, is_admin, upgraded_ts, devices, any email reset stuff?
);
@ -52,13 +52,13 @@ const updatePasswordSQL = "" +
"UPDATE account_accounts SET password_hash = $1 WHERE localpart = $2"
const deactivateAccountSQL = "" +
"UPDATE account_accounts SET is_active = 0 WHERE localpart = $1"
"UPDATE account_accounts SET is_deactivated = 1 WHERE localpart = $1"
const selectAccountByLocalpartSQL = "" +
"SELECT localpart, appservice_id FROM account_accounts WHERE localpart = $1"
const selectPasswordHashSQL = "" +
"SELECT password_hash FROM account_accounts WHERE localpart = $1 AND is_active = 1"
"SELECT password_hash FROM account_accounts WHERE localpart = $1 AND is_deactivated = 0"
const selectNewNumericLocalpartSQL = "" +
"SELECT COUNT(localpart) FROM account_accounts"

View file

@ -6,7 +6,7 @@ CREATE TABLE account_accounts (
created_ts BIGINT NOT NULL,
password_hash TEXT,
appservice_id TEXT,
is_active BOOLEAN DEFAULT 1
is_deactivated BOOLEAN DEFAULT 0
);
INSERT
INTO account_accounts (