feat: implement ALTER TYPE oldName NAME newName operation#1501
feat: implement ALTER TYPE oldName NAME newName operation#1501lvca merged 8 commits intoArcadeData:mainfrom
Conversation
lvca
left a comment
There was a problem hiding this comment.
Thanks for this PR! You're right, we never completed the rename of the type. Have you already tested it? We'd need some test cases too. Let me know if you can do it, or we can find somebody can help with that.
engine/src/main/java/com/arcadedb/query/sql/parser/AlterTypeStatement.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/com/arcadedb/query/sql/parser/AlterTypeStatement.java
Show resolved
Hide resolved
I'm not sure where the tests are located ( |
|
Also, in the case of indexes, we have to rename them as well. Not fundamental, because they are linked in the The only important thing missing is, at least, one test case to avoid regression and to test that this change works. |
| public void sqlAlterTypeName() { | ||
| database.command("sql", "CREATE VERTEX TYPE Mpv"); | ||
| database.command("sql", "ALTER TYPE Mpv NAME Sedan"); | ||
| Assertions.assertNotNull(database.getSchema().getType("Sedan")); |
There was a problem hiding this comment.
It would be wonderful if you can also test the previous Mpv type doesn't exist anymore
|
|
||
| @Test | ||
| public void sqlAlterTypeName() { | ||
| database.command("sql", "CREATE VERTEX TYPE Mpv"); |
There was a problem hiding this comment.
Could you please create a property with an index, so see if everything works as expected? Thanks in advance @daffodilistic !
| database.command("sql", "CREATE INDEX ON Sedan(engine_number) UNIQUE"); | ||
| database.begin(); | ||
| // insert a random record | ||
| database.getSchema().getType("Sedan").newRecord().set("engine_number", "123").save(); |
There was a problem hiding this comment.
Thanks for the change. I meant creating an index on the old type and see what happens when you rename it. Is the index still working or does it need to be renamed too?
|
Hi, I'm getting an error with the latest changes to the test case. It seems like there's an issue with existing documents of the type with a custom index, before being renamed: Not quite sure what to make of it. I'll try syncing my branch with upstream master first to see if any bugfixes resolved it |
|
That issue should be fixed now in |
|
Should this PR be closed and merged, or a new one created? The test passed with the latest version on |
|
That works, thanks! |
What does this PR do?
Implement
ALTER TYPE oldName NAME newNameMotivation
It's listed in the documentation page, but its not working in the database
Related issues
N/A
Additional Notes
N/A
Checklist
mvn clean packagecommand