diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index 55242cd..82863d7 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -114,10 +114,10 @@ jobs: WRANGLER="npx --yes wrangler@${WRANGLER_VERSION}" TABLE_COUNT=$($WRANGLER d1 execute vault1 --env dev --remote --command \ - "SELECT COUNT(*) AS cnt FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' AND name NOT IN ('_cf_METADATA','d1_migrations');" \ + "SELECT COUNT(*) AS cnt FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '_cf_%' AND name NOT IN ('d1_migrations');" \ --json | jq -r '.[0].results[0].cnt // 0') - echo "Existing user table count: ${TABLE_COUNT}" + echo "Existing app table count: ${TABLE_COUNT}" if [ "${TABLE_COUNT}" = "0" ]; then echo "🆕 Empty D1 database detected; applying sql/schema.sql..." $WRANGLER d1 execute vault1 --env dev --remote --file sql/schema.sql diff --git a/.github/workflows/push-cloudflare.yaml b/.github/workflows/push-cloudflare.yaml index 10e7d2b..bc5b547 100644 --- a/.github/workflows/push-cloudflare.yaml +++ b/.github/workflows/push-cloudflare.yaml @@ -124,10 +124,10 @@ jobs: WRANGLER="npx --yes wrangler@${WRANGLER_VERSION}" TABLE_COUNT=$($WRANGLER d1 execute vault1 --remote --command \ - "SELECT COUNT(*) AS cnt FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' AND name NOT IN ('_cf_METADATA','d1_migrations');" \ + "SELECT COUNT(*) AS cnt FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '_cf_%' AND name NOT IN ('d1_migrations');" \ --json | jq -r '.[0].results[0].cnt // 0') - echo "Existing user table count: ${TABLE_COUNT}" + echo "Existing app table count: ${TABLE_COUNT}" if [ "${TABLE_COUNT}" = "0" ]; then echo "🆕 Empty D1 database detected; applying sql/schema.sql..." $WRANGLER d1 execute vault1 --remote --file sql/schema.sql diff --git a/wrangler.toml b/wrangler.toml index 3f55d42..5a861ed 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -92,6 +92,8 @@ keep_vars = true workers_dev = false preview_urls = false +[env.dev.vars] + [env.dev.durable_objects] bindings = [ { name = "HEAVY_DO", class_name = "HeavyDo" }