-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: deduplicate and abstract SQL schema building (#9987)
### What? Abstracts SQL schema building, significantly reducing code duplication for SQLite / Postgres db-sqlite lines count From: ```sh wc -l **/*.ts 62 src/connect.ts 32 src/countDistinct.ts 9 src/createJSONQuery/convertPathToJSONTraversal.ts 86 src/createJSONQuery/index.ts 15 src/defaultSnapshot.ts 6 src/deleteWhere.ts 21 src/dropDatabase.ts 15 src/execute.ts 178 src/index.ts 139 src/init.ts 19 src/insert.ts 19 src/requireDrizzleKit.ts 544 src/schema/build.ts 27 src/schema/createIndex.ts 38 src/schema/getIDColumn.ts 13 src/schema/idToUUID.ts 28 src/schema/setColumnID.ts 787 src/schema/traverseFields.ts 18 src/schema/withDefault.ts 248 src/types.ts 2304 total ``` To: ```sh wc -l **/*.ts 62 src/connect.ts 32 src/countDistinct.ts 9 src/createJSONQuery/convertPathToJSONTraversal.ts 86 src/createJSONQuery/index.ts 15 src/defaultSnapshot.ts 6 src/deleteWhere.ts 21 src/dropDatabase.ts 15 src/execute.ts 180 src/index.ts 39 src/init.ts 19 src/insert.ts 19 src/requireDrizzleKit.ts 149 src/schema/buildDrizzleTable.ts 32 src/schema/setColumnID.ts 258 src/types.ts 942 total ``` Builds abstract schema in shared drizzle package that later gets converted by SQLite/ Postgres specific implementation into drizzle schema. This, apparently can also help here #9953. It should be very trivial to implement a MySQL adapter with this as well.
- Loading branch information
Showing
30 changed files
with
1,872 additions
and
2,486 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
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
Oops, something went wrong.