forked from drizzle-team/drizzle-orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drizzle-seed bug fixes (drizzle-team#3614)
Fixed a few seed bugs --------- Co-authored-by: AndriiSherman <andreysherman11@gmail.com>
- Loading branch information
1 parent
03f6239
commit 599da5e
Showing
9 changed files
with
121 additions
and
25 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,2 @@ | ||
- Fixed: [[BUG]: drizzle-seed reset fails without @electric-sql/pglite installed](https://github.com/drizzle-team/drizzle-orm/issues/3603) | ||
- Fixed: [[BUG]: TypeScript type error in drizzle-seed with schema passed to drizzle in IDE](https://github.com/drizzle-team/drizzle-orm/issues/3599) |
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,17 @@ | ||
import type { MySqlColumn } from 'drizzle-orm/mysql-core'; | ||
import { int, mysqlTable, text } from 'drizzle-orm/mysql-core'; | ||
import { drizzle as mysql2Drizzle } from 'drizzle-orm/mysql2'; | ||
import { reset, seed } from '../index.ts'; | ||
|
||
const mysqlUsers = mysqlTable('users', { | ||
id: int().primaryKey().autoincrement(), | ||
name: text(), | ||
inviteId: int('invite_id').references((): MySqlColumn => mysqlUsers.id), | ||
}); | ||
|
||
{ | ||
const db = mysql2Drizzle(''); | ||
|
||
await seed(db, { users: mysqlUsers }); | ||
await reset(db, { users: mysqlUsers }); | ||
} |
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,48 @@ | ||
import { drizzle as nodePostgresDrizzle } from 'drizzle-orm/node-postgres'; | ||
import type { PgColumn } from 'drizzle-orm/pg-core'; | ||
import { integer, pgTable, text } from 'drizzle-orm/pg-core'; | ||
import { drizzle as pgliteDrizzle } from 'drizzle-orm/pglite'; | ||
import { drizzle as postgresJsDrizzle } from 'drizzle-orm/postgres-js'; | ||
import { reset, seed } from '../index.ts'; | ||
|
||
const pgUsers = pgTable('users', { | ||
id: integer().primaryKey().generatedAlwaysAsIdentity(), | ||
name: text(), | ||
inviteId: integer('invite_id').references((): PgColumn => pgUsers.id), | ||
}); | ||
|
||
{ | ||
const db0 = nodePostgresDrizzle('', { schema: { users: pgUsers } }); | ||
|
||
await seed(db0, { users: pgUsers }); | ||
await reset(db0, { users: pgUsers }); | ||
|
||
const db1 = nodePostgresDrizzle(''); | ||
|
||
await seed(db1, { users: pgUsers }); | ||
await reset(db1, { users: pgUsers }); | ||
} | ||
|
||
{ | ||
const db0 = pgliteDrizzle('', { schema: { users: pgUsers } }); | ||
|
||
await seed(db0, { users: pgUsers }); | ||
await reset(db0, { users: pgUsers }); | ||
|
||
const db1 = pgliteDrizzle(''); | ||
|
||
await seed(db1, { users: pgUsers }); | ||
await reset(db1, { users: pgUsers }); | ||
} | ||
|
||
{ | ||
const db0 = postgresJsDrizzle('', { schema: { users: pgUsers } }); | ||
|
||
await seed(db0, { users: pgUsers }); | ||
await reset(db0, { users: pgUsers }); | ||
|
||
const db1 = postgresJsDrizzle(''); | ||
|
||
await seed(db1, { users: pgUsers }); | ||
await reset(db1, { users: pgUsers }); | ||
} |
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,17 @@ | ||
import { drizzle as betterSqlite3Drizzle } from 'drizzle-orm/better-sqlite3'; | ||
import type { SQLiteColumn } from 'drizzle-orm/sqlite-core'; | ||
import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
import { reset, seed } from '../index.ts'; | ||
|
||
const mysqlUsers = sqliteTable('users', { | ||
id: int().primaryKey(), | ||
name: text(), | ||
inviteId: int('invite_id').references((): SQLiteColumn => mysqlUsers.id), | ||
}); | ||
|
||
{ | ||
const db = betterSqlite3Drizzle(''); | ||
|
||
await seed(db, { users: mysqlUsers }); | ||
await reset(db, { users: mysqlUsers }); | ||
} |
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,11 @@ | ||
{ | ||
"extends": "../../tsconfig.build.json", | ||
"compilerOptions": { | ||
"composite": false, | ||
"noEmit": true, | ||
"rootDir": "..", | ||
"outDir": "./.cache" | ||
}, | ||
"include": [".", "../src"], | ||
"exclude": ["**/playground"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.