chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# drizzle-orm-mysql 0.14.1
|
||||
|
||||
- Release support for mysql. Currently mysql module is up-to-date with `pg` and `sqlite`
|
||||
@@ -0,0 +1,3 @@
|
||||
# drizzle-orm-mysql 0.14.2
|
||||
|
||||
- Bumped everything to 0.14.2
|
||||
@@ -0,0 +1,3 @@
|
||||
# drizzle-orm-mysql 0.14.3
|
||||
|
||||
- Fill author field in package.json
|
||||
@@ -0,0 +1,3 @@
|
||||
# drizzle-orm-mysql 0.15.0
|
||||
|
||||
- Bumped everything to 0.15.0
|
||||
@@ -0,0 +1,88 @@
|
||||
# drizzle-orm-mysql 0.15.1
|
||||
|
||||
Add support for schemas -> [MySQL schemas](https://dev.mysql.com/doc/refman/8.0/en/create-database.html)
|
||||
|
||||
|
||||
> **Warning**
|
||||
> If you will have tables with same names in different schemas then drizzle will respond with `never[]` error in result types and error from database
|
||||
>
|
||||
> In this case you may use [alias syntax](https://github.com/drizzle-team/drizzle-orm/tree/main/drizzle-orm-mysql#join-aliases-and-self-joins)
|
||||
|
||||
---
|
||||
|
||||
Usage example
|
||||
```typescript
|
||||
// Table in default schema
|
||||
const publicUsersTable = mysqlTable('users', {
|
||||
id: serial('id').primaryKey(),
|
||||
name: text('name').notNull(),
|
||||
verified: boolean('verified').notNull().default(false),
|
||||
jsonb: json<string[]>('jsonb'),
|
||||
createdAt: timestamp('created_at', { fsp: 2 }).notNull().defaultNow(),
|
||||
});
|
||||
|
||||
|
||||
// Table in custom schema
|
||||
const mySchema = mysqlSchema('mySchema');
|
||||
|
||||
const mySchemaUsersTable = mySchema('users', {
|
||||
id: serial('id').primaryKey(),
|
||||
name: text('name').notNull(),
|
||||
verified: boolean('verified').notNull().default(false),
|
||||
jsonb: json<string[]>('jsonb'),
|
||||
createdAt: timestamp('created_at', { fsp: 2 }).notNull().defaultNow(),
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Breaking changes
|
||||
- `foreignKey()` function api changes. Previously you need to pass callback function with table columns for FK. Right now no need for callback, just object with data for FK
|
||||
|
||||
#### Before
|
||||
```typescript
|
||||
export const usersTable = mysqlTable('userstest', {
|
||||
id: serial('id').primaryKey(),
|
||||
homeCity: text('name').notNull(),
|
||||
createdAt: timestamp('created_at', { fsp: 2 }).notNull().defaultNow(),
|
||||
}, (users) => ({
|
||||
// foreignKey has a callback as param
|
||||
usersCityFK: foreignKey(() => { columns: [users.homeCity], foreignColumns: [cities.id] }),
|
||||
}));
|
||||
```
|
||||
|
||||
#### Now
|
||||
```typescript
|
||||
export const usersTable = mysqlTable('userstest', {
|
||||
id: serial('id').primaryKey(),
|
||||
homeCity: text('name').notNull(),
|
||||
createdAt: timestamp('created_at', { fsp: 2 }).notNull().defaultNow(),
|
||||
}, (users) => ({
|
||||
// foreignKey has a callback as param
|
||||
usersCityFK: foreignKey({ columns: [users.homeCity], foreignColumns: [cities.id] }),
|
||||
}));
|
||||
```
|
||||
---
|
||||
|
||||
- Change enum initializing strategy for mysql
|
||||
|
||||
You should use
|
||||
``` typescript
|
||||
mysqlEnum('popularity', ['unknown', 'known', 'popular']).notNull().default('known')
|
||||
```
|
||||
|
||||
instead of
|
||||
``` typescript
|
||||
export const popularityEnum = mysqlEnum('popularity', ['unknown', 'known', 'popular']);
|
||||
popularityEnum('column_name');
|
||||
```
|
||||
|
||||
Usage example in table schema
|
||||
``` typescript
|
||||
const tableWithEnums = mysqlTable('enums_test_case', {
|
||||
id: serial('id').primaryKey(),
|
||||
enum1: mysqlEnum('enum1', ['a', 'b', 'c']).notNull(),
|
||||
enum2: mysqlEnum('enum2', ['a', 'b', 'c']).default('a'),
|
||||
enum3: mysqlEnum('enum3', ['a', 'b', 'c']).notNull().default('b'),
|
||||
});
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
# drizzle-orm-mysql 0.15.2
|
||||
|
||||
Internal release
|
||||
@@ -0,0 +1,3 @@
|
||||
# drizzle-orm-mysql 0.15.3
|
||||
|
||||
Internal release
|
||||
@@ -0,0 +1,3 @@
|
||||
# drizzle-orm-mysql 0.16.0
|
||||
|
||||
- Bump all packages to 0.16.0
|
||||
@@ -0,0 +1,19 @@
|
||||
# drizzle-orm-mysql 0.16.1
|
||||
|
||||
- Add possibility to define database custom data types
|
||||
|
||||
Example usage:
|
||||
|
||||
```typescript
|
||||
const customText = customType<{ data: string }>({
|
||||
dataType() {
|
||||
return 'text';
|
||||
},
|
||||
});
|
||||
|
||||
const usersTable = mysqlTable('users', {
|
||||
name: customText('name').notNull(),
|
||||
});
|
||||
```
|
||||
|
||||
For more examples please check [docs](https://github.com/drizzle-team/drizzle-orm/blob/main/docs/custom-types.lite.md)
|
||||
@@ -0,0 +1,3 @@
|
||||
# drizzle-orm-mysql 0.16.2
|
||||
|
||||
- Fix peer dependency error for >=0.16 drizzle packages
|
||||
Reference in New Issue
Block a user