You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Superflare only supports remix new projects, but I have an existing new Cloudflare wrangler project. I am using the HONO for routers.
Trying to integrate Superflare into my project and it works as expected.
Install
npx superflare@latest
Generate the model
npx superflare generate model Cats --migration
Generating model Cats
Generated model Cats at /home/dell/worker/mypro/app/models/Cats.ts
Migration generated at /home/dell/worker/mypro/db/migrations/0000_create_cats.ts
npx superflare migrate
Compiling migrations...
Migrating database...
✅ No migrations to apply!
its sending some error as TypeError: Cannot open database because the directory does not exist
now use the wrangler command to migrate wrangler d1 migrations apply <DATABASE_NAME> [OPTIONS]
migrate-apply
> wrangler d1 migrations apply test_db
Migrations to be applied:
┌──────────────────────┐
│ name │
├──────────────────────┤
│ 0001_create_dogs.sql │
└──────────────────────┘
✔ About to apply 1 migration(s)
Your database may not be available to serve requests during the migration, continue? … yes
🌀 Mapping SQL input into an array of statements
🌀 Parsing 2 statements
🌀 Executing on remote database test_db (e13434106s1-adc6-4829-b17e-8663b8b67):
🌀 To execute on your local development database, pass the --local flag to 'wrangler d1 execute'
🚣 Executed 2 commands in 0.6009ms
┌──────────────────────┬────────┐
│ name │ status │
├──────────────────────┼────────┤
│ 0001_create_dogs.sql │ ✅ │
└──────────────────────┴────────┘
D1 Connection to access the Model Query
Since it does not recognize the DB config, I have to create the Middleware to set the config as below
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently, Superflare only supports remix new projects, but I have an existing new Cloudflare wrangler project. I am using the HONO for routers.
Trying to integrate Superflare into my project and it works as expected.
Install
npx superflare@latest
Generate the model
npx superflare generate model Cats --migration
its sending some error as
TypeError: Cannot open database because the directory does not exist
It does not recognize the Database
This config is not working
But it will generate the sql file in your
root/migrations/0000_create_cats.sql
Migrate using wrangler
now use the wrangler command to migrate
wrangler d1 migrations apply <DATABASE_NAME> [OPTIONS]
D1 Connection to access the Model Query
Since it does not recognize the DB config, I have to create the Middleware to set the config as below
Thats it.
I'm still figuring out how to make the Superflare recognize the wrangler.toml. This would help to get full integration of superflare.
Please share your Thoughts.
Beta Was this translation helpful? Give feedback.
All reactions