
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
grunt-generate-database
Advanced tools
CLI for generate typeorm wrappers for postgreSQL and MsSQL
Π Π΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ, ΠΊΠΎΡΠΎΡΡΠΉ Ρ ΡΠ°Π½ΠΈΡ Π² ΡΠ΅Π±Π΅ ΠΏΠ»Π°Π³ΠΈΠ½ Π΄Π»Ρ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ DBWrapper, ΡΡΠΈΠ³Π³Π΅ΡΠ° ΠΈ ΡΡΠ½ΠΊΡΠΈΠΈ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ ΡΡΠΈΠ³Π³Π΅ΡΠΎΠΌ Ρ ΠΏΠΎΠΌΠΎΡΡΡ typeorm ΠΈ postgres
npm install grunt-generate-database
[
{
"db": "postgres",
"name" : "base1",
"dbtype" : "dbtype1",
"dbhost" : "dbhost1",
"dbport" : "dbport1",
"dbusername" : "dbusername1",
"dbpassword" : "dbpassword1",
"dbdatabase" : "dbdatabase1",
"pathToDBWrappers": "./dbscript",
"schemas" :
[
{
"namespace": "testnamespace",
"recreate":true,
"tables":
[
{
"name": "Class",
"pathToModel": "./models/class"
}
]
}
]
}
]
import {Column, Entity, PrimaryGeneratedColumn} from "typeorm";
import { GenerateHistory } from "grunt-generate-history-model";
@Entity()
@GenerateHistory({"historyPath": "./test/src/model/hero"})
export class Hero {
@PrimaryGeneratedColumn()
public id?: number;
@Column()
public name: string;
public data: string;
@Column()
public detailId?: number;
@Column({"type": "integer", "array": true, "nullable": true})
public simpleArray: number[];
}
"scripts": {
"generation": "generateDatabase"
}
Π³Π΄Π΅ "generateDatabase" - ΡΡΡΠΎΠΊΠ° Π΄Π»Ρ Π·Π°ΠΏΡΡΠΊΠ° ΠΏΠ»Π°Π³ΠΈΠ½Π°
npm run generation
ΠΏΠΎΡΠ»Π΅ Π·Π°Π²Π΅ΡΡΠ΅Π½ΠΈΡ ΡΠ°Π±ΠΎΡΡ ΠΏΠ»Π°Π³ΠΈΠ½Π° ΠΏΠΎ ΠΏΡΡΠΈ, ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠΌΡ Π² declaration.json Π² ΡΠ²ΠΎΠΉΡΡΠ²Π΅ "pathToDBWrappers", ΠΏΠΎΡΠ²ΡΡΡΡ ΡΠ°ΠΉΠ»Ρ Ρ ΡΠ°ΡΡΠΈΡΠ΅Π½ΠΈΠ΅ΠΌ ".ts" :
import { Class } from '../../../models/class';
import { createbase1TriggerFuncstestnamespace } from './function';
import { createbase1Triggerstestnamespace } from './trigger';
import * as dotenv from 'dotenv';
import {createConnection, Connection, getManager, EntityManager} from 'typeorm';
export class testnamespaceDBWrapper {
private static connection: Connection;
public static async initialize(dropSchema?: boolean, sync?: boolean): Promise<void> {
await this.close();
if (! dropSchema) {
dropSchema = false;
}
if (! sync) {
sync = false;
}
this.connection = await this.createTables(dropSchema, sync);
if (dropSchema) {
await createbase1TriggerFuncstestnamespace();
await createbase1Triggerstestnamespace();
}
}
private static async createTables(dropSchema?: boolean, sync?: boolean) {
return await createConnection({
name: 'testnamespace',
type: 'postgres',
replication: {
master: {
host: process.env.dbhost1,
port: parseInt(process.env.dbport1, 10),
username: process.env.dbusername1,
password: process.env.dbpassword1,
database: process.env.dbdatabase1
},
slaves: []
},
entities: [
Class
],
schema: 'testnamespace',
synchronize: sync,
dropSchema: dropSchema
});
}
public static getEntityManager (): EntityManager {
return getManager('testnamespace');
}
public static async close(): Promise<void> {
if (this.connection) {
await this.connection.close();
this.connection = null;
}
}
}
import {createConnection, ConnectionOptions} from 'typeorm';
export async function createbase1TriggerFuncstestnamespace() {
const pgp = require('pg-promise')({});
await pgp.end();
const connectionString = 'postgres://' + process.env.dbusername1 + ':' +
process.env.dbpassword1 + '@' + process.env.dbhost1 + ':' + process.env.dbport1 + '/' + process.env.dbdatabase1;
const db = pgp(connectionString);
let queryproc = '';
pgp.end();
}
import {createConnection, ConnectionOptions} from 'typeorm';
export async function createbase1Triggerstestnamespace() {
const pgp = require('pg-promise')({});
await pgp.end();
const connectionString = 'postgres://' + process.env.dbusername1 + ':' +
process.env.dbpassword1 + '@' + process.env.dbhost1 + ':' + process.env.dbport1 + '/' + process.env.dbdatabase1;
const db = pgp(connectionString);
let queryproc;
let lowerStringName;
let lowewrStringSchema;
pgp.end();
}
FAQs
CLI for generate typeorm wrappers for postgreSQL and MsSQL
The npm package grunt-generate-database receives a total of 21 weekly downloads. As such, grunt-generate-database popularity was classified as not popular.
We found that grunt-generate-database demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.