Y
Y
YakovSpb2021-09-15 13:19:01
PostgreSQL
YakovSpb, 2021-09-15 13:19:01

How to delete an old function in sql, add a new function and use it by default?

Hello everyone ... I need to add a new random_secret function to the secret field, delete the old random_hex function, and make the new function be used by default ... did I do everything right?

await queryRunner.query(`ALTER TABLE "room" ADD "secret" character varying(32) NOT NULL default random_secret(int)`);
    await queryRunner.query(`ALTER TABLE "room" DROP "secret" random_hex(32)`);
    await queryRunner.query('ALTER TABLE "room" ALTER COLUMN "secret" DROP DEFAULT');

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question