drizzle-orm 0.11.3 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +1 -9
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ## DrizzleORM
2
- DrizzleORM is a TypeScript ORM library with a [drizzle-kit](https://github.com/lambda-direct/drizzle-orm/tree/develop/kit) CLI companion for automatic SQL migrations generation. It's meant to be a library, not a framework, stay as an opt-in solution all the time at any levels. We try to follow SQL-like syntax whenever possible, be strongly typed ground top and fail in compile time, not in runtime. We implemented best in class `joins` and second to none `migrations generation`. Library has almost zero dependencies and being battle tested on production projects by multiple teams 🚀
2
+ DrizzleORM is a TypeScript ORM library with a [drizzle-kit](https://www.npmjs.com/package/drizzle-kit) CLI companion for automatic SQL migrations generation. It's meant to be a library, not a framework, stay as an opt-in solution all the time at any levels. We try to follow SQL-like syntax whenever possible, be strongly typed ground top and fail in compile time, not in runtime. We implemented best in class `joins` and second to none `migrations generation`. Library has almost zero dependencies and being battle tested on production projects by multiple teams 🚀
3
3
 
4
4
  | database | support |
5
5
  |:-- | :---: |
@@ -193,14 +193,6 @@ and(exressions: Expr[])
193
193
  or(exressions: Expr[])
194
194
  ```
195
195
  Inserting
196
- ##### Insert `user` with required fields
197
- ```typescript
198
- await usersTable.insert({
199
- test: 1,
200
- createdAt: new Date(),
201
- }).execute();
202
- ```
203
- ##### Insert `user` with required fields and get all rows as array
204
196
  ```typescript
205
197
  const result = await usersTable.insert({
206
198
  name: "Andrew",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-orm",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -40,5 +40,5 @@
40
40
  "lint": "eslint ./src --ext .ts",
41
41
  "run": "ts-node src/docs/cases/simple_update.ts"
42
42
  },
43
- "readme": "## DrizzleORM\nDrizzleORM is a TypeScript ORM library with a [drizzle-kit](https://github.com/lambda-direct/drizzle-orm/tree/develop/kit) CLI companion for automatic SQL migrations generation. It's meant to be a library, not a framework, stay as an opt-in solution all the time at any levels. We try to follow SQL-like syntax whenever possible, be strongly typed ground top and fail in compile time, not in runtime. We implemented best in class `joins` and second to none `migrations generation`. Library has almost zero dependencies and being battle tested on production projects by multiple teams 🚀\n\n| database | support |\n|:-- | :---: |\n| PostgreSQL | ✅ |\n| MySQL | ⏳ |\n| DynamoDB | ⏳ |\n| SQLite | ⏳ |\n| MS SQL | ⏳ |\n| CockroachDB | ⏳ |\n\n### Installation\n```bash\nnpm install drizzle-orm drizzle-kit\n```\n\n### Quick start\n```typescript\nimport { drizzle, PgTable } from 'drizzle-orm'\n\nexport class UsersTable extends PgTable<UsersTable> {\n public id = this.serial('id').primaryKey();\n public fullName = this.text('full_name');\n public phone = this.varchar('phone', { size: 256 });\n\n public tableName(): string {\n return 'users';\n }\n}\nexport type User = InferType<UsersTable>\n\nconst db = await drizzle.connect(\"postgres://user:password@host:port/db\");\nconst usersTable = new UsersTable(db);\n\nconst users: User[] = await usersTable.select().execute();\n```\n\n### Connecting to database\n```typescript\n\nconst db = await drizzle.connect(\"postgres://user:password@host:port/db\");\nconst db = await drizzle.connect({\n host: \"127.0.0.1\",\n port: 5432,\n user: \"postgres\",\n password: \"postgres\",\n db: \"db_name\",\n});\n```\n\n### SQL schema declaration\nWith `drizzle-orm` you declare SQL schema in typescritp. You can have either one `schema.ts` file with all declarations or you can group them logically in multiple files. We prefer to use single file schema.\n```\n📦project\n ├ 📂src\n │ ├ 📂data\n │ │ └ 📜schema.ts\n │ └ ...\n ├ ...\n └ 📜package.json\n \n## or multiple schema files\n├ 📂data\n ├ 📜users.ts\n ├ 📜countries.ts\n ├ 📜cities.ts\n ├ 📜products.ts\n ├ 📜clients.ts\n ├ 📜enums.ts\n └ 📜etc.ts\n```\nThis is how you declare SQL schema in `schema.ts`. You can declare tables, indexes and constraints, foreign keys and enums. Please pay attention to `export` keyword, they are mandatory if you'll be using drizzle-kit SQL migrations generator.\n```typescript\n// declaring enum in database\nexport const popularityEnum = createEnum({ alias: 'popularity', values: ['unknown', 'known', 'popular'] });\n\nexport class CountriesTable extends PgTable<CountriesTable> {\n id = this.serial(\"id\").primaryKey();\n name = this.varchar(\"name\", { size: 256 })\n\t\n // declaring index\n nameIndex = this.uniqueIndex(this.name)\n\n public tableName(): string {\n return 'countries';\n }\n}\n\nexport class CitiesTable extends PgTable<CitiesTable> {\n id = this.serial(\"id\").primaryKey();\n name = this.varchar(\"name\", { size: 256 })\n countryId = this.int(\"country_id\").foreignKey(CountriesTable, (country) => country.id)\n\n // declaring enum column in table\n popularity = this.type(popularityEnum, \"popularity\")\n\n public tableName(): string {\n return 'cities';\n }\n}\n```\nThe list of all possible types. You can also create custom types - !!see here!!.\n```typescript\nexport const enum = createEnum({ alias: \"database-name\", values: [\"value1\", \"value2\", \"value3\"] });\ntype(enum, \"...\")\n\nsmallint(\"...\")\nint(\"...\")\nbigint(\"...\", maxBytes: \"max_bytes_53\")\nbigint(\"...\", maxBytes: \"max_bytes_64\")\n\nbool(\"...\")\ntext(\"...\");\nvarchar(\"...\");\nvarchar(\"...\", { size: 256 });\n\nserial(\"...\");\nbigserial(\"...\", maxBytes: \"max_bytes_53\");\nbigserial(\"...\", maxBytes: \"max_bytes_64\");\n\ndecimal(\"...\", { precision: 100, scale: 2 });\n\njsonb<...>(\"...\");\njsonb<string[]>(\"...\");\n\ntime(\"...\")\ntimestamp(\"...\") // with timezone\ntimestamptz(\"...\"); // without timezone\ntimestamp(\"...\").defaultValue(Defaults.CURRENT_TIMESTAMP)\n\nindex(column);\nindex([column1, column2, ...]);\nuniqueIndex(column);\nuniqueIndex([column1, column2, ...]);\n\n\ncolumn.primaryKey()\ncolumn.notNull()\ncolumn.defaultValue(...)\n\n// 'CASCADE' | 'RESTRICT' | 'SET NULL' | 'SET DEFAULT'\ncolumn.foreignKey(Table, (table) => table.column, { onDelete: \"CASCADE\", onUpdate: \"CASCADE\" });\n```\n\n### Create Read Update Delete\nQuerying, sorting and filtering. We also support partial select.\n```typescript\nconst db = await drizzle.connect(\"...\")\nconst table = new UsersTable(db);\n\nconst result: User[] = await table.select().execute();\nawait table.select().where(\n eq(table.id, 42)\n).execute();\n\n// you can combine filters with eq(...) or or(...)\nawait table.select().where(\n and([eq(table.id, 42), eq(table.name, \"Dan\")])\n).execute();\n\nawait table.select().where(\n or([eq(table.id, 42), eq(table.id, 1)])\n).execute();\n\n// partial select\nconst result = await table.select({\n mapped1: table.id,\n mapped2: table.name,\n}).execute();\nconst { mapped1, mapped2 } = result[0];\n\n// limit offset & order by\nawait table.select().limit(10).offset(10).execute()\nawait table.select().orderBy((table) => table.name, Order.ASC)\nawait table.select().orderBy((table) => table.name, Order.DESC)\n\n// list of all filter operators\neq(table.column, value)\nnotEq(table.column, value)\nless(table.column, value)\nlessEq(table.column, value)\ngreater(table.column, value)\ngreaterEq(table.column, value)\nisNull(table.column)\nisNotNull(table.column)\n\ninArray(table.column, [...values])\nlike(table.column, value)\nraw(\"raw sql filter\")\n\nand(exressions: Expr[])\nor(exressions: Expr[])\n```\nInserting\n##### Insert `user` with required fields\n```typescript\nawait usersTable.insert({\n test: 1,\n createdAt: new Date(),\n}).execute();\n```\n##### Insert `user` with required fields and get all rows as array\n```typescript\nconst result = await usersTable.insert({\n name: \"Andrew\",\n createdAt: new Date(),\n}).execute();\n\nconst result = await usersTable.insertMany([{\n name: \"Andrew\",\n createdAt: new Date(),\n}, {\n name: \"Dan\",\n createdAt: new Date(),\n}]).execute();\n\n//await usersTable.insert({\n// name: \"Dan\"\n//})\n//.onConflict(\n//\t(table) => table.name,\n//\t{ name: 'name value to be upserted' }\n//).execute();\n```\n\nUpdate and Delete\n```typescript\nawait usersTable.update()\n .where(eq(usersTable.name, 'Dan'))\n .set({ name: 'Mr. Dan' })\n .execute();\n\t\nawait usersTable.delete()\n .where(eq(usersTable.name, 'Dan'))\n .execute();\n```\n\n### Joins\nLast but not least. Probably the most powerful feature in the library🚀\nMany-to-one\n```typescript\nconst usersTable = new UsersTable(db);\nconst citiesTable = new CitiesTable(db);\n\nconst result = await citiesTable.select()\n .leftJoin(usersTable, (cities, users) => eq(cities.userId, users.id))\n .where((cities, users) => eq(cities.id, 1))\n .execute();\n\nconst citiesWithUsers: { city: City, user: User }[] = result.map((city, user) => ({ city, user }));\n```\nMany-to-many\n```typescript\nexport class UsersTable extends PgTable<UsersTable> {\n id = this.serial(\"id\").primaryKey();\n\tname = this.varchar(\"name\");\n}\n\nexport class ChatGroupsTable extends PgTable<ChatGroupsTable> {\n id = this.serial(\"id\").primaryKey();\n}\n\nexport class ManyToManyTable extends PgTable<ManyToManyTable> {\n userId = this.int('user_id').foreignKey(UsersTable, (table) => table.id, { onDelete: 'CASCADE' });\n groupId = this.int('group_id').foreignKey(ChatGroupsTable, (table) => table.id, { onDelete: 'CASCADE' });\n}\n\n...\nconst usersTable = new UsersTable(db);\nconst chatGroupsTable = new ChatGroupsTable(db);\nconst manyToManyTable = new ManyToManyTable(db);\n\n// querying user group with id 1 and all the participants(users)\nconst usersWithUserGroups = await manyToManyTable.select()\n .leftJoin(usersTable, (manyToMany, users) => eq(manyToManyTable.userId, users.id))\n .leftJoin(chatGroupsTable, (manyToMany, _users, chatGroups) => eq(manyToManyTable.groupId, chatGroups.id))\n .where((manyToMany, _users, userGroups) => eq(userGroups.id, 1))\n .execute();\n```\n\n### Join using partial field select\n##### Join Cities with Users getting only needed fields form request\n```typescript\n await citiesTable.select({\n id: citiesTable.id,\n userId: citiesTable.userId,\n })\n .leftJoin(usersTable, (cities, users) => eq(cities.userId, users.id))\n .where((cities, users) => eq(cities.id, 1))\n .execute();\n\nconst citiesWithUserObject = userWithCities.map((city, user) => ({ ...city, user }));\n```\n### Another join examples with different callback ON statements\n```typescript\nawait citiesTable.select()\n .leftJoin(usersTable, (cities, _users) => eq(cities.id, 13))\n .where((cities, _users) => eq(cities.location, 'q'))\n .execute();\n// Join statement generated from query\n// LEFT JOIN users AS users_1\n// ON cities.\"id\"=$1\n// WHERE cities.\"page\"=$2\n//\n// Values: [13, 'q']\n\nawait citiesTable.select()\n .leftJoin(usersTable, (cities, _users) => and([\n eq(cities.id, 13), notEq(cities.id, 14),\n ]))\n .execute();\n// Join statement generated from query\n// LEFT JOIN users AS users_1\n// ON (cities.\"id\"=$1 and cities.\"id\"!=$2)\n//\n// Values: [13, 14]\n\nawait citiesTable.select()\n .leftJoin(usersTable, (_cities, _users) => raw('<custom expression after ON statement>'))\n .where((cities, _users) => eq(cities.location, 'location'))\n .execute();\n// Join statement generated from query\n// LEFT JOIN users AS users_1\n// ON <custom expression after ON statement>\n// WHERE cities.\"page\"=$1\n// \n// Values: ['location']\n```\n\n\n## Migrations\n#### To run migrations generated by drizzle-kit you could use `Migrator` class\n##### Provide drizzle-kit config path\n```typescript\nawait drizzle.migrator(db).migrate('src/drizzle.config.yaml');\n```\n##### Another possibility is to provide object with path to folder with migrations\n```typescript\nawait drizzle.migrator(db).migrate({ migrationFolder: 'drizzle' });\n```\n\n\n## Raw query usage\n#### If you have some complex queries to execute and drizzle-orm can't handle them yet, then you could use `rawQuery` execution\n\n\n##### Execute custom raw query\n```typescript\nconst res: QueryResult<any> = await db.session().execute('SELECT * FROM users WHERE user.id = $1', [1]);\n```"
43
+ "readme": "## DrizzleORM\nDrizzleORM is a TypeScript ORM library with a [drizzle-kit](https://www.npmjs.com/package/drizzle-kit) CLI companion for automatic SQL migrations generation. It's meant to be a library, not a framework, stay as an opt-in solution all the time at any levels. We try to follow SQL-like syntax whenever possible, be strongly typed ground top and fail in compile time, not in runtime. We implemented best in class `joins` and second to none `migrations generation`. Library has almost zero dependencies and being battle tested on production projects by multiple teams 🚀\n\n| database | support |\n|:-- | :---: |\n| PostgreSQL | ✅ |\n| MySQL | ⏳ |\n| DynamoDB | ⏳ |\n| SQLite | ⏳ |\n| MS SQL | ⏳ |\n| CockroachDB | ⏳ |\n\n### Installation\n```bash\nnpm install drizzle-orm drizzle-kit\n```\n\n### Quick start\n```typescript\nimport { drizzle, PgTable } from 'drizzle-orm'\n\nexport class UsersTable extends PgTable<UsersTable> {\n public id = this.serial('id').primaryKey();\n public fullName = this.text('full_name');\n public phone = this.varchar('phone', { size: 256 });\n\n public tableName(): string {\n return 'users';\n }\n}\nexport type User = InferType<UsersTable>\n\nconst db = await drizzle.connect(\"postgres://user:password@host:port/db\");\nconst usersTable = new UsersTable(db);\n\nconst users: User[] = await usersTable.select().execute();\n```\n\n### Connecting to database\n```typescript\n\nconst db = await drizzle.connect(\"postgres://user:password@host:port/db\");\nconst db = await drizzle.connect({\n host: \"127.0.0.1\",\n port: 5432,\n user: \"postgres\",\n password: \"postgres\",\n db: \"db_name\",\n});\n```\n\n### SQL schema declaration\nWith `drizzle-orm` you declare SQL schema in typescritp. You can have either one `schema.ts` file with all declarations or you can group them logically in multiple files. We prefer to use single file schema.\n```\n📦project\n ├ 📂src\n │ ├ 📂data\n │ │ └ 📜schema.ts\n │ └ ...\n ├ ...\n └ 📜package.json\n \n## or multiple schema files\n├ 📂data\n ├ 📜users.ts\n ├ 📜countries.ts\n ├ 📜cities.ts\n ├ 📜products.ts\n ├ 📜clients.ts\n ├ 📜enums.ts\n └ 📜etc.ts\n```\nThis is how you declare SQL schema in `schema.ts`. You can declare tables, indexes and constraints, foreign keys and enums. Please pay attention to `export` keyword, they are mandatory if you'll be using drizzle-kit SQL migrations generator.\n```typescript\n// declaring enum in database\nexport const popularityEnum = createEnum({ alias: 'popularity', values: ['unknown', 'known', 'popular'] });\n\nexport class CountriesTable extends PgTable<CountriesTable> {\n id = this.serial(\"id\").primaryKey();\n name = this.varchar(\"name\", { size: 256 })\n\t\n // declaring index\n nameIndex = this.uniqueIndex(this.name)\n\n public tableName(): string {\n return 'countries';\n }\n}\n\nexport class CitiesTable extends PgTable<CitiesTable> {\n id = this.serial(\"id\").primaryKey();\n name = this.varchar(\"name\", { size: 256 })\n countryId = this.int(\"country_id\").foreignKey(CountriesTable, (country) => country.id)\n\n // declaring enum column in table\n popularity = this.type(popularityEnum, \"popularity\")\n\n public tableName(): string {\n return 'cities';\n }\n}\n```\nThe list of all possible types. You can also create custom types - !!see here!!.\n```typescript\nexport const enum = createEnum({ alias: \"database-name\", values: [\"value1\", \"value2\", \"value3\"] });\ntype(enum, \"...\")\n\nsmallint(\"...\")\nint(\"...\")\nbigint(\"...\", maxBytes: \"max_bytes_53\")\nbigint(\"...\", maxBytes: \"max_bytes_64\")\n\nbool(\"...\")\ntext(\"...\");\nvarchar(\"...\");\nvarchar(\"...\", { size: 256 });\n\nserial(\"...\");\nbigserial(\"...\", maxBytes: \"max_bytes_53\");\nbigserial(\"...\", maxBytes: \"max_bytes_64\");\n\ndecimal(\"...\", { precision: 100, scale: 2 });\n\njsonb<...>(\"...\");\njsonb<string[]>(\"...\");\n\ntime(\"...\")\ntimestamp(\"...\") // with timezone\ntimestamptz(\"...\"); // without timezone\ntimestamp(\"...\").defaultValue(Defaults.CURRENT_TIMESTAMP)\n\nindex(column);\nindex([column1, column2, ...]);\nuniqueIndex(column);\nuniqueIndex([column1, column2, ...]);\n\n\ncolumn.primaryKey()\ncolumn.notNull()\ncolumn.defaultValue(...)\n\n// 'CASCADE' | 'RESTRICT' | 'SET NULL' | 'SET DEFAULT'\ncolumn.foreignKey(Table, (table) => table.column, { onDelete: \"CASCADE\", onUpdate: \"CASCADE\" });\n```\n\n### Create Read Update Delete\nQuerying, sorting and filtering. We also support partial select.\n```typescript\nconst db = await drizzle.connect(\"...\")\nconst table = new UsersTable(db);\n\nconst result: User[] = await table.select().execute();\nawait table.select().where(\n eq(table.id, 42)\n).execute();\n\n// you can combine filters with eq(...) or or(...)\nawait table.select().where(\n and([eq(table.id, 42), eq(table.name, \"Dan\")])\n).execute();\n\nawait table.select().where(\n or([eq(table.id, 42), eq(table.id, 1)])\n).execute();\n\n// partial select\nconst result = await table.select({\n mapped1: table.id,\n mapped2: table.name,\n}).execute();\nconst { mapped1, mapped2 } = result[0];\n\n// limit offset & order by\nawait table.select().limit(10).offset(10).execute()\nawait table.select().orderBy((table) => table.name, Order.ASC)\nawait table.select().orderBy((table) => table.name, Order.DESC)\n\n// list of all filter operators\neq(table.column, value)\nnotEq(table.column, value)\nless(table.column, value)\nlessEq(table.column, value)\ngreater(table.column, value)\ngreaterEq(table.column, value)\nisNull(table.column)\nisNotNull(table.column)\n\ninArray(table.column, [...values])\nlike(table.column, value)\nraw(\"raw sql filter\")\n\nand(exressions: Expr[])\nor(exressions: Expr[])\n```\nInserting\n```typescript\nconst result = await usersTable.insert({\n name: \"Andrew\",\n createdAt: new Date(),\n}).execute();\n\nconst result = await usersTable.insertMany([{\n name: \"Andrew\",\n createdAt: new Date(),\n}, {\n name: \"Dan\",\n createdAt: new Date(),\n}]).execute();\n\n//await usersTable.insert({\n// name: \"Dan\"\n//})\n//.onConflict(\n//\t(table) => table.name,\n//\t{ name: 'name value to be upserted' }\n//).execute();\n```\n\nUpdate and Delete\n```typescript\nawait usersTable.update()\n .where(eq(usersTable.name, 'Dan'))\n .set({ name: 'Mr. Dan' })\n .execute();\n\t\nawait usersTable.delete()\n .where(eq(usersTable.name, 'Dan'))\n .execute();\n```\n\n### Joins\nLast but not least. Probably the most powerful feature in the library🚀\nMany-to-one\n```typescript\nconst usersTable = new UsersTable(db);\nconst citiesTable = new CitiesTable(db);\n\nconst result = await citiesTable.select()\n .leftJoin(usersTable, (cities, users) => eq(cities.userId, users.id))\n .where((cities, users) => eq(cities.id, 1))\n .execute();\n\nconst citiesWithUsers: { city: City, user: User }[] = result.map((city, user) => ({ city, user }));\n```\nMany-to-many\n```typescript\nexport class UsersTable extends PgTable<UsersTable> {\n id = this.serial(\"id\").primaryKey();\n\tname = this.varchar(\"name\");\n}\n\nexport class ChatGroupsTable extends PgTable<ChatGroupsTable> {\n id = this.serial(\"id\").primaryKey();\n}\n\nexport class ManyToManyTable extends PgTable<ManyToManyTable> {\n userId = this.int('user_id').foreignKey(UsersTable, (table) => table.id, { onDelete: 'CASCADE' });\n groupId = this.int('group_id').foreignKey(ChatGroupsTable, (table) => table.id, { onDelete: 'CASCADE' });\n}\n\n...\nconst usersTable = new UsersTable(db);\nconst chatGroupsTable = new ChatGroupsTable(db);\nconst manyToManyTable = new ManyToManyTable(db);\n\n// querying user group with id 1 and all the participants(users)\nconst usersWithUserGroups = await manyToManyTable.select()\n .leftJoin(usersTable, (manyToMany, users) => eq(manyToManyTable.userId, users.id))\n .leftJoin(chatGroupsTable, (manyToMany, _users, chatGroups) => eq(manyToManyTable.groupId, chatGroups.id))\n .where((manyToMany, _users, userGroups) => eq(userGroups.id, 1))\n .execute();\n```\n\n### Join using partial field select\n##### Join Cities with Users getting only needed fields form request\n```typescript\n await citiesTable.select({\n id: citiesTable.id,\n userId: citiesTable.userId,\n })\n .leftJoin(usersTable, (cities, users) => eq(cities.userId, users.id))\n .where((cities, users) => eq(cities.id, 1))\n .execute();\n\nconst citiesWithUserObject = userWithCities.map((city, user) => ({ ...city, user }));\n```\n### Another join examples with different callback ON statements\n```typescript\nawait citiesTable.select()\n .leftJoin(usersTable, (cities, _users) => eq(cities.id, 13))\n .where((cities, _users) => eq(cities.location, 'q'))\n .execute();\n// Join statement generated from query\n// LEFT JOIN users AS users_1\n// ON cities.\"id\"=$1\n// WHERE cities.\"page\"=$2\n//\n// Values: [13, 'q']\n\nawait citiesTable.select()\n .leftJoin(usersTable, (cities, _users) => and([\n eq(cities.id, 13), notEq(cities.id, 14),\n ]))\n .execute();\n// Join statement generated from query\n// LEFT JOIN users AS users_1\n// ON (cities.\"id\"=$1 and cities.\"id\"!=$2)\n//\n// Values: [13, 14]\n\nawait citiesTable.select()\n .leftJoin(usersTable, (_cities, _users) => raw('<custom expression after ON statement>'))\n .where((cities, _users) => eq(cities.location, 'location'))\n .execute();\n// Join statement generated from query\n// LEFT JOIN users AS users_1\n// ON <custom expression after ON statement>\n// WHERE cities.\"page\"=$1\n// \n// Values: ['location']\n```\n\n\n## Migrations\n#### To run migrations generated by drizzle-kit you could use `Migrator` class\n##### Provide drizzle-kit config path\n```typescript\nawait drizzle.migrator(db).migrate('src/drizzle.config.yaml');\n```\n##### Another possibility is to provide object with path to folder with migrations\n```typescript\nawait drizzle.migrator(db).migrate({ migrationFolder: 'drizzle' });\n```\n\n\n## Raw query usage\n#### If you have some complex queries to execute and drizzle-orm can't handle them yet, then you could use `rawQuery` execution\n\n\n##### Execute custom raw query\n```typescript\nconst res: QueryResult<any> = await db.session().execute('SELECT * FROM users WHERE user.id = $1', [1]);\n```"
44
44
  }