Skip to content

Commit

Permalink
Beta (#3503)
Browse files Browse the repository at this point in the history
* Fix breakpoints option default value

* fix: added commonly used columns to supabase auth.users table schema

* imports checker with OHM grammar

* imports checker with OHM grammar + fix of imports issues

* Formatting fix

* [MySQL] Add unsigned floating point types + Fix unsigned integer type bugs in Kit (#3284)

* Fix bugs with MySQL introspection tests

* Update float data type in MySQL

* Better support for float types in MySQL

* Handle existing unsigned numerical types in MySQL

* Add unsigned to floating point types in MySQL

* Handle unsigned floating point types in MySQL

* Update decimal data type

---------

Co-authored-by: Andrii Sherman <andreysherman11@gmail.com>

* Batch of bugfixes for ORM (#3181)

* (MySQL) Fix placeholder type error in offset and limit

* Add prepared statement tests

* Add PG test

* Fix blob parsing in bun sqlite driver

* Lint and format

* Fix file

* Fix tests

* Use const instead of let in tests

* Format

---------

Co-authored-by: Andrii Sherman <andreysherman11@gmail.com>

* main to beta (#3404)

* Update Github issue templates (#3157)

* Update GH issue templates

* Update issue templates

---------

Co-authored-by: Andrii Sherman <andreysherman11@gmail.com>

* Fix checkboxes

---------

Co-authored-by: L-Mario564 <ka.mario564@gmail.com>

* feat: add tablesFilter to pushSchema api (#3141)

* feat: add tablesFilter to pushSchema api

* Format with dprint

---------

Co-authored-by: Andrii Sherman <andreysherman11@gmail.com>

* Batch of bugfixes for Kit (#2959)

* Escape single quote in enum value

* Escape single quotes in string default values

* Handle instrospection of strings with single quotes

* Add tests

* Add tests

* Uncomment tests

* Fix SQL statement order in MySQL

* Add MySQL test

* Fix alter composite PK statement missing quotes in PG

* Add tests

* Handle SQL expressions in timestamp, date and time in PG

* Use `.run` instead of `.query` in SQLite queries that don't return anything

* Fix parsing of enum array types in PG

* Generate more PG index operators

* Fix primary key recreate on table rename

* Format

* Format

* Update test

* Format

* Fix tests

* Fix terminal output mistake

* Remove duplicate import

---------

Co-authored-by: Andrii Sherman <andreysherman11@gmail.com>

* Bump versions

---------

Co-authored-by: Steffen <3752127+klotztech@users.noreply.github.com>
Co-authored-by: Nicholas Ly <hello@nicholasly.com>
Co-authored-by: Alex Blokh <aleksandrblokh@gmail.com>
Co-authored-by: Sukairo-02 <sreka9056@gmail.com>
Co-authored-by: L-Mario564 <ka.mario564@gmail.com>
Co-authored-by: Dan Ribbens <DanRibbens@users.noreply.github.com>
  • Loading branch information
7 people authored Nov 6, 2024
1 parent 8e98201 commit 906c87e
Show file tree
Hide file tree
Showing 56 changed files with 2,993 additions and 415 deletions.
28 changes: 28 additions & 0 deletions changelogs/drizzle-kit/0.28.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Improvements

- Added an OHM static imports checker to identify unexpected imports within a chain of imports in the drizzle-kit repo. For example, it checks if drizzle-orm is imported before drizzle-kit and verifies if the drizzle-orm import is available in your project.
- [Adding more columns to Supabase auth.users table schema](https://github.com/drizzle-team/drizzle-orm/issues/3327) - thanks @nicholasdly

# Bug Fixes

- [[BUG]: [drizzle-kit]: Fix breakpoints option cannot be disabled](https://github.com/drizzle-team/drizzle-orm/issues/2828) - thanks @klotztech
- [[BUG]: drizzle-kit introspect: SMALLINT import missing and incorrect DECIMAL UNSIGNED handling](https://github.com/drizzle-team/drizzle-orm/issues/2950) - thanks @L-Mario564
- [Unsigned tinyints preventing migrations](https://github.com/drizzle-team/drizzle-orm/issues/1571) - thanks @L-Mario564
- [[BUG]: Can't parse float(8,2) from database (precision and scale and/or unsigned breaks float types)](https://github.com/drizzle-team/drizzle-orm/issues/3285) - thanks @L-Mario564
- [[BUG]: PgEnum generated migration doesn't escape single quotes](https://github.com/drizzle-team/drizzle-orm/issues/1272) - thanks @L-Mario564
- [[BUG]: single quote not escaped correctly in migration file](https://github.com/drizzle-team/drizzle-orm/issues/2184) - thanks @L-Mario564
- [[BUG]: Migrations does not escape single quotes](https://github.com/drizzle-team/drizzle-orm/issues/1765) - thanks @L-Mario564
- [[BUG]: Issue with quoted default string values](https://github.com/drizzle-team/drizzle-orm/issues/2122) - thanks @L-Mario564
- [[BUG]: SQl commands in wrong roder](https://github.com/drizzle-team/drizzle-orm/issues/2390) - thanks @L-Mario564
- [[BUG]: Time with precision in drizzle-orm/pg-core adds double-quotes around type](https://github.com/drizzle-team/drizzle-orm/issues/1804) - thanks @L-Mario564
- [[BUG]: Postgres push fails due to lack of quotes](https://github.com/drizzle-team/drizzle-orm/issues/2396) - thanks @L-Mario564
- [[BUG]: TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')](https://github.com/drizzle-team/drizzle-orm/issues/2344) - thanks @L-Mario564
- [[BUG]: drizzle-kit introspect generates CURRENT_TIMESTAMP without sql operator on date column](https://github.com/drizzle-team/drizzle-orm/issues/2899) - thanks @L-Mario564
- [[BUG]: Drizzle-kit introspect doesn't pull correct defautl statement](https://github.com/drizzle-team/drizzle-orm/issues/2905) - thanks @L-Mario564
- [[BUG]: Problem on MacBook - This statement does not return data. Use run() instead](https://github.com/drizzle-team/drizzle-orm/issues/2623) - thanks @L-Mario564
- [[BUG]: Enum column names that are used as arrays are not quoted](https://github.com/drizzle-team/drizzle-orm/issues/2598) - thanks @L-Mario564
- [[BUG]: drizzle-kit generate ignores index operators](https://github.com/drizzle-team/drizzle-orm/issues/2935) - thanks @L-Mario564
- [dialect param config error message is wrong](https://github.com/drizzle-team/drizzle-orm/issues/3427) - thanks @L-Mario564
- [[BUG]: Error setting default enum field values](https://github.com/drizzle-team/drizzle-orm/issues/2299) - thanks @L-Mario564
- [[BUG]: drizzle-kit does not respect the order of columns configured in primaryKey()](https://github.com/drizzle-team/drizzle-orm/issues/2326) - thanks @L-Mario564
- [[BUG]: Cannot drop Unique Constraint MySQL](https://github.com/drizzle-team/drizzle-orm/issues/998) - thanks @L-Mario564
6 changes: 6 additions & 0 deletions changelogs/drizzle-orm/0.36.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Bug Fixes

- [[BUG]: Using sql.placeholder with limit and/or offset for a prepared statement produces TS error](https://github.com/drizzle-team/drizzle-orm/issues/2146) - thanks @L-Mario564
- [[BUG] If a query I am trying to modify with a dynamic query (....$dynamic()) contains any placeholders, I'm getting an error that says No value for placeholder.... provided](https://github.com/drizzle-team/drizzle-orm/issues/2272) - thanks @L-Mario564
- [[BUG]: Error thrown when trying to insert an array of new rows using generatedAlwaysAsIdentity() for the id column](https://github.com/drizzle-team/drizzle-orm/issues/2849) - thanks @L-Mario564
- [[BUG]: Unable to Use BigInt Types with Bun and Drizzle](https://github.com/drizzle-team/drizzle-orm/issues/2603) - thanks @L-Mario564
1 change: 1 addition & 0 deletions drizzle-kit/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
**/.DS_Store

!src
!imports-checker
!tests
!vitest.config.ts
!README.md
Expand Down
78 changes: 78 additions & 0 deletions drizzle-kit/imports-checker/analyze.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { readFileSync } from 'fs';
import type { Node } from 'ohm-js';
import JSImports from './grammar/grammar.ohm-bundle';

export type CollectionItem = {
type: 'data' | 'types';
source: string;
};

function recursiveRun(...args: Node[]): boolean {
for (const arg of args) {
if (
arg.ctorName === 'Rest'
|| arg.ctorName === 'comment'
|| arg.ctorName === 'stringLiteral'
) {
continue;
}

if (
arg.ctorName === 'ImportExpr_From'
|| arg.ctorName === 'ImportExpr_NoFrom'
) {
arg['analyze']();

continue;
}

if (arg.isTerminal()) continue;

for (const c of arg.children) {
if (!recursiveRun(c)) return false;
}
}

return true;
}
function init(collection: CollectionItem[]) {
const semantics = JSImports.createSemantics();

semantics.addOperation('analyze', {
JSImports(arg0, arg1) {
recursiveRun(arg0, arg1);
},

ImportExpr_From(kImport, importInner, kFrom, importSource) {
const ruleName = importInner.children[0]!.ctorName;
const importType = ruleName === 'ImportInner_Type' || ruleName === 'ImportInner_Types'
? 'types'
: 'data';

collection.push({
source: importSource.children[1]!.sourceString!,
type: importType,
});
},

ImportExpr_NoFrom(kImport, importSource) {
collection.push({
source: importSource.children[1]!.sourceString!,
type: 'data',
});
},
});

return semantics;
}

export function analyze(path: string) {
const file = readFileSync(path).toString();
const match = JSImports.match(file, 'JSImports');

if (match.failed()) throw new Error(`Failed to parse file: ${path}`);
const collection: CollectionItem[] = [];

init(collection)(match)['analyze']();
return collection;
}
Loading

0 comments on commit 906c87e

Please sign in to comment.