-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add addIndex
& dropIndex
@ AlterTableBuilder
#522
add addIndex
& dropIndex
@ AlterTableBuilder
#522
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey 👋
Thank you! 💪
Looks good for the most part, a few comments and suggestions..
|
||
describe('add index', () => { | ||
it('should add an index', async () => { | ||
const builder = ctx.db.schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this uniform and call it query
.
const builder = ctx.db.schema | |
const query = ctx.db.schema |
Same with all occurrences.
@@ -1890,6 +1890,145 @@ for (const dialect of DIALECTS) { | |||
await builder.execute() | |||
}) | |||
}) | |||
|
|||
describe('add index', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sub-suite should be under the existing alter table
suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should break this test file into multiple files, but it is not in scope for this PR.
}) | ||
}) | ||
|
||
describe('drop index', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as add index
suite, this sub-suite should be under the existing alter table
suite.
return new AlterTableAddIndexBuilder({ | ||
...this.#props, | ||
indexBuilder: new AddIndexBuilder({ | ||
...this.#props, | ||
node: AddIndexNode.create({ name: IdentifierNode.create(indexName) }), | ||
}), | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why both AlterTableAddIndexBuilder
and AddIndexBuilder
exist. Mind explaining? 😕
return node.kind === 'AddIndexNode' | ||
}, | ||
|
||
create(index: Omit<AddIndexNode, 'kind'>): AddIndexNode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there ever a situation when it's created with anything but a name at first?
If not, accept a single argument name
here.
Hi @igalklebanov, can you take the rest of these features? Bcs currently, this in the only way to create an index on a table as I know with Kysely. Thank you! |
Hey everyone! Sorry for the delay in applying suggestions. I hope I will manage to fix everything util the end of August as I am currently stuck with my pet project.
@harrytran998 AFAIK in MySQL you could use create index statement. kysely/test/node/src/schema.test.ts Line 934 in 56107c5
|
This PR seems to be dead. Closing. |
Hey everyone! Sorry, I kinda lost track of time. I've completed the milestone of the project I was working at. I hope I will be able to finish implementation of this features now. I've made a separate branch where I applied @igalklebanov suggestions https://github.com/Gaspero/kysely/tree/add-and-remove-index-in-alter-table-v2 Don't you mind if I open a new PR? |
closes #507
closes #508