Why can't i create db with mikro-orm? - postgresql

so i'm trying to createdb in visualstudio code with mikro-orm and postgresql but there's an error:
createdb lireddit
The name "createdb" is not recognized as the name of a cmdlet, function, script file, or executable program. Check the spelling
name, as well as the presence and correctness of the path, and then try again.
+ createdb <<<< lireddit
+ CategoryInfo : ObjectNotFound: (createdb:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Before that i installed mikro-orm and postgresql with yarn, but it doesn't seem to work.

There is no option as mentioned in mikro-orm documentation to create a db using createdb mikro-orm docs .
The video you were following which led you here has setup some scripts or aliases in his bash_profile.sh and installed PG-CLI to do this locally to createdb using terminal.
Solution to how to do it the native way:
The database wont be created by running createdb in terminal.
First install postgresql server from EDB Installer site which gives all the tools to run your postgresql server and also a client called pgAdmin to interact with your postgresql server.
Once you have installed all the requirements. Open pgAdmin and create the data-base as shown in the image below.
Incase you are having trouble ahead on how the migrations happen from your project to postgresql through mikro-orm, let me know. I can help

Related

Windows 10 powershell 'node' not recognized as the name of a cmdlet, function, script file, or operable program

PS C:\Users\DELL> node (OR) gcc --version (OR) g++ --version
node: The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
node
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I m having a problem with my Windows 10 Powershell, whenever I tried to get run code of (node/c++/c) via VS code I am getting an error in PowerShell, I have tried restarting my laptop also tried Restarting PowerShell and edited environment paths still I am having the same error I think my Powershell Files got corrupted! please help me I am new to Stackoverflow and A student of B.Sc.IT so my vs code editor for learning purposes is also dependent on Powershell I get totally stuck !! , Thanks in advance!
Due to Posting answer ban I m writing here hope it helps the community
Actually, I have Tried the Following ways to solve this issue on windows 10~
System Restore
Powershell Restart
Powershell Files Replace (with other window system's files in Program files..etc)
Restart PC after troubleshooting
Environment path change
but didn't anything work...
But finally after windows 11 upgrade its automatically solved my issue
I recommend you to install certain things(Apps, software, etc..)
from the official Trusted website and do not tamper with system files
unless necessary also avoid using Crack versions and multiple .NET
frameworks and installers on the same system unless necessary use only
1 INSTALLER OF .NET VISUAL STUDIO latest in my case I think it was the
problem...!!
You have to add node to your PATH. Go to System->Environment Variables->System Variables. Edit the "Path" variable and add C:\Program Files\nodejs.

heroku : The term 'heroku' is not recognized as the name of a cmdlet, function, script file, or operable program

I installed heroku. I set the the bin folder path to environment variables. I have been trying to run command: heroku -v in my Visual Studio Code text editor. But I get the following error:
heroku : The term 'heroku' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ heroku -v
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (heroku:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
After correctly installing the Heroku CLI from the installer, the one more thing that needs to be done to run the Heroku commands in VS code terminal is to install the Heroku package from the npm. Use the following command for this:
npm install -g heroku
Now, to verify your CLI installation you can use the heroku -v or heroku --version command.
Just restart vs code and it will work. :)

Perl console : basic commands and fe_sendauth : no password was not working

I am currently working on the sqitch , to run scripts automatically for postgress sql , i had seen few posts talking about the .pgpass file , i had placed my .pgpass file in my root directory and , but when i run my sqitch deploy command , it says password not found , please check my commands below.
i am using the strawberry perl console , and i am also not able to execute basic commands like vi editor , ls etc.. please provide some assistance on this.
found perl recomended from sqitch website : http://strawberryperl.com/
commanmd :
sqitch --engine pg deploy db:pg://mypostgress.connqa9taxeg.us-east-1.rds.amazonaws.com:5432/dbone
fe_sendauth: no password supplied
The PostgreSQL documentation says this
On Microsoft Windows the file is named %APPDATA%\postgresql\pgpass.conf (where %APPDATA% refers to the Application Data subdirectory in the user's profile).
You need to put your .pgpass file in the correct place

PowerShell usage error with AWS CLI commands

AWS CLI commands in PowerShell like ec2, s3api work just fine, but deploy commands always throw a usage error. Why is this?
EDIT
If you've worked with the AWS CLI, you probably are aware of what commands I am
referenceing... But if you need example commands:
This works just fine in a PowerShell Script. So does aws s3api list-object, etc...
aws ec2 describe-instance-status --instance-id $ec2_instance_id.Trim() --region us-east-1 --query "InstanceStatuses[].InstanceState[].Name"
This does not work:
aws deploy create-deployment --application-name MyWebApp --s3-location bucket=sthreebucketname,bundleType=zip,eTag=abac12345jkjdafdafdf,key=MyWebApp.zip --deployment-group-name DepGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "MyApp Deployment"
I have set the user environment variable to my administrator. I have also set up PowerShell with my AWS credentials when I installed the Deploy Agent. So I should have no issue with access or permissions, but evidently it doesn't like the "deploy" suite of commands.
EDIT 2
Here is the error message. I know it says usage, but the same command works on the command prompt just fine.
aws : usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
At C:\scripts\deploy-to-instance.ps1:1 char:11
+ $result = aws deploy create-deployment --application-name MyWebApp --s3-location ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (usage: aws [opt....] [parameters]:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
Unknown options: eTag=abac12345jkjdafdafdf, key=MyWebApp.zip, bundleType=zip
New-CDDeployment command from the AWSPowerShell tool does the same thing.
What other permissions need to be set then?
It is not a permissions error at all.
The answer is:
The syntax in PowerShell is different(more finicky) than what the command prompt expects. You need to have quotations and commas in the exact correct spot for it to work properly.
If you are using the --query option, make sure your query's have the EXACT syntax. It seems the command prompt cli can use a slightly different syntax without throwing errors.

How can I start PostgreSQL on Windows?

I have installed Postgresql on my Windows 10 PC. I have used the pgAdmin II tool to create a database called company, and now I want to start the database server running. I cannot figure out how to do this.
I have run the start command on the postgres command line, and nothing seems to happen.
What I doing is:
postgres=# pg_ctl start
postgres=# pg_ctl status
postgres=# pg_ctl restart
postgres=# pg_ctl start company
postgres=# pg_ctl status
.....-> I am seeing nothing returned.
Go inside bin folder in C drive where Postgres is installed.
run following command in git bash or Command prompt:
pg_ctl.exe restart -D "<path upto data>"
Ex:
pg_ctl.exe restart -D "C:\Program Files\PostgreSQL\9.6\data"
Another way:
type "services.msc" in run popup(windows + R).
This will show all services running
Select Postgres service from list and click on start/stop/restart.
Thanks
pg_ctl is a command line (Windows) program not a SQL statement. You need to do that from a cmd.exe. Or use net start postgresql-9.5
If you have installed Postgres through the installer, you should start the Windows service instead of running pg_ctl manually, e.g. using:
net start postgresql-9.5
Note that the name of the service might be different in your installation. Another option is to start the service through the Windows control panel
I have used the pgAdmin II tool to create a database called company
Which means that Postgres is already running, so I don't understand why you think you need to do that again. Especially because the installer typically sets the service to start automatically when Windows is started.
The reason you are not seeing any result is that psql requires every SQL command to be terminated with ; in your case it's simply waiting for you to finish the statement.
See here for more details: In psql, why do some commands have no effect?
If you have installed postgres via the Windows installer you can start it in Services like so:
After a lot of search and tests i found the solution :
if you are in windows :
1 - first you must found the PG databases directory
execute the command as sql command in pgAdmin query tools
$ show data_directory;
result :
------------------------
- D:/PG_DATA/data -
------------------------
2 - go to the bin directory of postgres in my case it's located "c:/programms/postgresSql/bin"
and open a command prompt (CMD) and execute this command :
pg_ctl -D "D:\PSG_SQL\data" restart
This should do it.
The simplest way to start/stop/restart the installed PostgreSQL Server on your Windows device is as follows:
Start -> net start postgresql-x64-14
Stop -> net stop postgresql-x64-14
Restart -> net stop postgresql-x64-14 && net start postgresql-x64-14
The version number must be changed to take into account the installed version of your PostgreSQL Server.
For windows the following command worked well for me
pg_ctl.exe restart -D "<path_to_data>"
Eg: pg_ctl.exe restart -D "D:\Program Files\PostgreSQL\13\data"
If you are getting an error "psql.exe' is not recognized as an internal or external command,... "
There can be :
Causes
System is unable to find the psql.exe tool, because the path to this tool is not specified in the system environment variable PATH
or
- PostgreSQL Database client not installed on your PC
Since you have already installed PostgreSQL the latter can not be the issue(assuming everything is installed as expected)
In order to fix the first one "please specify the full path to the bin directory in the PostgreSQL installation folder, where this tool resides."
For example
Path: "C:\Program Files\PostgreSQL\10\bin"
I found using
net start postgres_service_name
the only reliable way to operate Postgres on Windows
first find your binaries file where it is saved.
get the path in terminal mine is
C:\Users\LENOVO\Documents\postgresql-9.5.21-1-windows-x64-binaries
(1)\pgsql\bin
then find your local user data path, it is in mostly
C:\usr\local\pgsql\data
now all we have to hit following command in the binary terminal path:
C:\Users\LENOVO\Documents\postgresql-9.5.21-1-windows-x64-binaries (1)\pgsql\bin>pg_ctl -D "C:\usr\local\pgsql\data" start
all done!
autovaccum launcher started! cheers!
Remove Postmaster file in "C:\Program Files\PostgreSQL\9.6\data"
and restart the PostgreSQL services
There are different way to open PostgreSql database .
1> One of them is by going windows and select pgAdmin4 or pgAdmin3 depends to version you use and entering password you can access you database .
2> Another one is by terminal :
To able to select from terminal you have to add the path of your installed postgresql by going enviroment variables . To do that got to installed postgresql file and select the path of bin and add to enviroment variable of window setting .
after that you can type in terminal : psql -U postgres -h localhost
Hit enter and it ask you password . After giving password you can create database and tables and can access it .
I was try to solve the problem with Windows Terminal and I've cannot to solve it. Use Windows R + cmd (if you are using Windows) for it work!
The easiest way to enable pg_ctl command is to go to your PostgreSQL directory ~\PostgreSQL\version\bin\ and execute the pg_ctl.exe. Afterwards the pg_ctl commands will be available.