샘플
drizzle-orm 0.45.2: Run drizzle-orm against an in-memory SQLite with no native module and no server, using node:sqlite as the driver
검증된 샘플 — npm drizzle-orm 0.45.2: Run drizzle-orm against an in-memory SQLite with no native module and no server, using node:sqlite as the driver. node 22 …
sha256:b2121ae40b126706d7f37eb42fe29016cbed772ae0a32001ee2bbaeff49ffcd7
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 2
선언된 환경
node 22 linux x64 node 22 javascript npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · npm@1 |
2026-08-14 |
| node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · npm@1 |
2026-08-18 |
케이스
HOW- 목표
- Run drizzle-orm against an in-memory SQLite with no native module and no server, using node:sqlite as the driver
- 심벌
-
- sqliteTable
- drizzle-orm/sqlite-proxy
- drizzle-orm/sqlite-proxy/migrator
- node:sqlite.DatabaseSync
- StatementSync.setReturnArrays
- sql
- eq
- DrizzleQueryError
- 환경
- node 22
- 생성일
- 2026-08-14T12:07:43Z
컨트랙트
- apply a hand-written drizzle migration folder to an in-memory node:sqlite database through sqlite-proxy, offline
- assert drizzle-orm's exports map refuses ./package.json, so its own version has to be read off disk rather than required
- assert drizzle-orm 0.45.2 publishes no node-sqlite entry point, so the driver is sqlite-proxy with node:sqlite behind it
- assert the first migrate hands the callback the two DDL statements split on --> statement-breakpoint plus one __drizzle_migrations insert, and a second migrate hands it nothing
- assert the migrator creates and reads __drizzle_migrations through the driver rather than through the callback, and that its SELECT arrives as method values
- assert .returning() gives back the stored row, including the id AUTOINCREMENT assigned and the login_count the insert never named
- assert a select returns rows keyed by the schema's JS names, with the values untouched: mapFromDriverValue on a plain integer column is the identity function, so the JS number came from node:sqlite
- assert .where(eq(...)) filters in SQL with the value bound as a parameter, and .get() on a miss is undefined rather than an empty row
- assert omitting a notNull column, a TypeScript error at build time, is also a runtime NOT NULL constraint failure
- assert drizzle writes a literal null for an omitted column instead of leaving it out, so the column's SQL DEFAULT never applies and only a schema-side .default() helps
- assert a unique violation arrives as DrizzleQueryError whose own message is the failed statement and its parameters and not the SQLite one, with the SQLite message and code on .cause
- assert the extended result codes separate SQLITE_CONSTRAINT_UNIQUE from SQLITE_CONSTRAINT_NOTNULL without parsing English
- assert a quote-carrying value interpolated into sql`` is bound as a parameter, leaving no quote in the statement, so the injected tautology matches no rows
- assert the same value concatenated with sql.raw does fire the tautology and returns every row, so the escaping is what prevented it
- assert a value carrying a statement terminator passed to eq() is one bound parameter and the table it names is still there afterwards
- assert a proxy driver that returns node:sqlite's default object rows silently yields rows with every column undefined, which is why setReturnArrays(true) is required
파일
- csx.json
- drizzle/0000_init.sql
- drizzle/meta/_journal.json
- package-lock.json
- package.json
- src/db.mjs
- test/contract.mjs