mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-02-13 06:52:28 -05:00
* feat(db): add support for multiple users and organizations * feat: backfill entities with new organization id * refactor: filter all backend queries to surface only organization specific entities * refactor: each org has its own restic password * test: ensure organization is created * chore: pr feedbacks * refactor: filter by org id in all places * refactor: download restic password from stored db password * refactor(navigation): use volume id in urls instead of name * feat: disable registrations * refactor(auth): bubble up auth error to hono * refactor: use async local storage for cleaner context sharing * refactor: enable user registration vs disabling it * test: multi-org isolation * chore: final cleanup
11 lines
328 B
SQL
11 lines
328 B
SQL
INSERT INTO member (id, organization_id, user_id, role, created_at)
|
|
SELECT
|
|
'default-mem-' || u.id as id,
|
|
'default-org-' || u.id as organization_id,
|
|
u.id as user_id,
|
|
'owner' as role,
|
|
strftime('%s', 'now') * 1000 as created_at
|
|
FROM users_table u
|
|
LEFT JOIN member m ON u.id = m.user_id
|
|
WHERE m.user_id IS NULL;
|