I'm trying to create new table and index the columns in Postgres through Django model. The table creation uses another table's setup and the indexing uses pg_trgm
I can do it directly on Postgres by
CREATE TABLE my_table (like my_other_table);
and Insert data like
INSERT INTO my_table SELECT * FROM MY_OTHER_TABLE TABLESAMPLE BERNOULLI (5);
This will take 5% of the data from my_other_table into my_table
Then I index the column by
CREATE INDEX mycolumn_trgm_idx ON my_table USING GIN (my_column gin_trgm_ops);
There's no issue when I perform these actions on postgres directly, but I don't know how (or if it's possible) to do it through django migration