pgsql-ast-parser
Advanced tools
Comparing version 8.1.0 to 8.1.1
{ | ||
"name": "pgsql-ast-parser", | ||
"version": "8.1.0", | ||
"version": "8.1.1", | ||
"description": "Yet another simple Postgres SQL parser/modifier", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -394,2 +394,5 @@ // import { IType } from '../../interfaces'; | ||
name: QName; | ||
temporary?: boolean; | ||
unlogged?: boolean; | ||
locality?: 'global' | 'local'; | ||
ifNotExists?: true; | ||
@@ -396,0 +399,0 @@ columns: (CreateColumnDef | CreateColumnsLikeTable)[]; |
@@ -42,2 +42,76 @@ import 'mocha'; | ||
checkInvalid('create temp unlogged table test (id text)'); | ||
checkInvalid('create global unlogged table test (id text)'); | ||
checkCreateTable(['create temp table test(value text)', 'create temporary table test(value text)'], { | ||
type: 'create table', | ||
name: { name: 'test', }, | ||
temporary: true, | ||
columns: [{ | ||
kind: 'column', | ||
name: { name: 'value' }, | ||
dataType: { | ||
name: 'text', | ||
}, | ||
}], | ||
}); | ||
checkCreateTable(['create unlogged table test(value text)'], { | ||
type: 'create table', | ||
name: { name: 'test', }, | ||
unlogged: true, | ||
columns: [{ | ||
kind: 'column', | ||
name: { name: 'value' }, | ||
dataType: { | ||
name: 'text', | ||
}, | ||
}], | ||
}); | ||
checkCreateTable(['create global table test(value text)', 'create GLOBAL table test(value text)'], { | ||
type: 'create table', | ||
name: { name: 'test', }, | ||
locality: 'global', | ||
columns: [{ | ||
kind: 'column', | ||
name: { name: 'value' }, | ||
dataType: { | ||
name: 'text', | ||
}, | ||
}], | ||
}); | ||
checkCreateTable(['create local table test(value text)'], { | ||
type: 'create table', | ||
name: { name: 'test', }, | ||
locality: 'local', | ||
columns: [{ | ||
kind: 'column', | ||
name: { name: 'value' }, | ||
dataType: { | ||
name: 'text', | ||
}, | ||
}], | ||
}); | ||
checkCreateTable(['create local temp table test(value text)'], { | ||
type: 'create table', | ||
name: { name: 'test', }, | ||
locality: 'local', | ||
temporary: true, | ||
columns: [{ | ||
kind: 'column', | ||
name: { name: 'value' }, | ||
dataType: { | ||
name: 'text', | ||
}, | ||
}], | ||
}); | ||
checkCreateTable(`CREATE TABLE capitals ( | ||
@@ -44,0 +118,0 @@ state char(2) |
@@ -817,3 +817,13 @@ import { IAstPartialMapper, AstDefaultMapper } from './ast-mapper'; | ||
createTable: t => { | ||
ret.push(t.ifNotExists ? 'CREATE TABLE IF NOT EXISTS ' : 'CREATE TABLE '); | ||
ret.push('CREATE '); | ||
if(t.locality) { | ||
ret.push(t.locality.toUpperCase(), ' '); | ||
} | ||
if (t.temporary) { | ||
ret.push('TEMPORARY '); | ||
} | ||
if(t.unlogged) { | ||
ret.push('UNLOGGED '); | ||
} | ||
ret.push(t.ifNotExists ? 'TABLE IF NOT EXISTS ' : 'TABLE '); | ||
m.tableRef(t.name); | ||
@@ -820,0 +830,0 @@ ret.push('('); |
@@ -285,2 +285,5 @@ import { nil } from '../utils'; | ||
name: QName; | ||
temporary?: boolean; | ||
unlogged?: boolean; | ||
locality?: 'global' | 'local'; | ||
ifNotExists?: true; | ||
@@ -287,0 +290,0 @@ columns: (CreateColumnDef | CreateColumnsLikeTable)[]; |
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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1440738
15935