21 lines
568 B
SQL
21 lines
568 B
SQL
-- +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 bigint 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
|