GithubHelp home page GithubHelp logo

Comments (11)

nbulaj avatar nbulaj commented on June 30, 2024 1

@gencer yep, now I know what the root of the problem and I'm gonna find a way how to fix it.

Currently you can comment orm option in Doorkeeper initializer and generator will pass.

from doorkeeper-sequel.

nbulaj avatar nbulaj commented on June 30, 2024 1

@gencer I refactored generators code so now you can use another commands for migrations: rake doorkeeper_sequel:generate:migration for main migration and so on (see docs).

Previous version was based on Rails Generators that load all the application code (doorkeeper initializer, Sequel ORM), so Sequel models can't be initialized without real database tables (frozen datasets, remember?) and raises an error.

from doorkeeper-sequel.

nbulaj avatar nbulaj commented on June 30, 2024 1

Ah, it' a problem with Sequel Model get_db_schema.. Ok, I've get it. I will try to research how to make models lazy loadable. Thanks!

from doorkeeper-sequel.

gencer avatar gencer commented on June 30, 2024

Full backtrace (hope it helps):

/usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:145:in `async_exec': PG::UndefinedTable: ERROR:  relation "oauth_access_grants" does not exist (Sequel::DatabaseError)
LINE 1: SELECT * FROM "oauth_access_grants" LIMIT 1
                      ^
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:145:in `block in execute_query'
	from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/sequel-rails-402466ff6fad/lib/sequel_rails/sequel/database/active_support_notification.rb:17:in `block in log_connection_yield'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/notifications.rb:168:in `block in instrument'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/notifications.rb:168:in `instrument'
	from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/sequel-rails-402466ff6fad/lib/sequel_rails/sequel/database/active_support_notification.rb:11:in `log_connection_yield'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:145:in `execute_query'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:133:in `block in execute'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:109:in `check_disconnect_errors'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:133:in `execute'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:449:in `_execute'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:273:in `block (2 levels) in execute'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:471:in `check_database_errors'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:273:in `block in execute'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/database/connecting.rb:264:in `block in synchronize'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/connection_pool/threaded.rb:87:in `hold'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/database/connecting.rb:264:in `synchronize'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:273:in `execute'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/dataset/actions.rb:1085:in `execute'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/adapters/postgres.rb:563:in `fetch_rows'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/dataset/actions.rb:151:in `each'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel_pg-1.8.0/lib/sequel_pg/sequel_pg.rb:79:in `each'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/dataset/actions.rb:85:in `columns!'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/dataset/actions.rb:75:in `columns'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/model/base.rb:242:in `columns'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/model/base.rb:802:in `block (2 levels) in get_db_schema'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/model/base.rb:718:in `block in check_non_connection_error'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/database/transactions.rb:151:in `block in transaction'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/database/connecting.rb:264:in `block in synchronize'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/connection_pool/threaded.rb:91:in `hold'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/database/connecting.rb:264:in `synchronize'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/database/transactions.rb:145:in `transaction'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/model/base.rb:718:in `check_non_connection_error'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/model/base.rb:802:in `block in get_db_schema'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/model/base.rb:835:in `get_db_schema'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/model/base.rb:637:in `set_dataset'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/model/base.rb:192:in `Model'
	from /usr/local/lib/ruby/gems/2.4.0/gems/sequel-5.3.0/lib/sequel/model/base.rb:140:in `block in def_Model'
	from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/doorkeeper-sequel-db92c62c506e/lib/doorkeeper/orm/sequel/access_grant.rb:4:in `<module:Doorkeeper>'
	from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/doorkeeper-sequel-db92c62c506e/lib/doorkeeper/orm/sequel/access_grant.rb:3:in `<main>'
	from /usr/local/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
	from /usr/local/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:283:in `block in require'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:249:in `load_dependency'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:283:in `require'
	from /usr/local/lib/ruby/gems/2.4.0/bundler/gems/doorkeeper-sequel-db92c62c506e/lib/doorkeeper/orm/sequel.rb:6:in `initialize_models!'
	from /usr/local/lib/ruby/gems/2.4.0/gems/doorkeeper-4.2.6/lib/doorkeeper/config.rb:34:in `setup_orm_models'
	from /usr/local/lib/ruby/gems/2.4.0/gems/doorkeeper-4.2.6/lib/doorkeeper/config.rb:13:in `configure'
	from /disk5/www/applika/endpoint/config/initializers/doorkeeper.rb:1:in `<main>'
	from /usr/local/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
	from /usr/local/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:277:in `block in load'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:249:in `load_dependency'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/dependencies.rb:277:in `load'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:657:in `block in load_config_initializer'
	from /usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0.beta2/lib/active_support/notifications.rb:170:in `instrument'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:656:in `load_config_initializer'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:613:in `each'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/engine.rb:613:in `block in <class:Engine>'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:32:in `instance_exec'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:32:in `run'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:50:in `each'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:50:in `tsort_each_child'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `call'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `call'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/initializable.rb:60:in `run_initializers'
	from /usr/local/lib/ruby/gems/2.4.0/gems/railties-5.2.0.beta2/lib/rails/application.rb:360:in `initialize!'
	from /disk5/www/applika/endpoint/config/environment.rb:5:in `<top (required)>'
	from config.ru:3:in `require_relative'
	from config.ru:3:in `block in <main>'
	from /usr/local/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
	from /usr/local/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
	from config.ru:in `new'
	from config.ru:in `<main>'
	from /usr/local/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
	from /usr/local/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
	from /usr/local/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/configuration.rb:318:in `load_rackup'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/configuration.rb:243:in `app'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/runner.rb:148:in `app'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/runner.rb:155:in `start_server'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/cluster.rb:262:in `worker'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/cluster.rb:126:in `block (2 levels) in spawn_workers'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/cluster.rb:126:in `fork'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/cluster.rb:126:in `block in spawn_workers'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/cluster.rb:122:in `times'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/cluster.rb:122:in `spawn_workers'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/cluster.rb:453:in `run'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/launcher.rb:183:in `run'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/lib/puma/cli.rb:77:in `run'
	from /usr/local/lib/ruby/gems/2.4.0/gems/puma-3.11.0/bin/puma-wild:31:in `<main>'

from doorkeeper-sequel.

gencer avatar gencer commented on June 30, 2024

@nbulaj, Thank you the quick fix. Migration generator works, however, there is still one more issue.

Let me explain in order:

  • run doorkeeper:install to generate views and initializer.
  • set :orm to 'sequel'
  • run migration generators (works like a charm)
  • now run db:migrate and you will get error message that says oauth_access_grants table does not exists.

When I try to execute migrations against database, doorkeeper again trying to look for table that doesn't exists yet.

Also last migration rake doorkeeper_sequel:generate:previous_refresh_token is unnecessary. That field already exists on one previous migration. So migration says that field already exists.

from doorkeeper-sequel.

gencer avatar gencer commented on June 30, 2024

@nbulaj, I'm so glad and thankful for your help on this issue. I will closely watch this repo, so I can test on every commit you made and report back to you. ;)

BTW, Is there any channel or something that I can join and ask a question about doorkeeper-sequel and grape-oauth2 gems that maintained by you? I have a really one strict problem with them on my project. (I tried and injected both gems one by one to my project)

from doorkeeper-sequel.

nbulaj avatar nbulaj commented on June 30, 2024

One more question: what gem stack do you use? Sequel 5, sequel-rails? What more (maybe provide your Gemfile.lock with GitHub Gist)?

There are the same problems even for [sequel-rails project](Sequel deprecation warning creating session migration). Possible way to fix this is to use require_valid_table = false for OAuth models, but it's a bit tricky I think..

from doorkeeper-sequel.

gencer avatar gencer commented on June 30, 2024

I am using sequel-rails with sequel5.

Here is my gist: https://gist.github.com/gencer/fa3d47d3854347aceb84ddc040335a02

Also kindly awaiting a reply if possible on my other question if you have any slack and/or google groups for my a very basic "concept" question to understand those gems better, so i can continue confidently.

from doorkeeper-sequel.

gencer avatar gencer commented on June 30, 2024

Correction: https://gist.github.com/gencer/4bea62136a28e6a384f2d265a6472c43

I was mistakenly upload Gemfile but not lockfile.

from doorkeeper-sequel.

nbulaj avatar nbulaj commented on June 30, 2024

Hi @gencer . Checkout this branch:

gem 'doorkeeper-sequel', git: 'https://github.com/nbulaj/doorkeeper-sequel.git', branch: 'sequel_fix'

I checked it with brand new Rails 5.2 + Sequel 5 + Sequel-Rails and it works (rake db:create, rake db:migrate, rails c -> Doorkeeper::Application.create).

What about Slack or any other chat - sorry, but it is just a small extension for Doorkeeper, so there are no special method of contact :) But you can contact me via email if you need (bulajnikita [at] gmail.com)

from doorkeeper-sequel.

gencer avatar gencer commented on June 30, 2024

@nbulaj, Due to issues, I was unable to test until now. It just works as expected. I think this solution (making valid_tables false and true after init) will work without any problem.

Thank you for your help & efforts.

from doorkeeper-sequel.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.