Postgres is set up locally but runs on port 5432 by default, which will interfere with Cloud SQL. If you're not using Cloud SQL you can ignore the steps below.
sed -i 's/#port = 5432/port = 5433/' .idx/.data/postgres/postgresql.confOpen the Command Palette CMD/CTRL+SHIFT+P and type Project IDX: Rebuild Environment. Hit enter.
node --env-file=.env.local index.jsNote: Billing must be enabled to use Cloud SQL.
gcloud auth application-default logingcloud config set project <project-id>Note: You may need to enable the SQL Admin API. However, it will prompt you to do and continue the instance creation.
gcloud sql instances create cloud \
--database-version=POSTGRES_15 --cpu=2 --memory=4GB \
--region=us-central1 --root-password=something-securegcloud sql users create main --instance cloud --password a-secure-password --host=%DB_USER="main"
DB_PASSWORD="a-secure-password"
DB_NAME="postgres"
DB_INSTANCE_NAME="<project-id>:us-central1:cloud"
MODE="cloud-connected"
Open up a new terminal:
source .env.cloud
cloud-sql-proxy $DB_INSTANCE_NAMEOpen up another terminal:
source .env.cloud
psql "host=127.0.0.1 port=5432 sslmode=disable dbname=$DB_NAME user=$DB_USER password=$DB_PASSWORD" -f create.sqlnode --env-file=.env.cloud index.js