@linked-db/linked-ql
Advanced tools
Comparing version 0.8.12 to 0.8.13
@@ -14,3 +14,3 @@ { | ||
"icon": "https://webqit.io/icon.svg", | ||
"version": "0.8.12", | ||
"version": "0.8.13", | ||
"license": "MIT", | ||
@@ -17,0 +17,0 @@ "repository": { |
@@ -53,3 +53,3 @@ # Linked QL | ||
1. For SQL databases, install the regular SQL client you use for your DB. (Typically, [`pg`](https://github.com/brianc/node-postgres) for PostgreSQL, [`mariadb`](https://github.com/mariadb-corporation/mariadb-connector-nodejs) for mariadb, [`mysql`](https://www.npmjs.com/package/mysql)/[`mysql2`](https://www.npmjs.com/package/mysql2) for MySQL databases.) | ||
+ For SQL databases, install the regular SQL client you use for your DB. (Typically, [`pg`](https://github.com/brianc/node-postgres) for PostgreSQL, [`mariadb`](https://github.com/mariadb-corporation/mariadb-connector-nodejs) for mariadb, [`mysql`](https://www.npmjs.com/package/mysql)/[`mysql2`](https://www.npmjs.com/package/mysql2) for MySQL databases.) | ||
@@ -106,3 +106,3 @@ Using PostgreSQL as an example, install the `pg` client: | ||
2. For the client-side *IndexedDB*, import and instantiate the *IDB* client. _(Coming soon)_ | ||
+ For the client-side *IndexedDB*, import and instantiate the *IDB* client. _(Coming soon)_ | ||
@@ -117,3 +117,3 @@ ```js | ||
3. To work with Linked QL's in-memory object database, import and instantiate the *ODB* client. _(Coming soon)_ | ||
+ To work with Linked QL's in-memory object database, import and instantiate the *ODB* client. _(Coming soon)_ | ||
@@ -199,3 +199,3 @@ ```js | ||
✨ _Now, that translates to about 50% code, and whole namespacing exercise, having been eliminated! And yet, no questions asked about your schemas; no such thing as the usual upfront relationship mapping!_ | ||
✨ _Now, that translates to about 50% code, plus whole namespacing exercise, having been eliminated! And yet, no questions asked about your schemas; no such thing as the usual upfront relationship mapping!_ | ||
@@ -229,5 +229,5 @@ Taking things further, multi-level relationships also get a corresponding pattern: multi-level paths: | ||
This means, game on with the regular JOINs for whatever calls for them; take the "magic path" option for whatever doesn't benefit otherwise! | ||
This means, game on with the regular JOINs for whatever calls for them; take the "magic path" option for whatever doesn't benefit from tham otherwise! | ||
We think this will make a lot of the tooling and manual work around SQL obsolete and your codebase saner! And notice how this gives you back SQL - and every other thing as only an extension of that! | ||
We think this will make a lot of the tooling and manual work around SQL obsolete and your codebase saner! And notice how this gives you back SQL - while having every other thing as only an extension of that! | ||
@@ -310,5 +310,5 @@ ## Introducing Auto-Versioning | ||
✨ _Now, that translates to all the engineering work you once did manaually having been moved to the database, plus, your schema histories now having been encoded **as data** (**instead of as files**), making them queryable, analyzable, and even visualizable, as regular data!_ | ||
✨ _Now, that translates to all the engineering work you once did manaually having been moved to the database, plus, your schema histories also having been encoded **as data** (**instead of as files**), making them queryable, analyzable, and even visualizable, as regular data!_ | ||
Taking that further, you also get a way to *roll forward* from a rollback! (Much like hitting "Redo" to reverse a certain "Undo"). This time, on calling `database.savepoint()`, you specify a "forward" movement from your current point in time: | ||
Taking that further, you also get a way to *roll forward* from a rollback state! (Much like hitting "Redo" to reverse a certain "Undo"). This time, on calling `database.savepoint()`, you indicate that you want a "forward" movement from your current point in time: | ||
@@ -432,3 +432,3 @@ ```js | ||
> // string[] - required | ||
> "columns": ["id"], | ||
> "columns": ["id_2"], | ||
> }, | ||
@@ -644,3 +644,3 @@ > { | ||
Now, you can always extend your DB structure with new objects, and you can always drop objects or edit them in-place. But note that for an existing database, table, column, constraint, or index, **names may be changed, but not in-place!** A "rename" operation is done with the addition of a temporary `$name` attribute: | ||
Now, you can always extend your DB structure with new objects and always drop existsing objects or edit them in-place. But note that for an existing database, table, column, constraint, or index, **names may be changed, but not in-place!** A "rename" operation is done with the addition of a temporary `$name` attribute: | ||
@@ -647,0 +647,0 @@ ```js |
@@ -92,3 +92,3 @@ | ||
if (query instanceof DeleteStatement) { | ||
const result = await this.driver.query(`SELECT ${ selectList.join(', ' ) } FROM ${ tableIdent }${ this.WHERE_CLAUSE ? ` WHERE ${ this.WHERE_CLAUSE }` : '' }`); | ||
const result = await this.driver.query(`SELECT ${ selectList.join(', ' ) } FROM ${ tableIdent }${ query.WHERE_CLAUSE ? ` WHERE ${ query.WHERE_CLAUSE }` : '' }`); | ||
return [query, () => result]; | ||
@@ -99,3 +99,3 @@ } | ||
const colName = 'obj_column_for_returning_clause_support'; | ||
const columnIdent = Identifier.fromJson(this, colName ); | ||
const columnIdent = Identifier.fromJson(this, colName); | ||
await this.driver.query(`ALTER TABLE ${ tableIdent } ADD COLUMN ${ columnIdent } char(36) INVISIBLE`); | ||
@@ -102,0 +102,0 @@ const insertUuid = ( 0 | Math.random() * 9e6 ).toString( 36 ); |
@@ -66,3 +66,5 @@ | ||
COLUMNS.character_maximum_length, | ||
${ this.client.params.dialect === 'mysql' ? '' : ` | ||
${ this.client.params.dialect === 'mysql' ? ` | ||
COLUMNS.extra, | ||
` : ` | ||
COLUMNS.is_identity, | ||
@@ -187,3 +189,4 @@ COLUMNS.identity_generation, | ||
columns: $columns.reduce((cols, col) => { | ||
const temp = {}; | ||
const temp = {}, extras = col.extra/*mysql*/?.split(',').map(s => s.trim()) || []; | ||
if (extras.includes('INVISIBLE') && false) return cols; | ||
return cols.concat({ | ||
@@ -204,3 +207,3 @@ name: col.column_name, | ||
} : {}), | ||
...(col.is_identity !== 'NO' ? { | ||
...(col.is_identity/*postgres*/ === 'YES' ? { | ||
identity: { always: col.identity_generation === 'ALWAYS' } | ||
@@ -211,6 +214,9 @@ } : {}), | ||
} : {}), | ||
...(extras.includes('auto_increment')/*mysql*/ ? { | ||
autoIncrement: true | ||
} : {}), | ||
...(col.is_nullable === 'NO' ? { | ||
notNull: true | ||
} : {}), | ||
...(col.column_default ? { | ||
...(col.column_default && col.column_default !== 'NULL' ? { | ||
default: { expr: col.column_default } | ||
@@ -225,3 +231,3 @@ } : {}), | ||
name: key.constraint_name, | ||
type: key.constraint_type === 'UNIQUE' ? 'UNIQUE_KEY' : key.constraint_type, | ||
type: key.constraint_type === 'UNIQUE' ? 'UNIQUE_KEY' : key.constraint_type.replace('_', ''), | ||
columns: key.column_name.split(',').map(col => col.trim()), | ||
@@ -228,0 +234,0 @@ ...(key.constraint_type === 'FOREIGN KEY' ? { references: formatRelation(key, true) } : {}), |
@@ -73,3 +73,3 @@ | ||
console.log('.....create books.....', await lqlClient.query(`CREATE TABLE books ( | ||
id int primary key generated always as identity, | ||
id int primary key generated by default as identity, | ||
title varchar(100), | ||
@@ -76,0 +76,0 @@ content varchar(100), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
5310211
11495