New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

drizzle-orm

Package Overview
Dependencies
Maintainers
3
Versions
1003
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drizzle-orm - npm Package Compare versions

Comparing version 0.14.0 to 0.14.1

migrator.d.ts

13

connection.d.ts

@@ -1,6 +0,1 @@

export declare type MigrationMeta = {
sql: string;
folderMillis: number;
hash: string;
};
export interface Logger {

@@ -25,9 +20,1 @@ logQuery(query: string, params: unknown[]): void;

}
export interface KitConfig {
out: string;
schema: string;
}
export interface MigrationConfig {
migrationsFolder: string;
}
export declare function readMigrationFiles(config: string | MigrationConfig): MigrationMeta[];

47

connection.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readMigrationFiles = exports.NoopLogger = exports.DefaultLogger = exports.ConsoleLogWriter = void 0;
exports.NoopLogger = exports.DefaultLogger = exports.ConsoleLogWriter = void 0;
class ConsoleLogWriter {

@@ -32,47 +32,2 @@ write(message) {

exports.NoopLogger = NoopLogger;
function readMigrationFiles(config) {
const fs = require('fs');
const crypto = require('crypto');
const path = require('path');
let migrationFolderTo;
if (typeof config === 'string') {
const configAsString = fs.readFileSync(path.resolve('.', config), 'utf8');
const jsonConfig = JSON.parse(configAsString);
migrationFolderTo = jsonConfig.out;
}
else {
migrationFolderTo = config.migrationsFolder;
}
if (!migrationFolderTo) {
throw Error('no migration folder defined');
}
const files = fs.readdirSync(migrationFolderTo);
const migrationQueries = [];
for (const migrationFolder of files) {
if (migrationFolder === '.DS_Store') {
continue;
}
const migrationFiles = fs.readdirSync(`${migrationFolderTo}/${migrationFolder}`);
const migrationFile = migrationFiles.filter((file) => file === 'migration.sql')[0];
const query = fs
.readFileSync(`${migrationFolderTo}/${migrationFolder}/${migrationFile}`)
.toString();
const year = Number(migrationFolder.slice(0, 4));
// second param for Date() is month index, that started from 0, so we need
// to decrement a value for month
const month = Number(migrationFolder.slice(4, 6)) - 1;
const day = Number(migrationFolder.slice(6, 8));
const hour = Number(migrationFolder.slice(8, 10));
const min = Number(migrationFolder.slice(10, 12));
const sec = Number(migrationFolder.slice(12, 14));
const folderAsMillis = Date.UTC(year, month, day, hour, min, sec);
migrationQueries.push({
sql: query,
folderMillis: folderAsMillis,
hash: crypto.createHash('sha256').update(query).digest('hex'),
});
}
return migrationQueries;
}
exports.readMigrationFiles = readMigrationFiles;
//# sourceMappingURL=connection.js.map
{
"name": "drizzle-orm",
"version": "0.14.0",
"version": "0.14.1",
"description": "Drizzle ORM package for SQL databases",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,6 +0,15 @@

## Drizzle ORM
DrizzleORM is a TypeScript ORM library with a [drizzle-kit](#migrations) 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.
<div align="center">
<h1>Drizzle ORM</h1>
<a href="https://www.npmjs.com/package/drizzle-orm"><img alt="" src="https://img.shields.io/npm/v/drizzle-orm"></a>
<img alt="" src="https://img.shields.io/npm/dw/drizzle-orm">
<img alt="npm bundle size" src="https://img.shields.io/bundlephobia/min/drizzle-orm">
<img alt="Discord" src="https://img.shields.io/discord/1043890932593987624">
<a href="https://github.com/drizzle-team/drizzle-orm/blob/main/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/drizzle-team/drizzle-orm"></a>
<hr />
</div>
DrizzleORM is a TypeScript ORM library with a [drizzle-kit](#migrations) 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`.
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 🚀

@@ -11,4 +20,4 @@

| PostgreSQL | ✅ |[Docs](https://github.com/drizzle-team/drizzle-orm/tree/main/drizzle-orm-pg)|
| MySQL | ⏳ | |
| SQLite | ✅ |[Docs](https://github.com/drizzle-team/drizzle-orm/tree/main/drizzle-orm-sqlite)|
| MySQL | ⏳ | |
| SQLite | ✅ |[Docs](https://github.com/drizzle-team/drizzle-orm/tree/main/drizzle-orm-sqlite)|
| DynamoDB | ⏳ | |

@@ -19,2 +28,3 @@ | MS SQL | ⏳ | |

### Installation
```bash

@@ -21,0 +31,0 @@ // postgresql

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc