thebinarysearchtree / flyweight

An ORM for SQLite
MIT License
513 stars 7 forks source link

Cloudflare D1 support #1

Open haikyuu opened 1 year ago

haikyuu commented 1 year ago

Hello, i love the conventions and ergonomics of this ORM. Can it run in D1?

thebinarysearchtree commented 1 year ago

When D1 is available I will make it work!

ethan-tqa commented 2 months ago

Hi, I would like to find out more about this. As of today D1 has entered General Availability state.

thebinarysearchtree commented 2 months ago

It has arrived! The greatest D1 ORM of all time.

https://github.com/thebinarysearchtree/flyweight#cloudflare-d1

louwers commented 1 month ago
% npx create-flyweight d1 src/database

Need to install the following packages:
create-flyweight@1.0.46
Ok to proceed? (y) y

up to date, audited 240 packages in 474ms

38 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

up to date, audited 240 packages in 462ms

38 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
node:internal/fs/promises:1023
  const result = await PromisePrototypeThen(
                 ^

Error: ENOENT: no such file or directory, lstat '/Users/bart/.npm/_npx/013ae53d1681031b/node_modules/create-flyweight/d1/migrations'
    at async lstat (node:internal/fs/promises:1023:18)
    at async Promise.all (index 0)
    at async checkPaths (node:internal/fs/cp/cp:76:39)
    at async cpFn (node:internal/fs/cp/cp:65:17)
    at async copy (file:///Users/bart/.npm/_npx/013ae53d1681031b/node_modules/create-flyweight/index.js:46:3)
    at async file:///Users/bart/.npm/_npx/013ae53d1681031b/node_modules/create-flyweight/index.js:51:1 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/Users/bart/.npm/_npx/013ae53d1681031b/node_modules/create-flyweight/d1/migrations'
}
thebinarysearchtree commented 1 month ago

@louwers hopefully it works now.

in project root:

rm -rf src/database
npm uninstall create-flyweight
npx create-flyweight d1 src/database