feat add tenant users
This commit is contained in:
20
backend/database/migrations/20251216011456_tenant_users.sql
Normal file
20
backend/database/migrations/20251216011456_tenant_users.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
CREATE TABLE IF NOT EXISTS tenant_users(
|
||||
id bigserial PRIMARY KEY,
|
||||
tenant_id bigint NOT NULL,
|
||||
user_id bigint NOT NULL,
|
||||
role TEXT[] NOT NULL DEFAULT ARRAY['member'],
|
||||
balance numeric(20, 8) NOT NULL DEFAULT 0,
|
||||
status varchar(50) NOT NULL DEFAULT 'active',
|
||||
created_at timestamptz NOT NULL DEFAULT NOW(),
|
||||
updated_at timestamptz NOT NULL DEFAULT NOW(),
|
||||
UNIQUE (tenant_id, user_id)
|
||||
);
|
||||
|
||||
-- +goose StatementEnd
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
DROP TABLE IF EXISTS tenant_users;
|
||||
|
||||
-- +goose StatementEnd
|
||||
Reference in New Issue
Block a user