Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop using spatial_adapter, debug sqlite setup to simplify installation #433

Closed
6 of 7 tasks
jywarren opened this issue Mar 19, 2016 · 5 comments
Closed
6 of 7 tasks
Labels
enhancement explains that the issue is to improve upon one of our existing features help wanted requires help by anyone willing to contribute

Comments

@jywarren
Copy link
Member

and to enable use with sqlite databases

Read up: https://github.com/pdeffendol/spatial_adapter

But we only use it on the geometry column on this line of our schema:

https://github.com/publiclab/plots2/tree/master/db/schema.rb#L52

create_table "content_field_bbox", :id => false, :force => true do |t|                                                                                                        
    t.integer  "vid",                           :default => 0, :null => false                                                                                                   
    t.integer  "nid",                           :default => 0, :null => false                                                                                                   
   t.integer  "delta",                         :default => 0, :null => false                                                                                                   
   t.geometry "field_bbox_geo", :limit => nil                                                                                                                                  
 end

Looking at whether we can just change that to another column type.

We should do this as a new migration instead of changing an old one; checking about removing rake db:migrate from the README.md as a result: bc4bb1d


  • Looks like sqlite requires unique index names; nid is used twice by line 43 of the schema.rb. We should rename the indices uniquely and see if that works.
  • SQLite3::ConstraintException: NOT NULL constraint failed: node_revisions.teaser - remove not null?
  • ActiveRecord::StatementInvalid (SQLite3::BusyException: database is locked: INSERT INTO "rsessions" ("created_at", "data", "session_id", "updated_at") VALUES (?, ?, ?, ?)): hmmm
  • figure out if sqlite is pre-installed on mac os
  • update README.md re: sqlite/mac
  • figure out sqlite group in Gemfile stuff: http://bundler.io/groups.html says bundle install --without production will actually persist in a .bundle file or something...
  • ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: true: SELECT "tag_selections".* FROM "tag_selections" WHERE (tid IN (2,3) AND following = true) (maybe a true vs "true" issue)

Also: remember to squash the commits!

@jywarren jywarren added enhancement explains that the issue is to improve upon one of our existing features help wanted requires help by anyone willing to contribute labels Mar 19, 2016
@jywarren jywarren changed the title stop using spatial_adapter to simplify installation stop using spatial_adapter, debug sqlite setup to simplify installation Mar 19, 2016
@jywarren
Copy link
Member Author

OK, this seems ready to go, pending testing by other devs, or on Cloud9: #438. Closing and addressing any followup in that PR.

@ananyo2012
Copy link
Member

@jywarren Shouldn't we keep spatial_adapter for the time being ? As you mentioned the geometry column in content_field_bbox table uses it. So migrations won't continue. It gives error with rake db:migrate

@jywarren
Copy link
Member Author

Were you running rake db:migrate from a blank database? It should only be
necessary when adding new migrations -- to set up a complete database from
scratch, use rake db:setup.

Note that I dropped the geometry containing table in the sqlite merge. So
you shouldn't get one if you're starting a database from scratch.

@jywarren https://github.com/jywarren Shouldn't we keep spatial_adapter
for the time being ? As you mentioned the geometry column in
content_field_bbox table uses it. So migrations won't continue. It gives
error with rake db:migrate


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#433 (comment)

@ananyo2012
Copy link
Member

@jywarren I did start a new database from scratch in mysql. What I did was

  1. Ran rake db:create
  2. Then I ran rake db:migrate
    It is when I got the error saying undefined method geometry.

@jywarren
Copy link
Member Author

Instead of those two steps, you should run "rake db:setup". It's not usual
to run migrate all the way from scratch when there are lots of migrations.

This makes sense because we did not remove the geometry column from the
migration history, just from the most recent migration. This allows older
databases to manage their state, adding and removing new tables, while
fresh databases just use db:setup to instantiate directly from the final
schema.rb.
On Mar 25, 2016 9:16 AM, "Ananya Maiti" [email protected] wrote:

@jywarren https://github.com/jywarren I did start a new database from
scratch in mysql. What I did was

  1. Ran rake db:create
  2. Then I ran rake db:migrate
    It is when I got the error saying undefined method geometry.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#433 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement explains that the issue is to improve upon one of our existing features help wanted requires help by anyone willing to contribute
Projects
None yet
Development

No branches or pull requests

2 participants