-
-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move types pg types to prod dependencies * Change version to 0.9.0 * Add type for every exception * Update setters for update statement together with enum types hadnling (#1) * Add InArray and Like queries * Setters now handled as object to update; * Enum types will be setup independently from tables and just be reused Co-authored-by: AndriiSherman <sherman@lambda.direct> * 0.9.1 * Update README docs (#2) * Feature/last updates (#3) * 0.9.1 * Add 5 joins * Add distinct for select queries * Return object on delete * Add raw query builder * Add serializer for drizzle-kit support * 0.9.2 * Add serial to serializer * 0.9.3 * Add onConstraint for serializer * 0.9.4 * Move ON DELETE and ON UPDATE to references * 0.9.5 * Add foreignKeyName to serializer * 0.9.6 * Improvements (#4) * 0.9.6 * Add all possible pverloads for decimal column type * Add possibility to create custom update statements, imstead of just setting values * Change OnUpdate and OnDelete API * 0.9.7 * onContrsaint as optional * 0.9.8 * Fix serializer key * 0.9.9 * 0.9.10 * Fix Nan exception on mapping * Add smallInt type * 0.9.11 * Export ExtractModel type * 0.9.12 * Feature/knex (#6) * 0.9.12 * Add Session interface for extensions * 0.9.13 * 0.9.14 * Export ISession * 0.9.15 * Release/0.9.16 (#7) * Add migrator logic * 0.9.15 * Remove autoincrement field and add serial for postgres * Move notNull to method instead of column type * Add timestamp with timezone type * Add default value for timestamp/time/timestamptz * Add big integers type separating for 2^53 and 2^64 difference between javascript and postgres * Fix migrations table * 0.9.16 * Add migrator changelog+readme with migrator function * Add serializer to introspect database to json snapshot (#8)
- Loading branch information
1 parent
d8a0c86
commit b0df42b
Showing
45 changed files
with
2,867 additions
and
373 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,78 @@ | ||
# Changelog | ||
|
||
### 0.9.17 (December 27, 2021) | ||
### Fixes and Functionality: | ||
- Add serializer `fromDb()` method to introspect selected database to drizzle-kit json shanpsot format | ||
|
||
--- | ||
### 0.9.16 (December 27, 2021) | ||
### Breaking changes: | ||
- Delete `autoincrement` type on columns. Right now you should use `serial` type | ||
|
||
#### Previous serial column defining: | ||
```typescript | ||
public id = this.int('id').autoincrement(); | ||
``` | ||
#### Current serial column defining: | ||
```typescript | ||
public id = this.serial('id'); | ||
``` | ||
|
||
- Move `notNull` from column type metadata to builder chain | ||
#### Previous notNull defining: | ||
```typescript | ||
public phone = this.varchar('phone', { notNull: true }); | ||
``` | ||
#### Current notNull defining: | ||
```typescript | ||
public phone = this.varchar('phone').notNull(); | ||
``` | ||
|
||
- Divide `BigInt` into 2 types -> `BigInt53` and `BigInt64` | ||
- Divide `BigSerial` into 2 types -> `BigSerial53` and `BigSerial64` | ||
|
||
Due to have max value for big integers in postgres as 2^64 and javascript max value for integers is 2^53 | ||
|
||
If you sure, that value in this column won't be more than 2^53 you could use: | ||
```typescript | ||
public bigIntField = this.bigint('test1', 'max_bytes_53'); | ||
``` | ||
that will be of type `number` in typescript | ||
|
||
If value in this column could be more than 2^53 you could use: | ||
```typescript | ||
public bigIntField = this.bigint('test1', 'max_bytes_64'); | ||
``` | ||
that will be of type `bigint` in typescript | ||
--- | ||
|
||
### Fixes and Functionality: | ||
- Add `SET NULL` and `SET DEFAULT` for `ON DELETE` and `ON UPDATE` constraints | ||
|
||
#### Example of usage | ||
```typescript | ||
public userId = this.int('user_id').foreignKey(UsersTable, (table) => table.id, { onUpdate: 'SET NULL' }); | ||
public userId = this.int('user_id').foreignKey(UsersTable, (table) => table.id, { onDelete: 'SET DEFAULT' }); | ||
``` | ||
- Add default value for timestamp | ||
```typescript | ||
public createdAt = this.timestamp('created_at').defaultValue(Defaults.CURRENT_TIMESTAMP); | ||
``` | ||
- Add `timestamp with timezone` type | ||
```typescript | ||
public createdAt = this.timestamptz('created_at'); | ||
``` | ||
- Add migrator function to use `drizzle-kit` generated migrations | ||
##### Provide drizzle-kit config path | ||
```typescript | ||
await drizzle.migrator(db).migrate('src/drizzle.config.yaml'); | ||
``` | ||
##### Provide object with path to folder with migrations | ||
```typescript | ||
await drizzle.migrator(db).migrate({ migrationFolder: 'drizzle' }); | ||
``` | ||
--- | ||
|
||
### Documentation: | ||
- Change README documentation for all changes in current release |
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.