-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: generate index name with column name (#230)
<!-- Thank you for your pull request. Please review below requirements. Bug fixes and new features should include tests and possibly benchmarks. Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md 感谢您贡献代码。请确认下列 checklist 的完成情况。 Bug 修复和新功能必须包含测试,必要时请附上性能测试。 Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md --> ##### Checklist <!-- Remove items that do not apply. For completed items, change [ ] to [x]. --> - [ ] `npm test` passes - [ ] tests and/or benchmarks are included - [ ] documentation is changed or added - [ ] commit message follows commit guidelines ##### Affected core subsystem(s) <!-- Provide affected core subsystem(s). --> ##### Description of change <!-- Provide a description of the change below this comment. --> <!-- - any feature? - close https://github.com/eggjs/egg/ISSUE_URL --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced index building functionality in the application by allowing class type references during index creation. - Introduced a new database table schema representation, improving the integration with ORM frameworks. - **Bug Fixes** - Improved error messages for clearer identification of issues related to missing columns in index creation. - **Tests** - Added a new test case for the SQL generator, ensuring accurate SQL generation for the new database table model. - Modified test logic to skip execution on macOS and Windows platforms, enhancing robustness. - **Chores** - Updated MySQL installation and startup commands in GitHub Actions for improved compatibility and simplicity. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
7 changed files
with
89 additions
and
9 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,11 +62,11 @@ jobs: | |
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install Mysql | ||
run: brew install mysql@5.7 | ||
run: brew install mysql | ||
|
||
- name: Start Mysql | ||
## arm64/x86 homebrew mysql path different | ||
run: /usr/local/opt/[email protected]/bin/mysql.server start || /opt/homebrew/Cellar/mysql@5.7/5.7.44_1/bin/mysql.server start | ||
run: brew services start mysql | ||
|
||
- name: Install Npm | ||
run: npm i -g npm@9 | ||
|
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
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
63 changes: 63 additions & 0 deletions
63
core/dal-runtime/test/fixtures/modules/dal/FooIndexName.ts
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,63 @@ | ||
import { | ||
Column, | ||
ColumnType, | ||
Index, | ||
IndexStoreType, | ||
IndexType, | ||
Table, | ||
} from '@eggjs/dal-decorator'; | ||
|
||
@Table({ | ||
name: 'egg_foo', | ||
comment: 'foo table', | ||
characterSet: 'utf8mb4', | ||
collate: 'utf8mb4_unicode_ci', | ||
}) | ||
@Index({ | ||
keys: [ 'name', 'col1', 'bitColumn' ], | ||
type: IndexType.UNIQUE, | ||
storeType: IndexStoreType.BTREE, | ||
comment: 'index comment\n', | ||
}) | ||
@Index({ | ||
keys: [ 'col1', 'boolColumn' ], | ||
type: IndexType.FULLTEXT, | ||
comment: 'index comment\n', | ||
}) | ||
export class FooIndexName { | ||
@Column({ | ||
type: ColumnType.INT, | ||
}, { | ||
primaryKey: true, | ||
autoIncrement: true, | ||
comment: 'the primary key', | ||
}) | ||
id: number; | ||
|
||
@Column({ | ||
type: ColumnType.VARCHAR, | ||
length: 100, | ||
}, { | ||
uniqueKey: true, | ||
}) | ||
name: string; | ||
|
||
@Column({ | ||
type: ColumnType.VARCHAR, | ||
length: 100, | ||
}, { | ||
name: 'col1', | ||
}) | ||
col1: string; | ||
|
||
@Column({ | ||
type: ColumnType.BIT, | ||
length: 10, | ||
}) | ||
bitColumn: Buffer; | ||
|
||
@Column({ | ||
type: ColumnType.BOOL, | ||
}) | ||
boolColumn: 0 | 1; | ||
} |
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