Skip to content

Commit b244431

Browse files
authored
Add support to PostgreSQL indexes of type SPGIST/GIN/BRIN (#88)
1 parent 50c1a09 commit b244431

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

SQLSchemaCompare.Infrastructure/SqlScripters/PostgreSqlScripter.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,12 @@ protected override string ScriptCreateIndex(ABaseDbIndex index)
321321
// If not specified it will use the BTREE
322322
break;
323323

324-
case "gist":
325-
sb.Append("USING gist ");
326-
break;
327-
328324
case "hash":
329-
sb.Append("USING hash ");
325+
case "gist":
326+
case "spgist":
327+
case "gin":
328+
case "brin":
329+
sb.Append($"USING {indexPostgreSql.Type} ");
330330
break;
331331

332332
default:

SQLSchemaCompare.Test/Datasources/sakila-schema-postgresql.sql

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ CREATE INDEX film_fulltext_idx ON inventory.film USING gist (fulltext);
13221322
-- Name: idx_actor_last_name; Type: INDEX; Schema: public; Owner: postgres
13231323
--
13241324

1325-
CREATE INDEX idx_actor_last_name ON inventory.actor USING btree (last_name);
1325+
CREATE INDEX idx_actor_last_name ON inventory.actor USING brin (last_name);
13261326

13271327

13281328
--
@@ -1483,7 +1483,7 @@ CREATE INDEX idx_fk_store_id ON customer_data.customer USING btree (store_id);
14831483
-- Name: idx_last_name; Type: INDEX; Schema: public; Owner: postgres
14841484
--
14851485

1486-
CREATE INDEX idx_last_name ON customer_data.customer USING btree (last_name);
1486+
CREATE INDEX idx_last_name ON customer_data.customer USING SPGIST (last_name);
14871487

14881488

14891489
--
@@ -1500,6 +1500,13 @@ CREATE INDEX idx_store_id_film_id ON inventory USING btree (store_id, film_id);
15001500
CREATE INDEX idx_title ON inventory.film USING btree (title);
15011501

15021502

1503+
--
1504+
-- Name: idx_special_features; Type: INDEX; Schema: public; Owner: postgres
1505+
--
1506+
1507+
CREATE INDEX idx_special_features ON inventory.film USING gin (special_features);
1508+
1509+
15031510
--
15041511
-- Name: idx_unq_manager_staff_id; Type: INDEX; Schema: public; Owner: postgres
15051512
--

0 commit comments

Comments
 (0)