forked from typeorm/typeorm
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Unnecessary migrations for fulltext indices
Fixes typeorm#6633 (see issue for root cause explanation)
- Loading branch information
1 parent
d1ed572
commit d91b058
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Entity, PrimaryColumn, Index, Column } from "../../../../src"; | ||
|
||
@Entity() | ||
export class Test { | ||
@PrimaryColumn() | ||
id: number; | ||
|
||
@Index("description_index", { fulltext: true }) | ||
@Column() | ||
description: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import "reflect-metadata"; | ||
import { expect } from "chai"; | ||
import { Connection } from "../../../src"; | ||
import { closeTestingConnections, createTestingConnections, reloadTestingDatabases } from "../../utils/test-utils"; | ||
import { Post } from "../4440/entity/Post"; | ||
|
||
describe.only("github issues > #6633 Fulltext indices continually dropped & re-created", () => { | ||
|
||
let connections: Connection[]; | ||
before(async () => { | ||
connections = await createTestingConnections({ | ||
entities: [Post], | ||
schemaCreate: true, | ||
dropSchema: true | ||
}); | ||
}); | ||
beforeEach(() => reloadTestingDatabases(connections)); | ||
after(() => closeTestingConnections(connections)); | ||
|
||
it("should not create migrations for fulltext indices", () => | ||
Promise.all(connections.map(async (connection) => { | ||
const sqlInMemory = await connection.driver.createSchemaBuilder().log(); | ||
|
||
expect(sqlInMemory.upQueries).to.eql([]); | ||
expect(sqlInMemory.downQueries).to.eql([]); | ||
} | ||
)) | ||
); | ||
}); |