diff --git a/cookiecutter.json b/cookiecutter.json index 52edc2544..d9b76ca5f 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -17,8 +17,8 @@ "windows": "n", "use_pycharm": "n", "use_docker": "n", - "database": ["postgresql", "mysql"], - "db_version": [ + "database_engine": ["postgresql", "mysql"], + "database_version": [ "postgresql@14.1", "postgresql@13.5", "postgresql@12.9", @@ -27,6 +27,8 @@ "mysql@5.7", "mysql@5.6" ], + "_processed_database_engine": "{{ cookiecutter.database_version.split('@')[0] }}", + "_processed_database_version": "{{ cookiecutter.database_version.split('@')[1] }}", "js_task_runner": ["None", "Gulp"], "cloud_provider": ["AWS", "GCP", "None"], "mail_service": [ diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 3fd4131c8..85cdd6a62 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -17,6 +17,9 @@ INFO = "\x1b[1;33m [INFO]: " HINT = "\x1b[3;33m" SUCCESS = "\x1b[1;32m [SUCCESS]: " +SUPPORTED_POSTGRES_VERSIONS = [ "14.1", "13.5", "12.9", "11.14", "10.19"] +SUPPORTED_MYSQL_VERSIONS = [ "5.7", "5.6" ] + project_slug = "{{ cookiecutter.project_slug }}" if hasattr(project_slug, "isidentifier"): assert ( @@ -83,3 +86,14 @@ if ( "Mail Service for sending emails." ) sys.exit(1) + + +if "{{ cookiecutter._processed_database_engine }}" != "{{ cookiecutter.database_engine }}": + print( + WARNING + + " You have selected {{ cookiecutter.database_engine }} as your database and " + "your selected database_version {{ cookiecutter.database_version }} is not compatible with this " + "selection. Please retry and select appropriate option." + + TERMINATOR + ) + sys.exit(1)