-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
7 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@astrojs/db": patch | ||
--- | ||
|
||
Fixes an issue where one table schema could not reference text fields of another table schema. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
import { db, Session, User, eq } from 'astro:db'; | ||
const users = await db.select().from(User); | ||
const sessions = await db.select() | ||
.from(Session) | ||
.innerJoin(User, eq(Session.userId, User.id)); | ||
--- | ||
|
||
<h2>Sessions</h2> | ||
<ul class="sessions-list"> | ||
{sessions.map(({ Session, User }) => ( | ||
<li> | ||
<div class="session-id">{Session.id}</div> | ||
<div class="username">{User.username}</div> | ||
</li> | ||
))} | ||
</ul> |