mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-06 17:54:20 +01:00
Merge 'core/translate: Persist NOT NULL column constraint to schema table' from Preston Thorpe
closes #3391 Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #3402
This commit is contained in:
@@ -1033,6 +1033,9 @@ impl BTreeTable {
|
||||
sql.push(' ');
|
||||
sql.push_str(&column.ty_str);
|
||||
}
|
||||
if column.notnull {
|
||||
sql.push_str(" NOT NULL");
|
||||
}
|
||||
|
||||
if column.unique {
|
||||
sql.push_str(" UNIQUE");
|
||||
|
||||
@@ -204,3 +204,10 @@ do_execsql_test_on_specific_db {:memory:} alter-table-rename-to-quoted-identifie
|
||||
"CREATE INDEX idx ON \"t t\" (\"b b\")"
|
||||
"2"
|
||||
}
|
||||
|
||||
# https://github.com/tursodatabase/turso/issues/3391
|
||||
do_execsql_test_on_specific_db {:memory:} alter-table-add-notnull-col {
|
||||
CREATE TABLE t (a);
|
||||
ALTER TABLE t ADD b NOT NULL;
|
||||
SELECT sql FROM sqlite_schema WHERE type = 'table' AND name = 't';
|
||||
} {{CREATE TABLE t (a, b NOT NULL)}}
|
||||
|
||||
Reference in New Issue
Block a user