flyweight icon indicating copy to clipboard operation
flyweight copied to clipboard

Cloudflare D1 support

Open haikyuu opened this issue 3 years ago • 5 comments

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

haikyuu avatar Sep 29 '22 18:09 haikyuu

When D1 is available I will make it work!

andrewitsover avatar Oct 03 '22 09:10 andrewitsover

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

ethan-tqa avatar Apr 08 '24 07:04 ethan-tqa

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

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

andrewitsover avatar May 06 '24 05:05 andrewitsover

% npx create-flyweight d1 src/database

Need to install the following packages:
[email protected]
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'
}

louwers avatar May 16 '24 16:05 louwers

@louwers hopefully it works now.

in project root:

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

andrewitsover avatar May 16 '24 21:05 andrewitsover