can I have a look at the toml file also

can I have a look at the toml file? also, are you using pages or workers?
22 Replies
andyt
andyt•14mo ago
pages
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
have you set up preview_database_id = "DB" in the environment you use for local?
andyt
andyt•14mo ago
no
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
also how do you run it? because this is mone
andyt
andyt•14mo ago
wrangler pages dev --compatibility-date=2023-01-01 ./pages --kv=KV --d1=DB
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
please do not share database IDs 😄
andyt
andyt•14mo ago
theres nothing in it of value anyway
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
yeah but people peeking at schemas might reveal flaws this is mine
andyt
andyt•14mo ago
I just wanna be able to dev locally, or I'll use another db
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
[env.production] kv_namespaces =[ { binding = "SESSION_KV", id = "xxxxxxxxxx" } ] d1_databases = [ {binding = "DB", database_name = "nekotest",database_id = "xxxxxxxxxx" }] [env.preview] kv_namespaces =[ { binding = "SESSION_KV", id = "xxxxxxxxxx" } ] d1_databases = [ {binding = "DB", database_name = "nekotest-preview", database_id = "xxxxxxxxxx", preview_database_id = "DB" }] It needed preview_database_id to work
kian
kian•14mo ago
Pages doesn't use Wrangler.toml - it's all done by CLI flags on pages dev
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
ok, then that must have been completely ineffective black magic
andyt
andyt•14mo ago
so this toml isnt doing anything?
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
well, it is used by wrangler migrations
andyt
andyt•14mo ago
i can see the sqlite files, I assume I have multiple local databases in use, can I purge these and recreate from my remote? i assume thats what the migration should do
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
you can totally remove the directory and migrate again
andyt
andyt•14mo ago
if I try to migrate my database it cant find it locally, I am not passing --local the rest of the api suggests these calls are remote unless you pass --local also I assume I need the wrangle file if I am using wrangle in my project ah ok, so a migration assumes the changes are local and can be pushed to remotely, which makes sense thanks @Lost Pages it mentions here preview_database_id is required for pages local development
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
woot!
andyt
andyt•14mo ago
daily reminder the devil is still in fact in the detail
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
my understanding is that at some point pages will use wrangler.toml to set up things in prod, but wrangler locally uses it now to do migrations and there is no complete example with separate environments and preview_database_id so it took me time and i'm old
andyt
andyt•14mo ago
yeah the docs are not clear on the local dev part, thanks for your help
Paolo of Lost Pages
Paolo of Lost PagesOP•14mo ago
I'm glad it worked! migrations still user wrangler.toml, so if you use migrations you still need it
Want results from more Discord servers?
Add your server