Require the SQLAlchemy URI on the database model (#8720)

* Require the SQLAlchemy URI when creating a database

* Add migration to make dbs.sqlalchemy_uri not-nullable

* Fixes for black, isort, tests

* Alter migration to use current revision from master as downgrade target

* Update tests to support new db constraint

* black
This commit is contained in:
Will Barrett
2019-12-11 14:05:23 -08:00
committed by Maxime Beauchemin
parent a96eae46af
commit ed54f6ec8d
4 changed files with 51 additions and 3 deletions

View File

@@ -766,7 +766,7 @@ class Database(
verbose_name = Column(String(250), unique=True)
# short unique name, used in permissions
database_name = Column(String(250), unique=True, nullable=False)
sqlalchemy_uri = Column(String(1024))
sqlalchemy_uri = Column(String(1024), nullable=False)
password = Column(EncryptedType(String(1024), config["SECRET_KEY"]))
cache_timeout = Column(Integer)
select_as_create_table_as = Column(Boolean, default=False)