Comments (6)
Ok, I was able to get past the initial connection with this patch to Jennifer::Adapter::Base#connection_string:
module Jennifer
module Adapter
abstract class Base
def connection_string(type : ConnectionType)
URI.new(
self.class.protocol,
config.host,
config.port.try(&.>(0)) ? config.port : nil,
type.db? ? config.db : "",
connection_query,
- config.user,
+ config.user.blank? ? nil : config.user,
config.password && !config.password.empty? ? config.password : nil
).to_s
end
end
end
end
I seem to have run into another issue with creating the migration metadata table:
> ./sam db:setup
beetle_development is already exists
lib/jennifer/src/jennifer/adapter/base.cr:83:9 in 'results'
lib/jennifer/src/jennifer/query_builder/executables.cr:308:9 in 'to_a'
lib/jennifer/src/jennifer/adapter/postgres.cr:143:9 in 'tables_column_count'
lib/jennifer/src/jennifer/adapter/base.cr:54:9 in 'prepare'
lib/jennifer/src/jennifer/adapter/base.cr:40:11 in 'db'
lib/jennifer/src/jennifer/adapter/transactions.cr:19:9 in 'scalar'
lib/jennifer/src/jennifer/adapter/postgres.cr:224:9 in 'exists?'
lib/jennifer/src/jennifer/query_builder/executables.cr:158:9 in 'exists?'
lib/jennifer/src/jennifer/adapter/postgres.cr:160:9 in 'table_exists?'
lib/jennifer/src/jennifer/adapter/base.cr:288:19 in 'ready_to_migrate!'
lib/jennifer/src/jennifer/migration/runner.cr:11:9 in 'migrate'
lib/jennifer/src/jennifer/sam.cr:6:5 in '->'
lib/sam/src/sam/task.cr:56:39 in 'call'
lib/sam/src/sam/execution.cr:19:7 in 'invoke'
lib/sam/src/sam/task.cr:45:29 in 'call'
lib/sam/src/sam/execution.cr:19:7 in 'invoke'
lib/sam/src/sam.cr:38:5 in 'invoke'
lib/sam/src/sam.cr:57:7 in 'process_tasks'
lib/sam/src/sam.cr:42:12 in 'help'
lib/sam/src/sam.cr:75:3 in '->'
/Users/robert/.asdf/installs/crystal/1.11.2/src/crystal/at_exit_handlers.cr:14:19 in 'run'
/Users/robert/.asdf/installs/crystal/1.11.2/src/crystal/main.cr:64:14 in 'exit'
/Users/robert/.asdf/installs/crystal/1.11.2/src/crystal/main.cr:59:5 in 'main'
/Users/robert/.asdf/installs/crystal/1.11.2/src/crystal/main.cr:141:3 in 'main'
Channel is closed.
Original query was:
SELECT "information_schema"."columns"."table_name", COUNT(*) AS count FROM "information_schema"."columns" WHERE "information_schema"."columns"."table_name" IN($1) GROUP BY "information_schema"."columns"."table_name" UNION SELECT "pg_class"."relname" AS "table_name", COUNT(*) AS count FROM "pg_attribute" JOIN "pg_class" ON "pg_attribute"."attrelid" = "pg_class"."oid"
JOIN "pg_namespace" ON "pg_namespace"."oid" = "pg_class"."relnamespace"
WHERE "pg_attribute"."attnum" > $2 AND "pg_namespace"."nspname" = $3 AND "pg_class"."relname" IN($4) AND NOT ("pg_attribute"."attisdropped") GROUP BY table_name | ["migration_versions", 0, "public", "migration_versions"]
Original query was:
SELECT EXISTS(SELECT 1 FROM "information_schema"."tables" WHERE "information_schema"."tables"."table_name" = $1 ) | ["migration_versions"]
Both of those queries execute fine in a local postgres shell. No results are returned. Since the message is "Channel is closed" I don't think I believe that it's a query problem anyway.
from jennifer.cr.
I spent some time collaborating with @crimson-knight on this, and he suggested just bypassing the migrations and creating the tables manually for now, which got me up and running.
Having done that, I'm able to run a full CRUD on my tables. I don't know what the problem is with the receive channel, but I'm able to move forward without issue by just managing the schema myself.
from jennifer.cr.
I'm having the same issue where trying to run databases without specifying a user and a password in the config doesn't work.
Just setting them up makes everything works fine but it means the database.yml
file needs to be gitignored to avoid sharing credentials (unless there's a way to pass a ENV in the config file that I'm not aware of ?)
It would be nice if I could just use whoami and omit the password like Rob suggested
from jennifer.cr.
the fix was merged into the master branch (but hasn't been release yet). Please take a look did it address your use case
from jennifer.cr.
It finds my username
now but it still requires a password apparently
➜ kemal git:(master) ✗ sam db:create
Password for user joenn:
lib/jennifer/src/jennifer/adapter/command_shell/i_command_shell.cr:19:9 in 'invoke'
lib/jennifer/src/jennifer/adapter/command_shell/bash.cr:14:9 in 'execute'
lib/jennifer/src/jennifer/adapter/db_command_interface.cr:24:9 in 'execute'
lib/jennifer/src/jennifer/adapter/postgres/command_interface.cr:33:9 in 'database_exists?'
lib/jennifer/src/jennifer/adapter/base.cr:236:9 in 'database_exists?'
lib/jennifer/src/jennifer/migration/runner.cr:35:12 in 'create'
lib/jennifer/src/jennifer/sam.cr:36:5 in '->'
lib/sam/src/sam/task.cr:56:39 in 'call'
lib/sam/src/sam/execution.cr:19:7 in 'invoke'
lib/sam/src/sam.cr:38:5 in 'invoke'
lib/sam/src/sam.cr:57:7 in 'process_tasks'
lib/sam/src/sam.cr:42:12 in 'help'
sam.cr:15:1 in '__crystal_main'
/home/joenn/.asdf/installs/crystal/1.11.2/share/crystal/src/crystal/main.cr:129:5 in 'main_user_code'
/home/joenn/.asdf/installs/crystal/1.11.2/share/crystal/src/crystal/main.cr:115:7 in 'main'
/home/joenn/.asdf/installs/crystal/1.11.2/share/crystal/src/crystal/main.cr:141:3 in 'main'
/lib/x86_64-linux-gnu/libc.so.6 in '??'
/lib/x86_64-linux-gnu/libc.so.6 in '__libc_start_main'
/home/joenn/.cache/crystal/crystal-run-sam.tmp in '_start'
???
DB command interface exit code 2: psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: fe_sendauth: no password supplied
When I try to enter an empty password I get a no password supplied
error
from jennifer.cr.
Hi @wJoenn. Please checkout a branch with a fix and try it out with your setup. @robacarp if it possible please double check that my adjustments work correctly for you as well
from jennifer.cr.
Related Issues (20)
- JSON columns with array values being updated is not recognized as "changed" & does not save HOT 3
- Password digest not created when using with_authentication directly via model build HOT 2
- Shard "inflector" version (0.1.8) doesn't match tag version (1.0.0)
- Empty seed task HOT 1
- Executing raw SQL directly through the connection HOT 5
- Feature parity/comparison for ActiveRecord enum types HOT 10
- `load_dependencies "jennifer"` issue with Jennifer::QueryBuilder::Condition error HOT 4
- Slow performance when creating new records HOT 7
- PCRE2 compatibility HOT 1
- How i run a migrate without using sam? HOT 3
- How to configure database connection? HOT 3
- Column can't be casted from JSON::PullParser to it's type - (JSON::Any | Nil) HOT 2
- Error: expected argument #1 to 'Log#level=' to be Log::Severity, not Symbol HOT 2
- Unable to silence logs with crystal builtin Log.setup {} pattern HOT 1
- There was a problem expanding macro 'common_mapping' HOT 2
- Add colour to logs HOT 4
- Migrations are not being run when running specs HOT 3
- Jennifer.cr is broken '-- Task not found.' HOT 2
- Severity cannot be changed based on environment once `master` branch HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jennifer.cr.