Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion __fixtures__/misc.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ create table if not exists users (
handle text not null,
created_at timestamp not null default now(),
updated_at timestamp not null default now()
)
);

CREATE INDEX CONCURRENTLY IF NOT EXISTS index_email_logs_on_created_at ON public.email_logs USING btree (created_at DESC);
Original file line number Diff line number Diff line change
Expand Up @@ -246734,7 +246734,7 @@ exports[`misc 15`] = `
],
},
},
"stmt_len": undefined,
"stmt_len": 238,
"stmt_location": 629,
},
}
Expand All @@ -246747,9 +246747,44 @@ name text NOT NULL,
handle text NOT NULL,
created_at timestamp NOT NULL DEFAULT ( now() ),
updated_at timestamp NOT NULL DEFAULT ( now() )
)"
);"
`;

exports[`misc 17`] = `
{
"RawStmt": {
"stmt": {
"IndexStmt": {
"accessMethod": "btree",
"concurrent": true,
"idxname": "index_email_logs_on_created_at",
"if_not_exists": true,
"indexParams": [
{
"IndexElem": {
"name": "created_at",
"nulls_ordering": "SORTBY_NULLS_DEFAULT",
"ordering": "SORTBY_DESC",
},
},
],
"relation": {
"inh": true,
"location": 944,
"relname": "email_logs",
"relpersistence": "p",
"schemaname": "public",
},
},
},
"stmt_len": 123,
"stmt_location": 868,
},
}
`;

exports[`misc 18`] = `"CREATE INDEX CONCURRENTLY IF NOT EXISTS index_email_logs_on_created_at ON public.email_logs ( created_at DESC );"`;

exports[`parens 1`] = `
{
"RawStmt": {
Expand Down
3 changes: 3 additions & 0 deletions packages/deparser/src/deparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,9 @@ export default class Deparser {
if (node.concurrent) {
output.push('CONCURRENTLY');
}
if (node.if_not_exists) {
output.push('IF NOT EXISTS');
}

if (node.idxname) {
output.push(node.idxname);
Expand Down