summaryrefslogtreecommitdiff
path: root/util/sqleditfunc.pl
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-11-19 21:20:56 +0100
committerYorhel <git@yorhel.nl>2021-11-19 21:21:27 +0100
commit66eb5246d8b9477993fb53dc2fc7c08e337e6b6e (patch)
tree3c0dfbc57da9f70b07cee7573d8b1b3129c2b20f /util/sqleditfunc.pl
parent0ea2fb67930af01fe5f4484615e129a13bd8649b (diff)
Fix staff alias editing
Broken when adding the staff_alias.c_search GENERATED COLUMN. The column was being created in the temporary table, including the NOT NULL constraint but excluding the GENERATED part, so it would get filled with NULL and throw an error.
Diffstat (limited to 'util/sqleditfunc.pl')
-rwxr-xr-xutil/sqleditfunc.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/sqleditfunc.pl b/util/sqleditfunc.pl
index 67aef6cf..e18adde4 100755
--- a/util/sqleditfunc.pl
+++ b/util/sqleditfunc.pl
@@ -25,7 +25,7 @@ sub gensql {
my %replace = ( item => $item, itemtype => $schema->{$item}{dbentry_type} );
$replace{createtemptables} = join "\n", map sprintf(
- " CREATE TEMPORARY TABLE edit_%s (LIKE %s INCLUDING DEFAULTS INCLUDING CONSTRAINTS);\n".
+ " CREATE TEMPORARY TABLE edit_%s (LIKE %s INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING GENERATED);\n".
" ALTER TABLE edit_%1\$s DROP COLUMN %s;",
$_, $_ eq 'staff_alias' ? ($_, 'id') : ("${_}_hist", 'chid') # staff_alias copies from the non-_hist table, because it needs the sequence
), sort keys %ts;