0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
Commit graph

74 commits

Author SHA1 Message Date
Ben Holmes
95e3cc84e8
db: dev --remote test fixture (#10527)
* feat: scaffold basic proxy

* feat: setupDbServer util

* feat: ASTRO_INTERNAL_TEST_REMOTE bypass

* feat: basic --remote test

* chore: add port incrementer
2024-03-22 08:28:12 -04:00
Matthew Phillips
30ce9a0c47
Revert "Removing embedding appToken from CI (#10497)" (#10520)
* Revert "Removing embedding appToken from CI (#10497)"

This reverts commit 2fc7231df2.

* Changeset
2024-03-21 10:21:35 -04:00
Matthew Phillips
297571eb98 [ci] format 2024-03-20 18:43:56 +00:00
Matthew Phillips
980020c5e0
Ensure --force-reset drops previous tables (#10506)
* Ensure --force-reset drops previous tables

* Remove unused import

* Do suggestions
2024-03-20 14:42:41 -04:00
Ben Holmes
98b982bdfc [ci] format 2024-03-20 11:29:14 +00:00
Ben Holmes
f0fc78c873
db: expose isDbError() utility (#10498)
* feat: expose isDbError

* test: foreign key constraint error detection

* fix(test); use isDbError

* chore: changeset
2024-03-20 07:27:48 -04:00
Ben Holmes
4831051260
Fix: remove db.transaction() from types until supported (#10501)
* fix: remove transaction from db types

* fix: transaction() runtime error

* chore: changeset
2024-03-20 08:27:48 +00:00
Matthew Phillips
2fc7231df2
Removing embedding appToken from CI (#10497) 2024-03-19 14:48:01 -04:00
James Garbutt
2ebcf94d0a
chore(db): Add missing github-slugger dependency & tests (#10405)
* chore: add missing github-slugger dependency

* test: add column-queries data loss tests

* chore: remove unused vars

* test: assert length rather than message content
2024-03-19 17:10:33 +00:00
Ben Holmes
ad57a02c33
db: Expose aggregation helpers (#10479)
* deps: drizzle 0.30

* feat: expose drizzle aggregation helpers

* chore: changeset
2024-03-19 08:56:48 +00:00
Fred K. Schott
124cdd64f2
remove token wait time (#10477) 2024-03-18 20:45:47 -07:00
Matthew Phillips
34206ed60f [ci] format 2024-03-18 12:06:35 +00:00
Matthew Phillips
37a485b4d1
Create new token when current has expired (#10435)
* Create new token when current has expired

* Add changeset

* Rename renew timer function:

* Handle creating a new token on renewal
2024-03-18 08:05:36 -04:00
Ben Holmes
156c094c3e [ci] format 2024-03-18 11:56:49 +00:00
Ben Holmes
219c49473f
fix type error in seed stub on initial setup (#10457)
* fix: move db type to base types for seed stub

* chore: changeset

* fix(test): bad NOW import
2024-03-18 07:55:39 -04:00
Ben Holmes
8a80dbfdde [ci] format 2024-03-15 17:59:44 +00:00
Ben Holmes
5b48cc0fc8
feat(db): Run db type generation on astro sync (#10438)
* feat: db typegen on astro sync

* fix: avoid requiring db to be installed

* fix: make typegen optional for backwards compat

* chore: changeset

* fix: required -> optional

* fix: remove flags from sync API signature
2024-03-15 13:58:45 -04:00
Ben Holmes
0989cd3284
feat(db): execute command logs (#10439)
* feat: db execute success and error logs

* chore: changeset
2024-03-15 13:58:36 -04:00
Matthew Phillips
098623c261
Prefer getting app token from runtime env (#10445) 2024-03-14 14:53:25 -04:00
Ben Holmes
5166e9715a
chore: remove duplicate astro:db log (#10441)
* chore: remove duplicate astro:db log

* chore: changeset
2024-03-14 14:39:53 -04:00
Arsh
cdf1ac1292 [ci] format 2024-03-14 18:29:56 +00:00
Arsh
238f047b9d
fix(db): separate utils for runtime (#10443)
* fix(db): separate utils for runtime

* add changeset

* use safeFetch from runtime utils
2024-03-14 14:28:51 -04:00
Fred K. Schott
6b26761d09 [ci] format 2024-03-14 15:58:49 +00:00
Fred K. Schott
1076864cc4
wait for token to propagate (#10431) 2024-03-14 08:57:40 -07:00
Fred K. Schott
4e24628aac
add missing regions to link command (#10432) 2024-03-13 16:17:17 -07:00
Fred K. Schott
9b3ec5e018 [ci] format 2024-03-13 19:53:36 +00:00
Fred K. Schott
189ec47c1e
add region support to db calls (#10428) 2024-03-13 12:50:55 -07:00
Erika
2db25c05a4
fix(db): Add a safe db fetch wrapper (#10420)
* fix(db): Add a safe db fetch wrapper

* chore: changeset
2024-03-13 17:12:52 +01:00
Arsh
4e1a9c5299 [ci] format 2024-03-13 13:50:39 +00:00
Arsh
96c8bca19a
fix(db): validate column type before column schema (#10409)
* fix(db): validate column type before column schema

* add changeset

* Add test for text foreign keys

---------

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2024-03-13 09:49:28 -04:00
Ben Holmes
a084d8cec6
feat: split config types to separate build (#10401)
* feat: split config types to separate build

* chore: changeset

* fix: drizzle property exports
2024-03-12 09:44:15 -04:00
Ben Holmes
41ca94e513
chore: remove drop table check for added table (#10396)
* chore: remove drop table check for added table

* chore: remove drop table from test

* chore: changeset
2024-03-12 07:30:45 -04:00
Matthew Phillips
a49892349e
Set new Astro Studio production URL (#10395) 2024-03-11 15:35:51 -07:00
Darius
c1ba369426 [ci] format 2024-03-11 22:07:55 +00:00
Darius
f76dcb769f
export DB types (#10374)
* export DB types

* refactor: move schemas to separate file

* chore: changeset

* chore: add typesVersions

---------

Co-authored-by: bholmesdev <hey@bholmes.dev>
2024-03-11 18:06:52 -04:00
Ben Holmes
ae7dc5f692 [ci] format 2024-03-11 19:55:57 +00:00
Ben Holmes
236cdbb611
New CLI help reference for studio and db commands (#10390)
* feat: new, formatted astro db help

* feat: add "studio commands" section to cli

* chore: changeset

* Update packages/db/src/core/cli/print-help.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update .changeset/thirty-bags-live.md

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

---------

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2024-03-11 15:54:49 -04:00
Ben Holmes
9667ee990c
fix: remove runtime/config suggestion for db config exports (#10391)
* chore: remove runtime/config from package json

* fix: use relative path to dist

* chore: changeset

* Revert "fix: use relative path to dist"

This reverts commit 16c0cc296e.

* Revert "chore: remove runtime/config from package json"

This reverts commit c1b4678998.

* refactor: types null

* fix: exclude config.ts from tsc

* chore: update consts

* chore: comment on intellisense
2024-03-11 15:44:58 -04:00
Fred K. Schott
c9a1111275 [ci] format 2024-03-11 19:33:26 +00:00
Fred K. Schott
8a23ee530c
add handling for success=false responses (#10387) 2024-03-11 12:32:20 -07:00
Chris Swithinbank
6170122884 [ci] format 2024-03-11 19:09:04 +00:00
Chris Swithinbank
38abae47b5
Fix db for projects without a seed file or with integrations (#10385)
* Add fixture and tests for integration with no user db config

* Create database tables when integration seed files load

* Defer running seed function until all modules are loaded

* Update package name

* Add test & fixture for a project with no seed file

* `recreateTables()` from `seedLocal()` (and move it out of main runtime module)

* Fix typo after rebase

* FREEZE DON’T MOVE

* Move `seedLocal` export back to runtime

* Simplify seed file normalization

* Clean up test files

* Add build tests for no-seed and integration-only fixtures

* Add changeset
2024-03-11 20:07:53 +01:00
Chris Swithinbank
8cceab587d
Use static imports for integration seed files in astro:db (#10381)
* Use static imports for integration seed files in `astro:db`

* Add changeset

* Add build test for integrations fixture

* chore: comment on top-level seed imports

* fix: random db id for tests

* fix: set db id from build before

* wip: remove reset on env variable

* wip: move random db id env to top of test file

* refactor: remove unlink from db startup

* chore: remove random db id completely??

---------

Co-authored-by: bholmesdev <hey@bholmes.dev>
2024-03-11 09:51:15 -04:00
Fred K. Schott
41dca1e413
handle undefined snapshot from API (#10378) 2024-03-10 23:56:01 -07:00
Chris Swithinbank
3f27e09628
Rename defineDB to defineDb (#10364)
* Rename `defineDB` to `defineDb`

* Add changeset

* Improve changeset
2024-03-07 19:21:03 -06:00
Ben Holmes
988aad6705
Add batch support (#10361)
* deps: drizzle preview

* feat: db.batch and method run handling

* refactor: use db.batch in test fixture

* deps: bump to drizzle 0.29.5

* chore: changeset

* fix: unpin drizzle version

* fix: db execute should uh... execute
2024-03-07 14:49:46 -05:00
Chris Swithinbank
52fba64cb2 [ci] format 2024-03-07 19:20:45 +00:00
Chris Swithinbank
2e4958c8a7
Add integrations API for db config/seed files (#10321)
* Add integrations API for adding db config/seed files

* Fix seeding when user seed file is present

* Add basic test and fixture for integrations API

* Freeze that lockfile

* Test to see if this is a Windows fix

* Don’t import.meta.glob integration seed files

* Make integration seed files export a default function

* style: rejiggle

* Fix temporary file conflicts

* Remove changes to Astro’s core types, type utility method instead

* Use `astro:db` instead of `@astrojs/db`

* Revert unnecessarily cautious temporary path name

This reverts commit ef2156e41b.

* Add changeset

* Fix entrypoints and `asDrizzleTable` usage in changeset

* Getting Nate in on the co-author action

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

* Fix user seed file in integrations fixture

* Update `seedLocal()` after merge

* Provide empty `seedFiles` array in `db execute`

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2024-03-07 20:19:17 +01:00
Ben Holmes
e086a9f8c8 [ci] format 2024-03-07 18:39:47 +00:00
Ben Holmes
06fe94e29d
Add --remote flag for remote connection (#10352)
* feat: check for --remote

* chore: remove bad ticketing example cols

* fix: get seed file working with build

* Revert "fix: get seed file working with build"

This reverts commit 92830a106164b0997c820a3e0bf2a582018084a0.

* fix: seed from build instead of runtime

* refactor: move recreateTables out of runtime

* Revert "refactor: move recreateTables out of runtime"

This reverts commit d01a802ad7915fabc4c4ac35b2d907eae0538d95.

* fix: in-memory db for test fixture

* chore: changeset

* refactor: generate random db name instead

* refactor: use yargs-parser for flag

* chore: remove in-memory db logi

* refactor: rename random id flag for clarity

* feat: support --remote in dev

* feat: support --remote on shell

* refactor: inline db client

* feat: support --remote on db execute

* chore: stray console log

* chore: remove recreateTables from runtime

* chore: update seeding for new signature

* chore: remove unused error imports
2024-03-07 13:38:43 -05:00