Rewrite identity and access management
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
9
pkg/coredata/migrations/20251205T120000Z.sql
Normal file
9
pkg/coredata/migrations/20251205T120000Z.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
CREATE TYPE session_expire_reason AS ENUM (
|
||||
'idle_timeout',
|
||||
'revoked',
|
||||
'closed'
|
||||
);
|
||||
|
||||
ALTER TABLE sessions ADD COLUMN expire_reason session_expire_reason;
|
||||
|
||||
UPDATE sessions SET expire_reason = 'idle_timeout' WHERE expired_at < NOW();
|
||||
2
pkg/coredata/migrations/20251205T140000Z.sql
Normal file
2
pkg/coredata/migrations/20251205T140000Z.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE sessions ADD COLUMN user_agent TEXT DEFAULT 'SESSION_CREATED_BEFORE_USER_AGENT_COLUMN_ADDED';
|
||||
ALTER TABLE sessions ADD COLUMN ip_address INET DEFAULT '::1';
|
||||
8
pkg/coredata/migrations/20251205T150000Z.sql
Normal file
8
pkg/coredata/migrations/20251205T150000Z.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
ALTER TABLE sessions ADD COLUMN tenant_id TEXT;
|
||||
ALTER TABLE sessions ADD COLUMN parent_session_id TEXT REFERENCES sessions(id);
|
||||
|
||||
ALTER TABLE sessions ADD CONSTRAINT session_tenant_check CHECK (
|
||||
(parent_session_id IS NULL AND tenant_id IS NULL) OR
|
||||
(parent_session_id IS NOT NULL AND tenant_id IS NOT NULL)
|
||||
);
|
||||
|
||||
2
pkg/coredata/migrations/20251212T120000Z.sql
Normal file
2
pkg/coredata/migrations/20251212T120000Z.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE auth_user_api_keys ADD COLUMN expire_reason TEXT;
|
||||
|
||||
Reference in New Issue
Block a user