https://kotlinlang.org logo
#exposed
Title
# exposed
s

spand

04/23/2018, 7:12 AM
Is that even possible in sql ?
n

Nikita Nikolenko

04/23/2018, 7:16 AM
Yes, we can do something like this
Copy code
ALTER TABLE table_name ADD newcolumn_name type NOT NULL DEFAULT (0)
Go
Update table_name SET newcolumn_name = oldcolumn_name Where newcolumn_name = 0
s

spand

04/23/2018, 7:22 AM
Ok ! In any case I think alter statements are out of scope for Exposed. So you would have to do it manually
t

tapac

04/23/2018, 8:18 AM
I'm also not sure that DEFAULT(0) is
default values from another column
. It's just "placeholder" value for further manual update. What you want may be handled with triggers, I guess.
n

Nikita Nikolenko

04/23/2018, 8:27 AM
DEFAULT(0) it’s just for set NOT NULL type for new column. Ok, will try, thank you.