wind icon indicating copy to clipboard operation
wind copied to clipboard

Compatibility issues with PostgreSql?

Open natebenes opened this issue 15 years ago • 7 comments

I can't seem to get wind to play nice with postgres. On the /post/new page the hidden "id" field remains unfilled (null) and so when I click submit, it tries to create a record without a primary key (and fails and throws a 500 error). Any advice on this?

**I'm on PostgreSQL 8.3.

natebenes avatar Sep 16 '10 15:09 natebenes

Realy exists a issue when connects in Postgres. The problem is on set_schema of post model, Sequel schema don't translate columns types to Postgres.

I will work to solve this, but if you discover a solution, please, pull request.

19WAS85 avatar Sep 21 '10 17:09 19WAS85

+1

richardsondx avatar Aug 07 '12 06:08 richardsondx

I think that is the mapping of models (set_schema). Some sequel references uses "String :title" instead of "varchar :title", as is in Wind.

19WAS85 avatar Aug 07 '12 13:08 19WAS85

And about primary key on Postgress, I found this:

primary_key The primary key for the class. Sequel can determine this automatically for many databases, but not all, so you may need to set it manually. If not determined automatically, the default is :id.

http://sequel.rubyforge.org/rdoc/classes/Sequel/Model/ClassMethods.html

19WAS85 avatar Aug 07 '12 13:08 19WAS85

https://gist.github.com/3282515

I tried:

set_schema do
    integer :id
    String :title
    String :text
    datetime :date
    String :link

    set_primary_key :id
end

but it didn't work.

richardsondx avatar Aug 07 '12 14:08 richardsondx

With:

set_schema do
    primary_key :id

Sequel generates a integer column with primary key constraint?

19WAS85 avatar Aug 07 '12 14:08 19WAS85

My schema was like that before it didnt work. Did you see the gist? set_schema do primary_key :id String :title String :text datetime :date String :link end

When I do ;heroku log':

2012-08-07T06:46:04+00:00 app[web.1]: Sequel::DatabaseError - PG::Error: ERROR: invalid input syntax for integer: ""

I'm getting this at each shot.

richardsondx avatar Aug 07 '12 14:08 richardsondx