Flyway not able find placeholder from conf file - database-migration

I am using flyway 3.2.1 and want to use a placeholder replacement in my migration scripts to replace the schema name as per the environment
when I pass the placeholder from CLI as
initialize flyway:migrate -Dflyway.outOfOrder=true -DskipTests -Dflyway.placeholders.schemaName=testDbName
the migrations work fine.
but when I try to do the same using flyawy.conf file I get the exception as
FlywayException: No value provided for placeholder expressions: ${schemaName}
I have tried passing the file path and name in CLI
initialize flyway:migrate -Dflyway.outOfOrder=true -DskipTests -Dflyway.configFiles=/resource/flyway.conf
I have also tried to place the config file in the same directory as of migration script resources/db/migration but I get the same exception
property in config file
flyway.placeholders.schemaName=testDbName
and sql is
insert into ${schemaName}.employee_department(emp_id,dept_id) values(123,87);
am I missing something about the file location or not passing the path properly?

used maven property to provide conf file path
<configFile>src/main/resources/flyway.conf</configFile>

Related

django project: isort ignores local .cfg file's "skip" parameter

I'm using "isort" in my Django project and the problem is when I make the isort command on the project level it ignores app-level ".isort.cfg" file's skip parameters.
My isort version is 5.11.4.
The local/app level ".isort.cfg" file:
[settings]
known_django=django
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
skip=migrations
How to force it to not ignore nested folders cfg files?
Results for command "isort . --resolve-all-configs --verbose
" is a long list(no errors) like following:
./orders/.isort.cfg used for file ./orders/migrations/0001_initial.py
./orders/.isort.cfg used for file ./orders/migrations/init.py
As seen here it 'uses' app-level cfg file but 'migrations' files are not ignored as it should be according the app-level config.
You can add --resolve-all-configs to your isort command. More information in the doc section Supporting multiple config files in single isort run.
For example in my multi-app django-project I have a .isort.cfg at root level, and I added the .isort.cfg file in my settings folder. Here is the output I get with following command: isort --verbose --resolve-all-configs .
.\.isort.cfg used for file .\project\views\project.py # root config file
.\settings\.isort.cfg used for file .\settings\asgi.py # nested config file

Can't download json schema using gradlew command

I can't figure out how to use the gradlew command to convert my GraphQL schema into a JSON file as it is specified in the documentation.
I opened CMD in my project folder, ran the gradlew command once, and it gave me this error:
Project 'module' not found in root project gradlew
I created a module inside my project with the name "module" and now it's throwing the following error:
Task 'downloadApolloSchema' not found in project ':module'.
I've already added all the dependencies to the latest version (2.0.0 as of the time of posting) so I'm clueless as to why this is happening. I've already searched the web and found nothing about this...
This is the command I'm trying to issue in the CMD:
C:\Users\myuser\AndroidStudioProjects\GraphQLApp\app>..\gradlew :module:downloadApolloSchema -Pcom.apollographql.apollo.endpoint=https://graphql-udemy-android.herokuapp.com/graphql -Pcom.apollographql.apollo.schema=src/main/graphql/com/example/schema.json
I have to go up one directory (..\) since the gradlew command is in the above my app folder.
I'm on Windows, and my Gradle version is 6.4.
You just change ./gradlew to .\gradlew
Open the root terminal
Paste the code below and ENTER!
.\gradlew downloadApolloSchema --endpoint=https://Your Endpoint/graphql --schema=app/src/main/graphql/com/example/Your Path/schema.json
Have a good days!
Sorry about that, the module part was mostly a placeholder for the gradle module where you apply the com.apollographql.apollo plugin. You can ignore it and gradle will find the appropriate task:
./gradlew downloadApolloSchema
This has been updated in the project README as well.
For windows i used
.\gradlew downloadApolloSchema --endpoint="https://rickandmortyapi.com/graphql" --schema=app/src/main/graphql/GetRepositories.json
NOTICE I used:
.\ instead of ./

How to create a python 2.7 environment variable?

I have multiple versions of python installed so I wanted to create a command for each of them. I created the variable "python27" as both a user and system variable with the path "C:\Python27" and also tried "C:\Python27\python.exe". In both cases cmd says 'python27' is not recognized as an internal or external command.
My batch file is simply "python27 path_to_py_file".
You need to create a batch file for this. For example:
#C:\Python27\python.exe %*
Save this as python27.bat in a directory referenced by the PATH environment variable and you are good to go.

Failed to create log file on application directory?

I want to write a log file for my application. The path where I want to store the file is:
destination::"C:\ColdFusion8\wwwroot\autosyn\logs"
I have used the sample below to generate the log file:
<cfset destination = expandPath('logs')>
<cfoutput>destination::"#destination#"</cfoutput><br/>
<cflog file='#destination#/test' application="yes" text="Running test log.">
When I supply the full path, it didn't create a log file. When I remove my destination, and only provide a file name, the log is generated in the ColdFusion server path C:\ColdFusion8\logs.
How can I generate a log file in my application directory?
Here is the description of attribute file according to cflog tag specs:
Message file. Specify only the main part of the filename. For example,
to log to the Testing.log file, specify "Testing".
The file must be located in the default log directory. You cannot
specify a directory path. If the file does not exist, it is created
automatically, with the extension .log.
You can use cffile tag to write information into the custom folder.
From the docs for <cflog>:
file
Optional
Message file. Specify only the main part of the filename. For example, to log to the Testing.log file, specify "Testing".
The file must be located in the default log directory. You cannot specify a directory path. If the file does not exist, it is created automatically, with the extension .log.
(My emphasis).
Reading the docs is always a good place to start when wondering how things might work.
So <cflog> will only log to the ColdFusion logs directory, and that is by design.
I don't have CF8 handy, but you would be able to set the logging directory to be a different one via either the CFAdmin UI (CF9 has this, I just confirmed), or neo-logging.xml in WEB-INF/cfusion/lib.
Or you could use a different logging mechanism. I doubt it will work on a rusty of CF8 install, but perhaps LogBox?

Sublime Text 2 FileTemplates plugin doesn't work

I want to use "FileTemplates" plugin in Sublime Text 2. I installed it with Package Controller, but when I use "Create file from template" and select something, nothing happens! It doesn't even create a file.
How can I make it work? Any ideas?
You need to find you current user's packages folder. Here you will find where the FileTemplates package has been installed. On my Windows system it is %APPDATA%\Roaming\Sublime Text 2\Packages\FileTemplates. You may also get to this folder from the Preferences menu by selecting Browse Packages...
Inside this folder there is a Templates folder. Inside this folder you will find the pre-canned file templates. You may create your own by copying and pasting the existing files to create the templates you like. You will need to create a .file-template file in the FileTemplates folder. This file is an xml file which tells sublime where to find the actual template and what parameters to the file creation the user may pass into the template. For instance $name is the parameter that the user is prompted for which will be used to name the file created from the template. Hope this helps.