Alter the length of a varchar column throws Error: Corrupted alias
I've created a test that reproduces the error, it is thrown when trying todo the insert.
it ('alters varchar without crashing', () => {
const data = many(`CREATE TABLE companyuser
(
companyuserid bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY UNIQUE,
role varchar(16)
);
ALTER TABLE companyuser ALTER COLUMN role TYPE varchar(100);
insert into companyuser(role) values ('Developer');
select * from companyuser;`);
})
I would love to help out fixing the issue but have problem running the pg-mem unit tests in Webstorm:
TSError: ⨯ Unable to compile TypeScript:
src/tests/alter-table.queries.spec.ts(14,31): error TS2339: Property 'bind' does not exist on type '(query: string) => {}'.
src/tests/alter-table.queries.spec.ts(15,31): error TS2339: Property 'bind' does not exist on type '(query: string) => void'
Hi ! Thanks for the report.
Thanks for trying to fix that. I'm not sure why you get these errors (the error itself is kinda weird: I dont see how a method type could not have the bind property 😶)... what did you do to run the tests ? npm run test ?
That said I'm a middle of a sizeable refactoring, which would likely conflict with your fix. So dont bother too much, I added your unit test to the test suite, and I'll have a look asap 😉
Thanks for looking into this. 💚 When I try to run the tests from Webstorm, the IDE executes
$ node ./node_modules/mocha/bin/mocha --require ts-node/register --ui bdd ./src/tests/alter-table.queries.spec.ts
TSError: ⨯ Unable to compile TypeScript:
src/tests/alter-table.queries.spec.ts:14:31 - error TS2339: Property 'bind' does not exist on type '(query: string) => {}'.
I'm a little new to working with bigger Typescript projects and the tooling around them. It could be something simple that is wrong with my dev env. My background is mostly in Java, and I have experience with building databases from the ground up.