aprismatic / prismadb

Prisma/DB public releases and documentation.
34 stars 1 forks source link

Unable to ALTER COLUMN for ENCRYPTED Columns #27

Closed saklanipankaj closed 5 years ago

saklanipankaj commented 5 years ago
ALTER TABLE t3 ALTER COLUMN
    a INT (MULTIPLICATION, ADDITION, SEARCH, STORE, RANGE) NULL;

HResult 0x4E21, Level 16, State 1 Altering of encryption types using ALTER TABLE has been deprecated. Use PRISMADB ENCRYPT or PRISMADB DECRYPT instead.

Column a is already an ENCRYPTED COLUMN that is defined as NOT NULL, the attempt of the query was to change the NOT NULL to NULL. An Error statement is returned advising to use the Native PRISMADB ENCRYPT or PRISMADB DECRYPT functions. This is an error as the native functions are not meant to modify columns.

cheziyi commented 5 years ago

Will investigate

cheziyi commented 5 years ago

There is an error in the query provided:

ALTER TABLE t3 ALTER COLUMN
    a INT (MULTIPLICATION, ADDITION, SEARCH, STORE, RANGE) NULL;

It is missing the ENCRYPTED FOR keywords, the correct syntax is:

ALTER TABLE t3 ALTER COLUMN
    a INT ENCRYPTED FOR (MULTIPLICATION, ADDITION, SEARCH, STORE, RANGE) NULL;

This issue is now closed.