zerobyte/app/drizzle/20260117123940_create-default-org/migration.sql
Nico 35773a6969
refactor: upgrade to drizzle v1 (#450)
* refactor: move migrations to new structure

* refactor: convert all findMany to new structure

* fix(backups-schedule): missing null matching for last backup status

* chore: move root lib to server
2026-02-01 19:14:52 +01:00

9 lines
346 B
SQL

INSERT INTO organization (id, name, slug, created_at)
SELECT
'default-org-' || u.id as id,
u.name || '''s Workspace' as name,
lower(replace(u.name, ' ', '-')) || '-' || lower(hex(randomblob(2))) as slug,
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;