Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@balena/abstract-sql-compiler

Package Overview
Dependencies
Maintainers
4
Versions
472
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@balena/abstract-sql-compiler - npm Package Compare versions

Comparing version 7.0.7 to 7.1.0-add-check-constraint-support-2ac556f3bdc6143a9a4be37c47079659ee20a866

test/abstract-sql/schema-checks.ts

4

CHANGELOG.md

@@ -7,2 +7,6 @@ # Change Log

## 7.1.0 - 2020-12-09
* Add check constraint support at the table level [Pagan Gazzard]
## 7.0.7 - 2020-12-09

@@ -9,0 +13,0 @@

@@ -138,2 +138,7 @@ export declare const enum Engines {

}
export interface Check {
description?: string;
name?: string;
abstractSql: BooleanTypeNodes;
}
export interface AbstractSqlTable {

@@ -150,2 +155,3 @@ name: string;

triggers?: Trigger[];
checks?: Check[];
}

@@ -152,0 +158,0 @@ export interface ReferencedFields {

@@ -271,2 +271,13 @@ "use strict";

}
if (table.checks) {
for (const check of table.checks) {
const comment = check.description
? `-- ${check.description.split(/\r?\n/).join('\n-- ')}\n`
: '';
const constraintName = check.name ? `CONSTRAINT "${check.name}" ` : '';
const sql = compileRule(check.abstractSql, engine, true);
createSqlElements.push(`\
${comment}${constraintName}CHECK (${sql})`);
}
}
const createTriggers = [];

@@ -273,0 +284,0 @@ const dropTriggers = [];

2

package.json
{
"name": "@balena/abstract-sql-compiler",
"version": "7.0.7",
"version": "7.1.0-add-check-constraint-support-2ac556f3bdc6143a9a4be37c47079659ee20a866",
"description": "A translator for abstract sql into sql.",

@@ -5,0 +5,0 @@ "main": "out/AbstractSQLCompiler.js",

@@ -226,2 +226,7 @@ export const enum Engines {

}
export interface Check {
description?: string;
name?: string;
abstractSql: BooleanTypeNodes;
}
export interface AbstractSqlTable {

@@ -238,2 +243,3 @@ name: string;

triggers?: Trigger[];
checks?: Check[];
}

@@ -652,2 +658,18 @@ export interface ReferencedFields {

if (table.checks) {
for (const check of table.checks) {
const comment = check.description
? `-- ${check.description.split(/\r?\n/).join('\n-- ')}\n`
: '';
const constraintName = check.name ? `CONSTRAINT "${check.name}" ` : '';
const sql = compileRule(
check.abstractSql as AbstractSqlQuery,
engine,
true,
);
createSqlElements.push(`\
${comment}${constraintName}CHECK (${sql})`);
}
}
const createTriggers: string[] = [];

@@ -654,0 +676,0 @@ const dropTriggers: string[] = [];

Sorry, the diff of this file is not supported yet

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