mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-25 02:14:31 +02:00
--not-null-default and not_null_default=, refs #24
This commit is contained in:
parent
7a3041b1ad
commit
2fed87da6e
7 changed files with 87 additions and 16 deletions
|
|
@ -199,6 +199,27 @@ def test_add_column(db_path, col_name, col_type, expected_schema):
|
|||
assert expected_schema == collapse_whitespace(db["dogs"].schema)
|
||||
|
||||
|
||||
def test_add_column_not_null_default(db_path):
|
||||
db = Database(db_path)
|
||||
db.create_table("dogs", {"name": str})
|
||||
assert "CREATE TABLE [dogs] ( [name] TEXT )" == collapse_whitespace(
|
||||
db["dogs"].schema
|
||||
)
|
||||
args = [
|
||||
"add-column",
|
||||
db_path,
|
||||
"dogs",
|
||||
"nickname",
|
||||
"--not-null-default",
|
||||
"dogs'dawg",
|
||||
]
|
||||
assert 0 == CliRunner().invoke(cli.cli, args).exit_code
|
||||
assert (
|
||||
"CREATE TABLE [dogs] ( [name] TEXT , [nickname] TEXT NOT NULL DEFAULT 'dogs''dawg')"
|
||||
== collapse_whitespace(db["dogs"].schema)
|
||||
)
|
||||
|
||||
|
||||
def test_add_foreign_key(db_path):
|
||||
db = Database(db_path)
|
||||
db["authors"].insert_all(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue