diff --git a/__fixtures__/generated/generated.json b/__fixtures__/generated/generated.json index 2680c92b..ef08cbf6 100644 --- a/__fixtures__/generated/generated.json +++ b/__fixtures__/generated/generated.json @@ -21082,6 +21082,19 @@ "misc/inflection-24.sql": "CREATE FUNCTION inflection.slugify(text) RETURNS text AS $$SELECT inflection.slugify($1, false)$$ LANGUAGE sql IMMUTABLE", "misc/inflection-25.sql": "INSERT INTO inflection.inflection_rules (type, test, replacement) VALUES ('plural', '^(m|wom)en$', NULL), ('plural', '(pe)ople$', NULL), ('plural', '(child)ren$', NULL), ('plural', '([ti])a$', NULL), ('plural', '((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', NULL), ('plural', '(hi|ti)ves$', NULL), ('plural', '(curve)s$', NULL), ('plural', '([lr])ves$', NULL), ('plural', '([^fo])ves$', NULL), ('plural', '([^aeiouy]|qu)ies$', NULL), ('plural', '(s)eries$', NULL), ('plural', '(m)ovies$', NULL), ('plural', '(x|ch|ss|sh)es$', NULL), ('plural', '([m|l])ice$', NULL), ('plural', '(bus)es$', NULL), ('plural', '(o)es$', NULL), ('plural', '(shoe)s$', NULL), ('plural', '(cris|ax|test)es$', NULL), ('plural', '(octop|vir)i$', NULL), ('plural', '(alias|canvas|status|campus)es$', NULL), ('plural', '^(summons)es$', NULL), ('plural', '^(ox)en', NULL), ('plural', '(matr)ices$', NULL), ('plural', '^feet$', NULL), ('plural', '^teeth$', NULL), ('plural', '^geese$', NULL), ('plural', '(quiz)zes$', NULL), ('plural', '^(whereas)es$', NULL), ('plural', '^(criteri)a$', NULL), ('plural', '^genera$', NULL), ('plural', '^(m|wom)an$', E'\\\\1en'), ('plural', '(pe)rson$', E'\\\\1ople'), ('plural', '(child)$', E'\\\\1ren'), ('plural', '^(ox)$', E'\\\\1en'), ('plural', '(ax|test)is$', E'\\\\1es'), ('plural', '(octop|vir)us$', E'\\\\1i'), ('plural', '(alias|status|canvas|campus)$', E'\\\\1es'), ('plural', '^(summons)$', E'\\\\1es'), ('plural', '(bu)s$', E'\\\\1ses'), ('plural', '(buffal|tomat|potat)o$', E'\\\\1oes'), ('plural', '([ti])um$', E'\\\\1a'), ('plural', 'sis$', 'ses'), ('plural', '(?:([^f])fe|([lr])f)$', E'\\\\1\\\\2ves'), ('plural', '(hi|ti)ve$', E'\\\\1ves'), ('plural', '([^aeiouy]|qu)y$', E'\\\\1ies'), ('plural', '(matr)ix$', E'\\\\1ices'), ('plural', '(vert|ind)ex$', E'\\\\1ices'), ('plural', '(x|ch|ss|sh)$', E'\\\\1es'), ('plural', '([m|l])ouse$', E'\\\\1ice'), ('plural', '^foot$', 'feet'), ('plural', '^tooth$', 'teeth'), ('plural', '^goose$', 'geese'), ('plural', '(quiz)$', E'\\\\1zes'), ('plural', '^(whereas)$', E'\\\\1es'), ('plural', '^(criteri)on$', E'\\\\1a'), ('plural', '^genus$', 'genera'), ('plural', 's$', 's'), ('plural', '$', 's'), ('singular', '^(m|wom)an$', NULL), ('singular', '(pe)rson$', NULL), ('singular', '(child)$', NULL), ('singular', '^(ox)$', NULL), ('singular', '(ax|test)is$', NULL), ('singular', '(octop|vir)us$', NULL), ('singular', '(alias|status|canvas|campus)$', NULL), ('singular', '^(summons)$', NULL), ('singular', '(bu)s$', NULL), ('singular', '(buffal|tomat|potat)o$', NULL), ('singular', '([ti])um$', NULL), ('singular', 'sis$', NULL), ('singular', '(?:([^f])fe|([lr])f)$', NULL), ('singular', '(hi|ti)ve$', NULL), ('singular', '([^aeiouy]|qu)y$', NULL), ('singular', '(x|ch|ss|sh)$', NULL), ('singular', '(matr)ix$', NULL), ('singular', '([m|l])ouse$', NULL), ('singular', '^foot$', NULL), ('singular', '^tooth$', NULL), ('singular', '^goose$', NULL), ('singular', '(quiz)$', NULL), ('singular', '^(whereas)$', NULL), ('singular', '^(criteri)on$', NULL), ('singular', '^genus$', NULL), ('singular', '^(m|wom)en$', E'\\\\1an'), ('singular', '(pe)ople$', E'\\\\1rson'), ('singular', '(child)ren$', E'\\\\1'), ('singular', '^genera$', 'genus'), ('singular', '^(criteri)a$', E'\\\\1on'), ('singular', '([ti])a$', E'\\\\1um'), ('singular', '((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', E'\\\\1\\\\2sis'), ('singular', '(hi|ti)ves$', E'\\\\1ve'), ('singular', '(curve)s$', E'\\\\1'), ('singular', '([lr])ves$', E'\\\\1f'), ('singular', '([a])ves$', E'\\\\1ve'), ('singular', '([^fo])ves$', E'\\\\1fe'), ('singular', '(m)ovies$', E'\\\\1ovie'), ('singular', '([^aeiouy]|qu)ies$', E'\\\\1y'), ('singular', '(s)eries$', E'\\\\1eries'), ('singular', '(x|ch|ss|sh)es$', E'\\\\1'), ('singular', '([m|l])ice$', E'\\\\1ouse'), ('singular', '(bus)es$', E'\\\\1'), ('singular', '(o)es$', E'\\\\1'), ('singular', '(shoe)s$', E'\\\\1'), ('singular', '(cris|ax|test)es$', E'\\\\1is'), ('singular', '(octop|vir)i$', E'\\\\1us'), ('singular', '(alias|canvas|status|campus)es$', E'\\\\1'), ('singular', '^(summons)es$', E'\\\\1'), ('singular', '^(ox)en', E'\\\\1'), ('singular', '(matr)ices$', E'\\\\1ix'), ('singular', '(vert|ind)ices$', E'\\\\1ex'), ('singular', '^feet$', 'foot'), ('singular', '^teeth$', 'tooth'), ('singular', '^geese$', 'goose'), ('singular', '(quiz)zes$', E'\\\\1'), ('singular', '^(whereas)es$', E'\\\\1'), ('singular', 'ss$', 'ss'), ('singular', 's$', '')", "misc/inflection-26.sql": "CREATE INDEX inflection_rules_type_idx ON inflection.inflection_rules USING btree (type)", + "misc/indexes-1.sql": "CREATE INDEX CONCURRENTLY IF NOT EXISTS index_email_logs_on_created_at ON public.email_logs USING btree (created_at DESC)", + "misc/indexes-2.sql": "DROP INDEX my_index", + "misc/indexes-3.sql": "DROP INDEX CONCURRENTLY my_index", + "misc/indexes-4.sql": "DROP INDEX IF EXISTS my_index", + "misc/indexes-5.sql": "DROP INDEX CONCURRENTLY IF EXISTS my_index", + "misc/indexes-6.sql": "DROP INDEX schema.my_index", + "misc/indexes-7.sql": "DROP INDEX CONCURRENTLY schema.my_index", + "misc/indexes-8.sql": "DROP INDEX CONCURRENTLY IF EXISTS schema.my_index", + "misc/indexes-9.sql": "DROP INDEX my_index CASCADE", + "misc/indexes-10.sql": "DROP INDEX CONCURRENTLY my_index CASCADE", + "misc/indexes-11.sql": "DROP INDEX CONCURRENTLY IF EXISTS my_index CASCADE", + "misc/indexes-12.sql": "CREATE UNIQUE INDEX new_unique_idx ON new_example USING btree (a, b) INCLUDE (c)", + "misc/indexes-13.sql": "CREATE INDEX CONCURRENTLY idx_with_operator ON boom.merkle_tree USING gin (name gin_trgm_ops(param1=32, param2=true))", "misc/cascades-1.sql": "DROP TABLE IF EXISTS some_table CASCADE", "misc/cascades-2.sql": "DROP VIEW IF EXISTS some_view CASCADE", "misc/cascades-3.sql": "DROP MATERIALIZED VIEW IF EXISTS some_mat_view CASCADE", diff --git a/__fixtures__/kitchen-sink/misc/indexes.sql b/__fixtures__/kitchen-sink/misc/indexes.sql new file mode 100644 index 00000000..f1664161 --- /dev/null +++ b/__fixtures__/kitchen-sink/misc/indexes.sql @@ -0,0 +1,17 @@ +CREATE INDEX CONCURRENTLY IF NOT EXISTS index_email_logs_on_created_at ON public.email_logs USING btree (created_at DESC); + +DROP INDEX my_index; +DROP INDEX CONCURRENTLY my_index; +DROP INDEX IF EXISTS my_index; +DROP INDEX CONCURRENTLY IF EXISTS my_index; +DROP INDEX schema.my_index; +DROP INDEX CONCURRENTLY schema.my_index; +DROP INDEX CONCURRENTLY IF EXISTS schema.my_index; +DROP INDEX my_index CASCADE; +DROP INDEX CONCURRENTLY my_index CASCADE; +DROP INDEX CONCURRENTLY IF EXISTS my_index CASCADE; + + +CREATE UNIQUE INDEX new_unique_idx ON new_example(a, b) INCLUDE (c); + +CREATE INDEX CONCURRENTLY idx_with_operator ON boom.merkle_tree USING GIN ( name gin_trgm_ops ( param1 = 32, param2 = true) ); \ No newline at end of file diff --git a/packages/deparser/__tests__/kitchen-sink/misc-indexes.test.ts b/packages/deparser/__tests__/kitchen-sink/misc-indexes.test.ts new file mode 100644 index 00000000..5c171921 --- /dev/null +++ b/packages/deparser/__tests__/kitchen-sink/misc-indexes.test.ts @@ -0,0 +1,21 @@ + +import { FixtureTestUtils } from '../../test-utils'; +const fixtures = new FixtureTestUtils(); + +it('misc-indexes', async () => { + await fixtures.runFixtureTests([ + "misc/indexes-1.sql", + "misc/indexes-2.sql", + "misc/indexes-3.sql", + "misc/indexes-4.sql", + "misc/indexes-5.sql", + "misc/indexes-6.sql", + "misc/indexes-7.sql", + "misc/indexes-8.sql", + "misc/indexes-9.sql", + "misc/indexes-10.sql", + "misc/indexes-11.sql", + "misc/indexes-12.sql", + "misc/indexes-13.sql" +]); +}); diff --git a/packages/deparser/__tests__/kitchen-sink/misc-launchql-ext-types.test.ts b/packages/deparser/__tests__/kitchen-sink/misc-launchql-ext-types.test.ts index 4484933e..7f0c7304 100644 --- a/packages/deparser/__tests__/kitchen-sink/misc-launchql-ext-types.test.ts +++ b/packages/deparser/__tests__/kitchen-sink/misc-launchql-ext-types.test.ts @@ -1,6 +1,5 @@ import { FixtureTestUtils } from '../../test-utils'; - const fixtures = new FixtureTestUtils(); it('misc-launchql-ext-types', async () => {