drizzle-orm
Advanced tools
Comparing version 0.10.39 to 0.10.40
@@ -75,2 +75,3 @@ "use strict"; | ||
this._logger.info(`Selecting from ${this._table.tableName()} using query:\n ${query}`); | ||
this._logger.info(`Values for query:\n ${values}`); | ||
} | ||
@@ -77,0 +78,0 @@ const result = await this._session.execute(query, values); |
@@ -73,3 +73,3 @@ "use strict"; | ||
this._logger.info(`Updating ${this._table.tableName()} using query:\n ${query}`); | ||
console.log(values); | ||
this._logger.info(`Values used for update:\n ${values}`); | ||
} | ||
@@ -76,0 +76,0 @@ const result = await this._session.execute(query, values); |
@@ -57,4 +57,2 @@ "use strict"; | ||
} | ||
console.log(query); | ||
console.log(values); | ||
const result = await this._session.execute(query, values); | ||
@@ -61,0 +59,0 @@ return this.mapResponse(result); |
@@ -8,2 +8,4 @@ import { ClientConfig } from 'pg'; | ||
export * from './tables'; | ||
export * from './logger/consoleLogger'; | ||
export * from './logger/abstractLogger'; | ||
export declare const drizzle: { | ||
@@ -10,0 +12,0 @@ connect(config: ClientConfig): Promise<DB>; |
@@ -23,2 +23,4 @@ "use strict"; | ||
__exportStar(require("./tables"), exports); | ||
__exportStar(require("./logger/consoleLogger"), exports); | ||
__exportStar(require("./logger/abstractLogger"), exports); | ||
exports.drizzle = { | ||
@@ -25,0 +27,0 @@ async connect(config) { |
{ | ||
"name": "drizzle-orm", | ||
"version": "0.10.39", | ||
"version": "0.10.40", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
128
test.js
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const dbConnector_1 = __importDefault(require("./db/dbConnector")); | ||
const usersTable_1 = __importDefault(require("./docs/tables/usersTable")); | ||
const consoleLogger_1 = __importDefault(require("./logger/consoleLogger")); | ||
const serializer_1 = __importDefault(require("./serializer/serializer")); | ||
(async () => { | ||
try { | ||
const db = await new dbConnector_1.default() | ||
.connectionString('postgresql://postgres@127.0.0.1/migrator') | ||
.connect(); | ||
db.useLogger(new consoleLogger_1.default()); | ||
const usersTable = new usersTable_1.default(db); | ||
// const citiesTable = new CitiesTable(db); | ||
// await usersTable.insert({ | ||
// }); | ||
// const res = await citiesTable.update() | ||
// // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
// .where(eq(citiesTable.location, 'YR')) | ||
// .set({ | ||
// metadata: [{ | ||
// fallback_image: true, | ||
// team_image: 'https://files.slack.com/files-pri/T016CCC3FE3-F03461UR9M5/clinic_team_photo_1.jpg?pub_secret=560c098bfb', | ||
// image_alt_text: 'Generic Physiotherapy Clinic image 1', | ||
// logo: '', | ||
// logo_alt_text: '' | ||
// }], | ||
// }) | ||
// // .leftJoin(CitiesTable, UsersTable, (table) => table.userId, (table) => table.id) | ||
// // .leftJoin(UsersTable, UsersTable, (table) => table.id, (table) => table.id) | ||
// .execute(); | ||
// console.log(res); | ||
const ser = new serializer_1.default(); | ||
const res = ser.generate([usersTable], []); | ||
console.log(JSON.stringify(res, null, 2)); | ||
// const f = { | ||
// id: count(usersTable.id), | ||
// }; | ||
// type d = ExtractModel<typeof f>; | ||
// const res = await usersTable.select() | ||
// .leftJoin(UsersTable, (table) => table.id, (table) => table.id) | ||
// .leftJoin(UsersTable, CitiesTable, (table) => table.id, (table) => table.id) | ||
// .execute(); | ||
// const res = await usersTable.select() | ||
// // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
// .leftJoin(UsersTable, (table) => table.foundationDate, (table) => table.id) | ||
// .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id) | ||
// .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id) | ||
// // .groupBy({ | ||
// // usersTable: usersTable.id, | ||
// // firstJoin: [usersTable.id], | ||
// // secondJoin: usersTable.id, | ||
// // thirdJoin: usersTable.id, | ||
// // }) | ||
// .execute(); | ||
// console.log(res); | ||
} | ||
catch (e) { | ||
console.log(e); | ||
} | ||
})(); | ||
// import DbConnector from './db/dbConnector'; | ||
// import UsersTable from './docs/tables/usersTable'; | ||
// import ConsoleLogger from './logger/consoleLogger'; | ||
// import MigrationSerializer from './serializer/serializer'; | ||
// import AbstractTable from './tables/abstractTable'; | ||
// import { | ||
// ExtractColumnType, ExtractColumnType1, | ||
// } from './tables/inferTypes'; | ||
// (async () => { | ||
// try { | ||
// const db = await new DbConnector() | ||
// .connectionString('postgresql://postgres@127.0.0.1/migrator') | ||
// .connect(); | ||
// db.useLogger(new ConsoleLogger()); | ||
// const usersTable = new UsersTable(db); | ||
// type g = ReturnType<typeof usersTable.updatedAt.getColumnType>['codeType']; | ||
// type f = ExtractColumnType<typeof usersTable.updatedAt>; | ||
// type f1 = ExtractColumnType1<f>; | ||
// // const citiesTable = new CitiesTable(db); | ||
// // await usersTable.insert({ | ||
// // }); | ||
// // const res = await citiesTable.update() | ||
// // // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
// // .where(eq(citiesTable.location, 'YR')) | ||
// // .set({ | ||
// // metadata: [{ | ||
// // fallback_image: true, | ||
// // team_image: 'https://files.slack.com/files-pri/T016CCC3FE3-F03461UR9M5/clinic_team_photo_1.jpg?pub_secret=560c098bfb', | ||
// // image_alt_text: 'Generic Physiotherapy Clinic image 1', | ||
// // logo: '', | ||
// // logo_alt_text: '' | ||
// // }], | ||
// // }) | ||
// // // .leftJoin(CitiesTable, UsersTable, (table) => table.userId, (table) => table.id) | ||
// // // .leftJoin(UsersTable, UsersTable, (table) => table.id, (table) => table.id) | ||
// // .execute(); | ||
// // console.log(res); | ||
// const ser = new MigrationSerializer(); | ||
// const res = ser.generate([usersTable as AbstractTable<UsersTable>], []); | ||
// console.log(JSON.stringify(res, null, 2)); | ||
// // const f = { | ||
// // id: count(usersTable.id), | ||
// // }; | ||
// // type d = ExtractModel<typeof f>; | ||
// // const res = await usersTable.select() | ||
// // .leftJoin(UsersTable, (table) => table.id, (table) => table.id) | ||
// // .leftJoin(UsersTable, CitiesTable, (table) => table.id, (table) => table.id) | ||
// // .execute(); | ||
// // const res = await usersTable.select() | ||
// // // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
// // .leftJoin(UsersTable, (table) => table.foundationDate, (table) => table.id) | ||
// // .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id) | ||
// // .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id) | ||
// // // .groupBy({ | ||
// // // usersTable: usersTable.id, | ||
// // // firstJoin: [usersTable.id], | ||
// // // secondJoin: usersTable.id, | ||
// // // thirdJoin: usersTable.id, | ||
// // // }) | ||
// // .execute(); | ||
// // console.log(res); | ||
// } catch (e) { | ||
// console.log(e); | ||
// } | ||
// })(); |
326850
6129