From 78723cb09de9812aadbabf997ea0562e0f64086b Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 13 Sep 2023 14:57:25 +0200 Subject: [PATCH 01/33] feat: add skeleton datasource toolkit gem --- .../.gitignore | 11 ++++++ .../forest_admin_datasource_toolkit/.rspec | 3 ++ .../.rubocop.yml | 13 +++++++ .../forest_admin_datasource_toolkit/Gemfile | 12 ++++++ .../forest_admin_datasource_toolkit/README.md | 31 +++++++++++++++ .../forest_admin_datasource_toolkit/Rakefile | 12 ++++++ .../bin/console | 11 ++++++ .../forest_admin_datasource_toolkit/bin/setup | 8 ++++ .../forest_admin_datasource_toolkit.gemspec | 39 +++++++++++++++++++ .../lib/forest_admin_datasource_toolkit.rb | 6 +++ .../version.rb | 5 +++ .../forest_admin_datasource_toolkit_spec.rb | 11 ++++++ .../spec/spec_helper.rb | 15 +++++++ 13 files changed, 177 insertions(+) create mode 100644 packages/forest_admin_datasource_toolkit/.gitignore create mode 100644 packages/forest_admin_datasource_toolkit/.rspec create mode 100644 packages/forest_admin_datasource_toolkit/.rubocop.yml create mode 100644 packages/forest_admin_datasource_toolkit/Gemfile create mode 100644 packages/forest_admin_datasource_toolkit/README.md create mode 100644 packages/forest_admin_datasource_toolkit/Rakefile create mode 100755 packages/forest_admin_datasource_toolkit/bin/console create mode 100755 packages/forest_admin_datasource_toolkit/bin/setup create mode 100644 packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec create mode 100644 packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb create mode 100644 packages/forest_admin_datasource_toolkit/spec/forest_admin_datasource_toolkit_spec.rb create mode 100644 packages/forest_admin_datasource_toolkit/spec/spec_helper.rb diff --git a/packages/forest_admin_datasource_toolkit/.gitignore b/packages/forest_admin_datasource_toolkit/.gitignore new file mode 100644 index 000000000..b04a8c840 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/.gitignore @@ -0,0 +1,11 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ + +# rspec failure tracking +.rspec_status diff --git a/packages/forest_admin_datasource_toolkit/.rspec b/packages/forest_admin_datasource_toolkit/.rspec new file mode 100644 index 000000000..34c5164d9 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/packages/forest_admin_datasource_toolkit/.rubocop.yml b/packages/forest_admin_datasource_toolkit/.rubocop.yml new file mode 100644 index 000000000..e3462a749 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/.rubocop.yml @@ -0,0 +1,13 @@ +AllCops: + TargetRubyVersion: 2.6 + +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + +Style/StringLiteralsInInterpolation: + Enabled: true + EnforcedStyle: double_quotes + +Layout/LineLength: + Max: 120 diff --git a/packages/forest_admin_datasource_toolkit/Gemfile b/packages/forest_admin_datasource_toolkit/Gemfile new file mode 100644 index 000000000..3ecf7ceaf --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/Gemfile @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in forest_admin_datasource_toolkit.gemspec +gemspec + +gem "rake", "~> 13.0" + +gem "rspec", "~> 3.0" + +gem "rubocop", "~> 1.21" diff --git a/packages/forest_admin_datasource_toolkit/README.md b/packages/forest_admin_datasource_toolkit/README.md new file mode 100644 index 000000000..6fe50bcbe --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/README.md @@ -0,0 +1,31 @@ +# ForestAdminDatasourceToolkit + +TODO: Delete this and the text below, and describe your gem + +Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/forest_admin_datasource_toolkit`. To experiment with that code, run `bin/console` for an interactive prompt. + +## Installation + +TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. + +Install the gem and add to the application's Gemfile by executing: + + $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +If bundler is not being used to manage dependencies, install the gem by executing: + + $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. + +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/forest_admin_datasource_toolkit. diff --git a/packages/forest_admin_datasource_toolkit/Rakefile b/packages/forest_admin_datasource_toolkit/Rakefile new file mode 100644 index 000000000..cca717544 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/Rakefile @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +RSpec::Core::RakeTask.new(:spec) + +require "rubocop/rake_task" + +RuboCop::RakeTask.new + +task default: %i[spec rubocop] diff --git a/packages/forest_admin_datasource_toolkit/bin/console b/packages/forest_admin_datasource_toolkit/bin/console new file mode 100755 index 000000000..105e360de --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/bin/console @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "forest_admin_datasource_toolkit" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +require "irb" +IRB.start(__FILE__) diff --git a/packages/forest_admin_datasource_toolkit/bin/setup b/packages/forest_admin_datasource_toolkit/bin/setup new file mode 100755 index 000000000..dce67d860 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec b/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec new file mode 100644 index 000000000..89dbdd7ea --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require_relative "lib/forest_admin_datasource_toolkit/version" + +Gem::Specification.new do |spec| + spec.name = "forest_admin_datasource_toolkit" + spec.version = ForestAdminDatasourceToolkit::VERSION + spec.authors = ["Nicolas Alexandre"] + spec.email = ["nicolasalexandre9@gmail.com"] + + spec.summary = "TODO: Write a short summary, because RubyGems requires one." + spec.description = "TODO: Write a longer description or delete this line." + spec.homepage = "TODO: Put your gem's website or public repo URL here." + spec.required_ruby_version = ">= 2.6.0" + + spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." + spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." + + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |f| + (File.expand_path(f) == __FILE__) || + f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile]) + end + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + # Uncomment to register a new dependency of your gem + # spec.add_dependency "example-gem", "~> 1.0" + + # For more information and examples about making a new gem, check out our + # guide at: https://bundler.io/guides/creating_gem.html +end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb new file mode 100644 index 000000000..9d10087b1 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb @@ -0,0 +1,6 @@ +require_relative "forest_admin_datasource_toolkit/version" + +module ForestAdminDatasourceToolkit + class Error < StandardError; end + # Your code goes here... +end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb new file mode 100644 index 000000000..5bd76138b --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module ForestAdminDatasourceToolkit + VERSION = "0.1.0" +end diff --git a/packages/forest_admin_datasource_toolkit/spec/forest_admin_datasource_toolkit_spec.rb b/packages/forest_admin_datasource_toolkit/spec/forest_admin_datasource_toolkit_spec.rb new file mode 100644 index 000000000..13b615184 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/forest_admin_datasource_toolkit_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe ForestAdminDatasourceToolkit do + it "has a version number" do + expect(ForestAdminDatasourceToolkit::VERSION).not_to be nil + end + + it "does something useful" do + expect(false).to eq(true) + end +end diff --git a/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb b/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb new file mode 100644 index 000000000..0841ff3df --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "forest_admin_datasource_toolkit" + +RSpec.configure do |config| + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" + + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end From 9fa5b0396efae7ff0c72c56a4b2f5497af7a1212 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 13 Sep 2023 14:58:14 +0200 Subject: [PATCH 02/33] chore: update rubocop config --- .rubocop.yml | 13 ++++++++- .../.rubocop.yml | 13 --------- .../forest_admin_datasource_toolkit/Gemfile | 2 -- .../forest_admin_datasource_toolkit.gemspec | 29 ++++++++++--------- 4 files changed, 27 insertions(+), 30 deletions(-) delete mode 100644 packages/forest_admin_datasource_toolkit/.rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml index a94e31595..0dbb11283 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -10,13 +10,15 @@ Gemspec/OrderedDependencies: Exclude: - 'packages/forest_admin_agent/forest_admin_agent.gemspec' - 'packages/forest_admin_rails/forest_admin_rails.gemspec' - - 'forest_admin_rails.gemspec' + - 'packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Lint/PercentStringArray: Exclude: - 'packages/forest_admin_agent/forest_admin_agent.gemspec' + - 'packages/forest_admin_rails/forest_admin_rails.gemspec' + - 'packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec' # Offense count: 1 # Configuration parameters: AllowComments. @@ -43,6 +45,7 @@ Style/BlockComments: Exclude: - 'packages/forest_admin_agent/spec/spec_helper.rb' - 'packages/forest_admin_rails/spec/spec_helper.rb' + - 'packages/forest_admin_datasource_toolkit/spec/spec_helper.rb' # Offense count: 3 # Configuration parameters: AllowedConstants. @@ -65,6 +68,7 @@ Style/MutableConstant: - 'lib/agent_ruby/version.rb' - 'packages/forest_admin_agent/lib/forest_admin_agent/version.rb' - 'packages/forest_admin_rails/lib/forest_admin_rails/version.rb' + - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb' # Offense count: 38 # This cop supports safe autocorrection (--autocorrect). @@ -95,6 +99,13 @@ Style/StringLiterals: - 'packages/forest_admin_rails/lib/forest_admin_rails/version.rb' - 'packages/forest_admin_rails/spec/rails_helper.rb' - 'packages/forest_admin_rails/spec/spec_helper.rb' + - 'packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec' + - 'packages/forest_admin_datasource_toolkit/Gemfile' + - 'packages/forest_admin_datasource_toolkit/Rakefile' + - 'packages/forest_admin_datasource_toolkit/bin/console' + - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb' + - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb' + - 'packages/forest_admin_datasource_toolkit/spec/spec_helper.rb' # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). diff --git a/packages/forest_admin_datasource_toolkit/.rubocop.yml b/packages/forest_admin_datasource_toolkit/.rubocop.yml deleted file mode 100644 index e3462a749..000000000 --- a/packages/forest_admin_datasource_toolkit/.rubocop.yml +++ /dev/null @@ -1,13 +0,0 @@ -AllCops: - TargetRubyVersion: 2.6 - -Style/StringLiterals: - Enabled: true - EnforcedStyle: double_quotes - -Style/StringLiteralsInInterpolation: - Enabled: true - EnforcedStyle: double_quotes - -Layout/LineLength: - Max: 120 diff --git a/packages/forest_admin_datasource_toolkit/Gemfile b/packages/forest_admin_datasource_toolkit/Gemfile index 3ecf7ceaf..7648e5c10 100644 --- a/packages/forest_admin_datasource_toolkit/Gemfile +++ b/packages/forest_admin_datasource_toolkit/Gemfile @@ -1,5 +1,3 @@ -# frozen_string_literal: true - source "https://rubygems.org" # Specify your gem's dependencies in forest_admin_datasource_toolkit.gemspec diff --git a/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec b/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec index 89dbdd7ea..84896def2 100644 --- a/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec +++ b/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec @@ -1,23 +1,24 @@ -# frozen_string_literal: true +lib = File.expand_path('lib', __dir__) +$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) require_relative "lib/forest_admin_datasource_toolkit/version" Gem::Specification.new do |spec| - spec.name = "forest_admin_datasource_toolkit" - spec.version = ForestAdminDatasourceToolkit::VERSION - spec.authors = ["Nicolas Alexandre"] - spec.email = ["nicolasalexandre9@gmail.com"] - - spec.summary = "TODO: Write a short summary, because RubyGems requires one." - spec.description = "TODO: Write a longer description or delete this line." - spec.homepage = "TODO: Put your gem's website or public repo URL here." - spec.required_ruby_version = ">= 2.6.0" - - spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" + spec.name = "forest_admin_datasource_toolkit" + spec.version = ForestAdminDatasourceToolkit::VERSION + spec.authors = ["Matthieu", "Nicolas"] + spec.email = ["matthv@gmail.com", "nicolasalexandre9@gmail.com"] + spec.homepage = "https://www.forestadmin.com" + spec.summary = "Ruby agent for Forest Admin." + spec.description = "Forest is a modern admin interface that works on all major web frameworks. This gem makes Forest +admin work on any Ruby application." + spec.license = "MIT" + spec.required_ruby_version = ">= 3.0.0" spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." - spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." + spec.metadata["source_code_uri"] = "https://github.com/ForestAdmin/agent-ruby" + spec.metadata["changelog_uri"] = "https://github.com/ForestAdmin/agent-ruby/CHANGELOG.md" + spec.metadata["rubygems_mfa_required"] = "true" # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. From 97b27adf58d078e412b8b02c6e1ba589cd2a6832 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 13 Sep 2023 14:59:29 +0200 Subject: [PATCH 03/33] chore: lint test --- .../spec/forest_admin_datasource_toolkit_spec.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/forest_admin_datasource_toolkit/spec/forest_admin_datasource_toolkit_spec.rb b/packages/forest_admin_datasource_toolkit/spec/forest_admin_datasource_toolkit_spec.rb index 13b615184..513cefe4f 100644 --- a/packages/forest_admin_datasource_toolkit/spec/forest_admin_datasource_toolkit_spec.rb +++ b/packages/forest_admin_datasource_toolkit/spec/forest_admin_datasource_toolkit_spec.rb @@ -1,11 +1,5 @@ -# frozen_string_literal: true - RSpec.describe ForestAdminDatasourceToolkit do - it "has a version number" do - expect(ForestAdminDatasourceToolkit::VERSION).not_to be nil - end - - it "does something useful" do - expect(false).to eq(true) + it 'has a version number' do + expect(ForestAdminDatasourceToolkit::VERSION).not_to be_nil end end From 8c651b51a7cb05d18b9d1ddb9719bafe5ef6b3d1 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Thu, 14 Sep 2023 10:17:28 +0200 Subject: [PATCH 04/33] feat: add forest exception --- .../lib/Exceptions/forest_exception.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb b/packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb new file mode 100644 index 000000000..5fe23a740 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb @@ -0,0 +1,10 @@ +module ForestAdminDatasourceToolkit + module Exception + class ForestException < RuntimeError + def initialize(msg = '') + msg = "🌳🌳🌳 #{msg}" + super msg + end + end + end +end From 054d4bae6530dc302b01aca975691310123f80de Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Thu, 14 Sep 2023 10:37:55 +0200 Subject: [PATCH 05/33] feat: add datasource and collection interface --- .rubocop.yml | 4 ++ .../contracts/collection_contract.rb | 51 +++++++++++++++++++ .../contracts/datasource_contract.rb | 27 ++++++++++ .../sig/forest_admin_datasource_toolkit.rbs | 4 ++ .../contracts/collection_contract.rbs | 29 +++++++++++ .../contracts/datasource_contract.rbs | 17 +++++++ 6 files changed, 132 insertions(+) create mode 100644 packages/forest_admin_datasource_toolkit/lib/components/contracts/collection_contract.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/components/contracts/datasource_contract.rb create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit.rbs create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/components/contracts/collection_contract.rbs create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rbs diff --git a/.rubocop.yml b/.rubocop.yml index 0dbb11283..41f93fb15 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -123,6 +123,10 @@ Style/RedundantConstantBase: Exclude: - 'packages/forest_admin_rails/spec/rails_helper.rb' +Naming/PredicateName: + Exclude: + - 'packages/forest_admin_datasource_toolkit/lib/collection.rb' + Layout/LineLength: Max: 120 diff --git a/packages/forest_admin_datasource_toolkit/lib/components/contracts/collection_contract.rb b/packages/forest_admin_datasource_toolkit/lib/components/contracts/collection_contract.rb new file mode 100644 index 000000000..b69c01e7c --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/components/contracts/collection_contract.rb @@ -0,0 +1,51 @@ +module ForestAdminDatasourceToolkit + module Components + module Contracts + class CollectionContract + def datasource + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def schema + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def name + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def execute + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def form + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def create + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def list + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def update + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def delete + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def aggregate + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def render_chart + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/components/contracts/datasource_contract.rb b/packages/forest_admin_datasource_toolkit/lib/components/contracts/datasource_contract.rb new file mode 100644 index 000000000..91e0e66b4 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/components/contracts/datasource_contract.rb @@ -0,0 +1,27 @@ +module ForestAdminDatasourceToolkit + module Components + module Contracts + class DatasourceContract + def collections + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def charts + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def collection(name) + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def add_collection(collection) + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + + def render_chart(caller, name) + raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'" + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit.rbs new file mode 100644 index 000000000..8410c1789 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit.rbs @@ -0,0 +1,4 @@ +module ForestAdminDatasourceToolkit + VERSION: String + # See the writing guide of rbs: https://github.com/ruby/rbs#guides +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/components/contracts/collection_contract.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/components/contracts/collection_contract.rbs new file mode 100644 index 000000000..a89888389 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/components/contracts/collection_contract.rbs @@ -0,0 +1,29 @@ +module ForestAdminDatasourceToolkit + module Components + module Contracts + class CollectionContract + def aggregate: -> untyped + + def create: -> untyped + + def datasource: -> untyped + + def delete: -> untyped + + def execute: -> untyped + + def form: -> untyped + + def list: -> untyped + + def name: -> untyped + + def render_chart: -> untyped + + def schema: -> untyped + + def update: -> untyped + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rbs new file mode 100644 index 000000000..1bb5c7d3d --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rbs @@ -0,0 +1,17 @@ +module ForestAdminDatasourceToolkit + module Components + module Contracts + module DatasourceContract + def add_collection:(CollectionContract collection) -> untyped + + def charts: -> untyped + + def collection:(string name) -> untyped + + def collections: -> untyped + + def render_chart:(untyped caller, string name) -> untyped + end + end + end +end From 925e9aeba7e4eb19fec8e67020d9e4cf16418dc1 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Thu, 14 Sep 2023 10:38:21 +0200 Subject: [PATCH 06/33] feat: add base datasource and base collection --- .../lib/Exceptions/forest_exception.rb | 2 +- .../lib/collection.rb | 54 +++++++++++++++++++ .../lib/datasource.rb | 29 ++++++++++ .../collection.rbs | 26 +++++++++ .../datasource.rbs | 12 +++++ 5 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 packages/forest_admin_datasource_toolkit/lib/collection.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/datasource.rb create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/collection.rbs create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/datasource.rbs diff --git a/packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb b/packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb index 5fe23a740..861b2039e 100644 --- a/packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb +++ b/packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb @@ -1,5 +1,5 @@ module ForestAdminDatasourceToolkit - module Exception + module Exceptions class ForestException < RuntimeError def initialize(msg = '') msg = "🌳🌳🌳 #{msg}" diff --git a/packages/forest_admin_datasource_toolkit/lib/collection.rb b/packages/forest_admin_datasource_toolkit/lib/collection.rb new file mode 100644 index 000000000..511e57cf3 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/collection.rb @@ -0,0 +1,54 @@ +module ForestAdminDatasourceToolkit + class Collection < Components::Contracts::CollectionContract + attr_accessor :fields, :segments + + attr_reader :actions, + :charts, + :datasource, + :name, + :schema, + :native_driver + + attr_writer :searchable, + :countable + + @schema = {} + @fields = {} + @actions = {} + @segments = {} + @charts = {} + @searchable = false + @countable = false + + def initialize( + datasource, + name, + native_driver = nil + ) + super + @datasource = datasource + @name = name + @native_driver = native_driver + end + + def is_countable? + @countable + end + + def is_searchable? + @searchable + end + + def add_field(name, field) + raise Exceptions::ForestException, "Field #{name} already defined in collection" if @fields.key? name + + @fields[name] = field + end + + def add_fields(fields) + fields.each do |name, field| + add_field(name, field) + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/datasource.rb b/packages/forest_admin_datasource_toolkit/lib/datasource.rb new file mode 100644 index 000000000..a357209e7 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/datasource.rb @@ -0,0 +1,29 @@ +module ForestAdminDatasourceToolkit + class Datasource < Components::Contracts::DatasourceContract + attr_reader :collections, :charts + + def initialize + super + @charts = {} + @collections = {} + end + + def collection(name) + raise Exceptions::ForestException, "Collection #{name} not found." unless @collections.key? name + + @collections[name] + end + + def add_collection(collection) + if @collections.key? collection.name + raise Exceptions::ForestException, "Collection #{collection.name} already defined in datasource" + end + + @collections[collection.name] = collection + end + + def render_chart(_caller, name) + raise Exceptions::ForestException, "No chart named #{name} exists on this datasource." + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/collection.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/collection.rbs new file mode 100644 index 000000000..806e791c0 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/collection.rbs @@ -0,0 +1,26 @@ +module ForestAdminDatasourceToolkit + class Collection + attr_reader actions: Hash[string, string] + attr_reader charts: Hash[string, string] + attr_writer countable: bool + attr_reader datasource: Components::Contracts::DatasourceContract + attr_reader fields: Hash[string, string] + attr_writer fields: void + attr_reader name: string + attr_reader native_driver: untyped | nil + attr_reader schema: Hash[string, string] + attr_writer searchable: bool + attr_reader segments: Hash[string, string] + attr_writer segments: void + + # replace untyped by ColumnSchema|RelationSchema + def add_field: (string, untyped) -> void + + # replace untyped by ColumnSchema|RelationSchema + def add_fields:(Hash[string, untyped]) -> void + + def is_countable?: -> bool + + def is_searchable?: -> bool + end +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/datasource.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/datasource.rbs new file mode 100644 index 000000000..9a03c9ed3 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/datasource.rbs @@ -0,0 +1,12 @@ +module ForestAdminDatasourceToolkit + class Datasource + @charts: Hash[string, string] + @collections: Hash[string, string] + + def add_collection:(Components::Contracts::CollectionContract collection) -> void + + def collection:(string name) -> Components::Contracts::CollectionContract + + def render_chart:(untyped caller, string name) -> untyped + end +end From 1e90fddd64b81a6a5631157d6627765794a183f3 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Thu, 14 Sep 2023 14:53:23 +0200 Subject: [PATCH 07/33] feat(schema): add column schema and relations schema --- .rubocop.yml | 5 +++ .../Schema/Relations/many_relation_schema.rb | 18 ++++++++++ .../Schema/Relations/many_to_many_schema.rb | 24 +++++++++++++ .../Schema/Relations/one_to_many_schema.rb | 13 +++++++ .../lib/Schema/Relations/one_to_one_schema.rb | 13 +++++++ .../Relations/single_relation_schema.rb | 18 ++++++++++ .../lib/Schema/column_schema.rb | 34 +++++++++++++++++++ .../lib/Schema/relation_schema.rb | 15 ++++++++ .../schema/column_schema.rbs | 15 ++++++++ .../schema/relation_schema.rbs | 8 +++++ .../schema/relations/many_relation_schema.rbs | 10 ++++++ .../schema/relations/many_to_many_schema.rbs | 11 ++++++ .../relations/single_relation_schema.rbs | 10 ++++++ 13 files changed, 194 insertions(+) create mode 100644 packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_relation_schema.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_to_many_schema.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_many_schema.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_one_schema.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/Schema/Relations/single_relation_schema.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/Schema/column_schema.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/Schema/relation_schema.rb create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/column_schema.rbs create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relation_schema.rbs create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/many_relation_schema.rbs create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rbs create mode 100644 packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/single_relation_schema.rbs diff --git a/.rubocop.yml b/.rubocop.yml index 41f93fb15..64e689941 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -127,6 +127,11 @@ Naming/PredicateName: Exclude: - 'packages/forest_admin_datasource_toolkit/lib/collection.rb' +Metrics/ParameterLists: + Exclude: + - 'packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_to_many_schema.rb' + - 'packages/forest_admin_datasource_toolkit/lib/Schema/column_schema.rb' + Layout/LineLength: Max: 120 diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_relation_schema.rb b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_relation_schema.rb new file mode 100644 index 000000000..5fb70e22e --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_relation_schema.rb @@ -0,0 +1,18 @@ +module ForestAdminDatasourceToolkit + module Schema + module Relations + class ManyRelationSchema < RelationSchema + self.abstract_class = true + + attr_accessor :foreign_key + attr_reader :foreign_key_target + + def initialize(foreign_key, foreign_key_target, foreign_collection, type) + super(foreign_collection, type) + @foreign_key = foreign_key + @foreign_key_target = foreign_key_target + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_to_many_schema.rb b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_to_many_schema.rb new file mode 100644 index 000000000..54d706754 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_to_many_schema.rb @@ -0,0 +1,24 @@ +module ForestAdminDatasourceToolkit + module Schema + module Relations + class ManyToManySchema < ManyRelationSchema + attr_accessor :origin_key, :through_collection + attr_reader :origin_key_target + + def initialize( + origin_key, + origin_key_target, + foreign_key, + foreign_key_target, + foreign_collection, + through_collection + ) + super(foreign_key, foreign_key_target, foreign_collection, 'ManyToMany') + @origin_key = origin_key + @origin_key_target = origin_key_target + @through_collection = through_collection + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_many_schema.rb b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_many_schema.rb new file mode 100644 index 000000000..73db65c61 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_many_schema.rb @@ -0,0 +1,13 @@ +module ForestAdminDatasourceToolkit + module Schema + module Relations + class OneToManySchema < SingleRelationSchema + def initialize(origin_key, origin_key_target, foreign_collection) + super(origin_key, origin_key_target, foreign_collection, 'OneToMany') + @origin_key = origin_key + @origin_key_target = origin_key_target + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_one_schema.rb b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_one_schema.rb new file mode 100644 index 000000000..490db022c --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_one_schema.rb @@ -0,0 +1,13 @@ +module ForestAdminDatasourceToolkit + module Schema + module Relations + class OneToOneSchema < SingleRelationSchema + def initialize(origin_key, origin_key_target, foreign_collection) + super(origin_key, origin_key_target, foreign_collection, 'OneToOne') + @origin_key = origin_key + @origin_key_target = origin_key_target + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/single_relation_schema.rb b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/single_relation_schema.rb new file mode 100644 index 000000000..bf125fbd4 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/single_relation_schema.rb @@ -0,0 +1,18 @@ +module ForestAdminDatasourceToolkit + module Schema + module Relations + class SingleRelationSchema < RelationSchema + self.abstract_class = true + + attr_accessor :origin_key + attr_reader :origin_key_target + + def initialize(origin_key, origin_key_target, foreign_collection, type) + super(foreign_collection, type) + @origin_key = origin_key + @origin_key_target = origin_key_target + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/column_schema.rb b/packages/forest_admin_datasource_toolkit/lib/Schema/column_schema.rb new file mode 100644 index 000000000..1f0d4f3a2 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/Schema/column_schema.rb @@ -0,0 +1,34 @@ +module ForestAdminDatasourceToolkit + module Schema + class ColumnSchema + attr_reader :is_primary_key, :default_value, :enum_values, :type + + attr_accessor :is_read_only, + :is_sortable, + :validations, + :filter_operators, + :column_type + + def initialize( + column_type, + filter_operators: [], + is_primary_key: false, + is_read_only: false, + is_sortable: true, + default_value: nil, + enum_values: [], + validations: [] + ) + @column_type = column_type + @filter_operators = filter_operators + @is_primary_key = is_primary_key + @is_read_only = is_read_only + @is_sortable = is_sortable + @default_value = default_value + @enum_values = enum_values + @validations = validations + @type = 'Column' + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/relation_schema.rb b/packages/forest_admin_datasource_toolkit/lib/Schema/relation_schema.rb new file mode 100644 index 000000000..eaa2b75d9 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/Schema/relation_schema.rb @@ -0,0 +1,15 @@ +module ForestAdminDatasourceToolkit + module Schema + class RelationSchema + self.abstract_class = true + + attr_accessor :foreign_collection + attr_reader :type + + def initialize(foreign_collection, type) + @foreign_collection = foreign_collection + @type = type + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/column_schema.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/column_schema.rbs new file mode 100644 index 000000000..8f7c5d651 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/column_schema.rbs @@ -0,0 +1,15 @@ +module ForestAdminDatasourceToolkit + module Schema + class ColumnSchema + attr_accessor column_type: Array[String] | String + attr_reader default_value: untyped + attr_reader enum_values: Array[String] + attr_accessor filter_operators: Array[String] + attr_reader is_primary_key: bool + attr_accessor is_read_only: bool + attr_accessor is_sortable: bool + attr_reader type: String + attr_accessor validations: Array[String] + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relation_schema.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relation_schema.rbs new file mode 100644 index 000000000..7464d67b2 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relation_schema.rbs @@ -0,0 +1,8 @@ +module ForestAdminDatasourceToolkit + module Schema + class RelationSchema + attr_accessor foreign_collection: String + attr_reader type: String + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/many_relation_schema.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/many_relation_schema.rbs new file mode 100644 index 000000000..b12409ee3 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/many_relation_schema.rbs @@ -0,0 +1,10 @@ +module ForestAdminDatasourceToolkit + module Schema + module Relations + class ManyRelationSchema + attr_accessor foreign_key: String + attr_reader foreign_key_target: String + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rbs new file mode 100644 index 000000000..cc5468814 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rbs @@ -0,0 +1,11 @@ +module ForestAdminDatasourceToolkit + module Schema + module Relations + class ManyToManySchema + attr_accessor origin_key: String + attr_reader origin_key_target: String + attr_accessor through_collection: String + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/single_relation_schema.rbs b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/single_relation_schema.rbs new file mode 100644 index 000000000..b4cb3e63b --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/sig/forest_admin_datasource_toolkit/schema/relations/single_relation_schema.rbs @@ -0,0 +1,10 @@ +module ForestAdminDatasourceToolkit + module Schema + module Relations + class SingleRelationSchema + attr_accessor origin_key: String + attr_reader origin_key_target: String + end + end + end +end From c08263e021fccc63bad93473a23a684d05a1b3b2 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Tue, 19 Sep 2023 17:34:43 +0200 Subject: [PATCH 08/33] fix: datasource toolkit arborecense --- .../forest_admin_datasource_toolkit.gemspec | 6 +---- .../lib/forest_admin_datasource_toolkit.rb | 4 +++ .../collection.rb | 26 ++++++++----------- .../contracts/collection_contract.rb | 0 .../contracts/datasource_contract.rb | 0 .../datasource.rb | 0 .../exceptions}/forest_exception.rb | 0 .../schema}/Relations/many_relation_schema.rb | 0 .../schema}/Relations/many_to_many_schema.rb | 0 .../schema}/Relations/one_to_many_schema.rb | 0 .../schema}/Relations/one_to_one_schema.rb | 0 .../Relations/single_relation_schema.rb | 0 .../schema}/column_schema.rb | 2 +- .../schema}/relation_schema.rb | 0 14 files changed, 17 insertions(+), 21 deletions(-) rename packages/forest_admin_datasource_toolkit/lib/{ => forest_admin_datasource_toolkit}/collection.rb (73%) rename packages/forest_admin_datasource_toolkit/lib/{ => forest_admin_datasource_toolkit}/components/contracts/collection_contract.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/{ => forest_admin_datasource_toolkit}/components/contracts/datasource_contract.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/{ => forest_admin_datasource_toolkit}/datasource.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/{Exceptions => forest_admin_datasource_toolkit/exceptions}/forest_exception.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/{Schema => forest_admin_datasource_toolkit/schema}/Relations/many_relation_schema.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/{Schema => forest_admin_datasource_toolkit/schema}/Relations/many_to_many_schema.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/{Schema => forest_admin_datasource_toolkit/schema}/Relations/one_to_many_schema.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/{Schema => forest_admin_datasource_toolkit/schema}/Relations/one_to_one_schema.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/{Schema => forest_admin_datasource_toolkit/schema}/Relations/single_relation_schema.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/{Schema => forest_admin_datasource_toolkit/schema}/column_schema.rb (97%) rename packages/forest_admin_datasource_toolkit/lib/{Schema => forest_admin_datasource_toolkit/schema}/relation_schema.rb (100%) diff --git a/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec b/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec index 84896def2..b78b2dc16 100644 --- a/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec +++ b/packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec @@ -32,9 +32,5 @@ admin work on any Ruby application." spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - # Uncomment to register a new dependency of your gem - # spec.add_dependency "example-gem", "~> 1.0" - - # For more information and examples about making a new gem, check out our - # guide at: https://bundler.io/guides/creating_gem.html + spec.add_dependency "zeitwerk", "~> 2.3" end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb index 9d10087b1..57c965153 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb @@ -1,4 +1,8 @@ require_relative "forest_admin_datasource_toolkit/version" +require 'zeitwerk' + +loader = Zeitwerk::Loader.for_gem +loader.setup module ForestAdminDatasourceToolkit class Error < StandardError; end diff --git a/packages/forest_admin_datasource_toolkit/lib/collection.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/collection.rb similarity index 73% rename from packages/forest_admin_datasource_toolkit/lib/collection.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/collection.rb index 511e57cf3..fe8dbf614 100644 --- a/packages/forest_admin_datasource_toolkit/lib/collection.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/collection.rb @@ -12,23 +12,19 @@ class Collection < Components::Contracts::CollectionContract attr_writer :searchable, :countable - @schema = {} - @fields = {} - @actions = {} - @segments = {} - @charts = {} - @searchable = false - @countable = false - - def initialize( - datasource, - name, - native_driver = nil - ) - super + def initialize(datasource, name, native_driver: nil) + super() @datasource = datasource @name = name @native_driver = native_driver + @fields = {} + @schema = {} + @fields = {} + @actions = {} + @segments = {} + @charts = {} + @searchable = false + @countable = false end def is_countable? @@ -40,7 +36,7 @@ def is_searchable? end def add_field(name, field) - raise Exceptions::ForestException, "Field #{name} already defined in collection" if @fields.key? name + raise Exceptions::ForestException, "Field #{name} already defined in collection" if @fields.key?(name) @fields[name] = field end diff --git a/packages/forest_admin_datasource_toolkit/lib/components/contracts/collection_contract.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/components/contracts/collection_contract.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/components/contracts/collection_contract.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/components/contracts/collection_contract.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/components/contracts/datasource_contract.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/components/contracts/datasource_contract.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/datasource.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/datasource.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/datasource.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/datasource.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/exceptions/forest_exception.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/Exceptions/forest_exception.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/exceptions/forest_exception.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_relation_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_relation_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_relation_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_relation_schema.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_to_many_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_many_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_to_many_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_many_schema.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_many_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_many_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_many_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_many_schema.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_one_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_one_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/Schema/Relations/one_to_one_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_one_schema.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/Relations/single_relation_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/single_relation_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/Schema/Relations/single_relation_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/single_relation_schema.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/column_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb similarity index 97% rename from packages/forest_admin_datasource_toolkit/lib/Schema/column_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb index 1f0d4f3a2..bf19cd5c0 100644 --- a/packages/forest_admin_datasource_toolkit/lib/Schema/column_schema.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb @@ -10,7 +10,7 @@ class ColumnSchema :column_type def initialize( - column_type, + column_type:, filter_operators: [], is_primary_key: false, is_read_only: false, diff --git a/packages/forest_admin_datasource_toolkit/lib/Schema/relation_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relation_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/Schema/relation_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relation_schema.rb From 029ffa8856736f205e8068bfe987c822220e47bd Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Tue, 19 Sep 2023 17:35:24 +0200 Subject: [PATCH 09/33] chore: remove unused class --- packages/forest_admin_rails/app/models/concerns/.keep | 0 .../app/models/forest_admin_rails/application_record.rb | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 packages/forest_admin_rails/app/models/concerns/.keep delete mode 100644 packages/forest_admin_rails/app/models/forest_admin_rails/application_record.rb diff --git a/packages/forest_admin_rails/app/models/concerns/.keep b/packages/forest_admin_rails/app/models/concerns/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/forest_admin_rails/app/models/forest_admin_rails/application_record.rb b/packages/forest_admin_rails/app/models/forest_admin_rails/application_record.rb deleted file mode 100644 index e69de29bb..000000000 From 017299d335495080236a40e52b9174c1a5e6c387 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Tue, 19 Sep 2023 17:36:03 +0200 Subject: [PATCH 10/33] feat(datasource): add active record datasource --- .../.gitignore | 11 ++ .../.gitkeep | 0 .../.rspec | 3 + .../Gemfile | 12 ++ .../README.md | 31 ++++ .../Rakefile | 12 ++ .../bin/console | 11 ++ .../bin/setup | 8 + ...est_admin_datasource_active_record.gemspec | 37 ++++ .../forest_admin_datasource_active_record.rb | 10 ++ .../collection.rb | 159 ++++++++++++++++++ .../datasource.rb | 31 ++++ .../version.rb | 5 + .../forest_admin_datasource_active_record.rbs | 4 + .../collection.rbs | 11 ++ ...est_admin_datasource_active_record_spec.rb | 5 + .../spec/spec_helper.rb | 15 ++ .../forest_admin_rails.gemspec | 3 - .../lib/forest_admin_rails/engine.rb | 3 + 19 files changed, 368 insertions(+), 3 deletions(-) create mode 100644 packages/forest_admin_datasource_active_record/.gitignore delete mode 100644 packages/forest_admin_datasource_active_record/.gitkeep create mode 100644 packages/forest_admin_datasource_active_record/.rspec create mode 100644 packages/forest_admin_datasource_active_record/Gemfile create mode 100644 packages/forest_admin_datasource_active_record/README.md create mode 100644 packages/forest_admin_datasource_active_record/Rakefile create mode 100755 packages/forest_admin_datasource_active_record/bin/console create mode 100755 packages/forest_admin_datasource_active_record/bin/setup create mode 100644 packages/forest_admin_datasource_active_record/forest_admin_datasource_active_record.gemspec create mode 100644 packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record.rb create mode 100644 packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb create mode 100644 packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/datasource.rb create mode 100644 packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb create mode 100644 packages/forest_admin_datasource_active_record/sig/forest_admin_datasource_active_record.rbs create mode 100644 packages/forest_admin_datasource_active_record/sig/forest_admin_datasource_active_record/collection.rbs create mode 100644 packages/forest_admin_datasource_active_record/spec/forest_admin_datasource_active_record_spec.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/spec_helper.rb diff --git a/packages/forest_admin_datasource_active_record/.gitignore b/packages/forest_admin_datasource_active_record/.gitignore new file mode 100644 index 000000000..b04a8c840 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/.gitignore @@ -0,0 +1,11 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ + +# rspec failure tracking +.rspec_status diff --git a/packages/forest_admin_datasource_active_record/.gitkeep b/packages/forest_admin_datasource_active_record/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/forest_admin_datasource_active_record/.rspec b/packages/forest_admin_datasource_active_record/.rspec new file mode 100644 index 000000000..34c5164d9 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/packages/forest_admin_datasource_active_record/Gemfile b/packages/forest_admin_datasource_active_record/Gemfile new file mode 100644 index 000000000..8b07b92c1 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/Gemfile @@ -0,0 +1,12 @@ +source "https://rubygems.org" + +# Specify your gem's dependencies in forest_admin_datasource_active_record.gemspec +gemspec + +gem 'forest_admin_datasource_toolkit', path: '../forest_admin_datasource_toolkit' + +gem "rake", "~> 13.0" + +gem "rspec", "~> 3.0" + +gem "rubocop", "~> 1.21" diff --git a/packages/forest_admin_datasource_active_record/README.md b/packages/forest_admin_datasource_active_record/README.md new file mode 100644 index 000000000..cbcda87ad --- /dev/null +++ b/packages/forest_admin_datasource_active_record/README.md @@ -0,0 +1,31 @@ +# ForestAdminDatasourceActiveRecord + +TODO: Delete this and the text below, and describe your gem + +Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/forest_admin_datasource_active_record`. To experiment with that code, run `bin/console` for an interactive prompt. + +## Installation + +TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. + +Install the gem and add to the application's Gemfile by executing: + + $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +If bundler is not being used to manage dependencies, install the gem by executing: + + $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. + +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/forest_admin_datasource_active_record. diff --git a/packages/forest_admin_datasource_active_record/Rakefile b/packages/forest_admin_datasource_active_record/Rakefile new file mode 100644 index 000000000..cca717544 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/Rakefile @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +RSpec::Core::RakeTask.new(:spec) + +require "rubocop/rake_task" + +RuboCop::RakeTask.new + +task default: %i[spec rubocop] diff --git a/packages/forest_admin_datasource_active_record/bin/console b/packages/forest_admin_datasource_active_record/bin/console new file mode 100755 index 000000000..5de624b7f --- /dev/null +++ b/packages/forest_admin_datasource_active_record/bin/console @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "forest_admin_datasource_active_record" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +require "irb" +IRB.start(__FILE__) diff --git a/packages/forest_admin_datasource_active_record/bin/setup b/packages/forest_admin_datasource_active_record/bin/setup new file mode 100755 index 000000000..dce67d860 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/packages/forest_admin_datasource_active_record/forest_admin_datasource_active_record.gemspec b/packages/forest_admin_datasource_active_record/forest_admin_datasource_active_record.gemspec new file mode 100644 index 000000000..96275fcfa --- /dev/null +++ b/packages/forest_admin_datasource_active_record/forest_admin_datasource_active_record.gemspec @@ -0,0 +1,37 @@ +lib = File.expand_path('lib', __dir__) +$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) + +require_relative "lib/forest_admin_datasource_active_record/version" + +Gem::Specification.new do |spec| + spec.name = "forest_admin_datasource_active_record" + spec.version = ForestAdminDatasourceActiveRecord::VERSION + spec.authors = ["Matthieu", "Nicolas"] + spec.email = ["matthv@gmail.com", "nicolasalexandre9@gmail.com"] + spec.homepage = "https://www.forestadmin.com" + spec.summary = "Ruby agent for Forest Admin." + spec.description = "Forest is a modern admin interface that works on all major web frameworks. This gem makes Forest +admin work on any Ruby application." + spec.license = "MIT" + spec.required_ruby_version = ">= 3.0.0" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "https://github.com/ForestAdmin/agent-ruby" + spec.metadata["changelog_uri"] = "https://github.com/ForestAdmin/agent-ruby/CHANGELOG.md" + spec.metadata["rubygems_mfa_required"] = "true" + + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |f| + (File.expand_path(f) == __FILE__) || + f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile]) + end + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + spec.add_dependency "activerecord", ">= 6.1" + spec.add_dependency "zeitwerk", "~> 2.3" +end diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record.rb new file mode 100644 index 000000000..53764f794 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record.rb @@ -0,0 +1,10 @@ +require_relative "forest_admin_datasource_active_record/version" +require 'zeitwerk' + +loader = Zeitwerk::Loader.for_gem +loader.setup + +module ForestAdminDatasourceActiveRecord + class Error < StandardError; end + # Your code goes here... +end diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb new file mode 100644 index 000000000..7e8201dde --- /dev/null +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb @@ -0,0 +1,159 @@ +module ForestAdminDatasourceActiveRecord + class Collection < ForestAdminDatasourceToolkit::Collection + def initialize(datasource, model) + @model = model + name = model.name.split('::').last + super(datasource, name) + fetch_fields + end + + private + + def fetch_fields + @model.columns_hash.each do |column_name, column| + # todo check is not sti column + field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new( + column_type: get_column_type(column), + # filter_operators: [], + is_primary_key: column_name == @model.primary_key, + is_read_only: false, + is_sortable: true, + # default_value: column.default, + # enum_values: get_enum_values(column), + # validations: get_validations(column) + ) + + add_field(column_name, field) + end + end + + def get_column_type(column) + case column.type + when :boolean + type = 'Boolean' + when :datetime + type = 'Date' + when :date + type = 'Dateonly' + when :integer, :float, :decimal + type = 'Number' + when :json, :jsonb, :hstore + type = 'Json' + when :string, :text, :citext + type = 'String' + when :time + type = 'Time' + when :uuid + type = 'Uuid' + end + + is_array = (column.respond_to?(:array) && column.array == true) + is_array ? "[#{type}]" : type + end + + def get_enum_values(column) + enum_values = [] + if get_column_type(column) == 'Enum' + if sti_column?(column) + @model.descendants.each { |sti_model| enum_values << sti_model.name } + else + @model.defined_enums[column.name].each { |name, value| enum_values << name } + end + end + enum_values + end + + def sti_column?(column) + @model.inheritance_column && column.name == @model.inheritance_column + end + + def get_validations(colunm) + validations = [] + # NOTICE: Do not consider validations if a before_validation Active Records + # Callback is detected. + return validations if @model._validation_callbacks.map(&:kind).include? :before + + if @model._validators? && @model._validators[column.name.to_sym].size > 0 + @model._validators[column.name.to_sym].each do |validator| + # NOTICE: Do not consider conditional validations + next if validator.options[:if] || validator.options[:unless] || validator.options[:on] + + case validator + when ActiveRecord::Validations::PresenceValidator + validations << { + type: 'is present', + message: validator.options[:message] + } + when ActiveModel::Validations::NumericalityValidator + validator.options.each do |option, value| + case option + when :greater_than, :greater_than_or_equal_to + validations << { + type: 'is greater than', + value: value, + message: validator.options[:message] + } + when :less_than, :less_than_or_equal_to + validations << { + type: 'is less than', + value: value, + message: validator.options[:message] + } + end + end + when ActiveModel::Validations::LengthValidator + if get_column_type(column) == 'String' + validator.options.each do |option, value| + case option + when :minimum + validations << { + type: 'is longer than', + value: value, + message: validator.options[:message] + } + when :maximum + validations << { + type: 'is shorter than', + value: value, + message: validator.options[:message] + } + when :is + validations << { + type: 'is longer than', + value: value, + message: validator.options[:message] + } + validations << { + type: 'is shorter than', + value: value, + message: validator.options[:message] + } + end + end + end + when ActiveModel::Validations::FormatValidator + validator.options.each do |option, value| + case option + when :with + options = /\?([imx]){0,3}/.match(validator.options[:with].to_s) + options = options && options[1] ? options[1] : '' + regex = value.source + + # NOTICE: Transform a Ruby regex into a JS one + regex = regex.sub('\\A' , '^').sub('\\Z' , '$').sub('\\z' , '$').gsub(/\n+|\s+/, '') + + validations << { + type: 'is like', + value: "/#{regex}/#{options}", + message: validator.options[:message] + } + end + end + end + end + end + + validations + end + end +end diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/datasource.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/datasource.rb new file mode 100644 index 000000000..3c399ab2a --- /dev/null +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/datasource.rb @@ -0,0 +1,31 @@ +require 'active_record' + +module ForestAdminDatasourceActiveRecord + class Datasource < ForestAdminDatasourceToolkit::Datasource + attr_reader :collections, :charts + + def initialize(db_config = {}) + super() + @models = [] + init_orm(db_config) + generate + end + + private + + def generate + ActiveRecord::Base.descendants.each { |model| fetch_model(model) } + @models.each do |model| + add_collection(Collection.new(self, model)) + end + end + + def fetch_model(model) + @models << model unless model.abstract_class? || @models.include?(model) || !model.table_exists? + end + + def init_orm(db_config) + ActiveRecord::Base.establish_connection(db_config) + end + end +end diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb new file mode 100644 index 000000000..34fc89106 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module ForestAdminDatasourceActiveRecord + VERSION = "0.1.0" +end diff --git a/packages/forest_admin_datasource_active_record/sig/forest_admin_datasource_active_record.rbs b/packages/forest_admin_datasource_active_record/sig/forest_admin_datasource_active_record.rbs new file mode 100644 index 000000000..e43641298 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/sig/forest_admin_datasource_active_record.rbs @@ -0,0 +1,4 @@ +module ForestAdminDatasourceActiveRecord + VERSION: String + # See the writing guide of rbs: https://github.com/ruby/rbs#guides +end diff --git a/packages/forest_admin_datasource_active_record/sig/forest_admin_datasource_active_record/collection.rbs b/packages/forest_admin_datasource_active_record/sig/forest_admin_datasource_active_record/collection.rbs new file mode 100644 index 000000000..54aff43fe --- /dev/null +++ b/packages/forest_admin_datasource_active_record/sig/forest_admin_datasource_active_record/collection.rbs @@ -0,0 +1,11 @@ +module ForestAdminDatasourceActiveRecord + class Collection + @model: untyped + + private + + def fetch_fields: -> void + + def get_enum_values: -> [String] + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/forest_admin_datasource_active_record_spec.rb b/packages/forest_admin_datasource_active_record/spec/forest_admin_datasource_active_record_spec.rb new file mode 100644 index 000000000..ca619246e --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/forest_admin_datasource_active_record_spec.rb @@ -0,0 +1,5 @@ +RSpec.describe ForestAdminDatasourceActiveRecord do + it 'has a version number' do + expect(ForestAdminDatasourceActiveRecord::VERSION).not_to be_nil + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/spec_helper.rb b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb new file mode 100644 index 000000000..7d00295c1 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "forest_admin_datasource_active_record" + +RSpec.configure do |config| + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" + + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end diff --git a/packages/forest_admin_rails/forest_admin_rails.gemspec b/packages/forest_admin_rails/forest_admin_rails.gemspec index ab7736845..24582f87d 100644 --- a/packages/forest_admin_rails/forest_admin_rails.gemspec +++ b/packages/forest_admin_rails/forest_admin_rails.gemspec @@ -22,9 +22,6 @@ admin work on any Rails application (Rails >= 6.1)." end spec.add_dependency "dry-configurable", "~> 1.1" - # spec.add_dependency "dry-container", "~> 0.11" - # spec.add_dependency "lightly", "~> 0.4.0" - # spec.add_dependency "mono_logger", "~> 1.1" spec.add_dependency "rails", ">= 6.1" spec.add_dependency "zeitwerk", "~> 2.3" end diff --git a/packages/forest_admin_rails/lib/forest_admin_rails/engine.rb b/packages/forest_admin_rails/lib/forest_admin_rails/engine.rb index 0372588e6..d1a23c5bc 100644 --- a/packages/forest_admin_rails/lib/forest_admin_rails/engine.rb +++ b/packages/forest_admin_rails/lib/forest_admin_rails/engine.rb @@ -35,6 +35,9 @@ def load_configuration require Rails.root.join('config', 'forest_admin.rb') ForestAdminAgent::Builder::AgentFactory.instance.build + + # force eager loading models + Rails.application.eager_load! end def load_cors From 2e3f9a23a23313dac864772a47b7c98a6baba3e8 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Tue, 19 Sep 2023 17:36:16 +0200 Subject: [PATCH 11/33] chore: update rubocop config --- .rubocop.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 64e689941..e840e8312 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,6 +11,7 @@ Gemspec/OrderedDependencies: - 'packages/forest_admin_agent/forest_admin_agent.gemspec' - 'packages/forest_admin_rails/forest_admin_rails.gemspec' - 'packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec' + - 'packages/forest_admin_datasource_active_record/forest_admin_datasource_active_record.gemspec' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -19,6 +20,7 @@ Lint/PercentStringArray: - 'packages/forest_admin_agent/forest_admin_agent.gemspec' - 'packages/forest_admin_rails/forest_admin_rails.gemspec' - 'packages/forest_admin_datasource_toolkit/forest_admin_datasource_toolkit.gemspec' + - 'packages/forest_admin_datasource_active_record/forest_admin_datasource_active_record.gemspec' # Offense count: 1 # Configuration parameters: AllowComments. @@ -46,6 +48,7 @@ Style/BlockComments: - 'packages/forest_admin_agent/spec/spec_helper.rb' - 'packages/forest_admin_rails/spec/spec_helper.rb' - 'packages/forest_admin_datasource_toolkit/spec/spec_helper.rb' + - 'packages/forest_admin_datasource_active_record/spec/spec_helper.rb' # Offense count: 3 # Configuration parameters: AllowedConstants. @@ -69,6 +72,7 @@ Style/MutableConstant: - 'packages/forest_admin_agent/lib/forest_admin_agent/version.rb' - 'packages/forest_admin_rails/lib/forest_admin_rails/version.rb' - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb' + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb' # Offense count: 38 # This cop supports safe autocorrection (--autocorrect). @@ -106,6 +110,13 @@ Style/StringLiterals: - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit.rb' - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb' - 'packages/forest_admin_datasource_toolkit/spec/spec_helper.rb' + - 'packages/forest_admin_datasource_active_record/forest_admin_datasource_active_record.gemspec' + - 'packages/forest_admin_datasource_active_record/Gemfile' + - 'packages/forest_admin_datasource_active_record/Rakefile' + - 'packages/forest_admin_datasource_active_record/bin/console' + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record.rb' + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb' + - 'packages/forest_admin_datasource_active_record/spec/spec_helper.rb' # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). From a71ec8b5cc1a80400d197fc1761b9f1c06c126a2 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 20 Sep 2023 12:00:32 +0200 Subject: [PATCH 12/33] chore: lint --- .../collection.rb | 136 +----------------- .../parser/column.rb | 43 ++++++ .../parser/validation.rb | 108 ++++++++++++++ 3 files changed, 155 insertions(+), 132 deletions(-) create mode 100644 packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb create mode 100644 packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb index 7e8201dde..837289109 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb @@ -1,5 +1,6 @@ module ForestAdminDatasourceActiveRecord class Collection < ForestAdminDatasourceToolkit::Collection + include Column def initialize(datasource, model) @model = model name = model.name.split('::').last @@ -11,13 +12,13 @@ def initialize(datasource, model) def fetch_fields @model.columns_hash.each do |column_name, column| - # todo check is not sti column + # TODO: check is not sti column field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new( column_type: get_column_type(column), - # filter_operators: [], + # filter_operators: [], is_primary_key: column_name == @model.primary_key, is_read_only: false, - is_sortable: true, + is_sortable: true # default_value: column.default, # enum_values: get_enum_values(column), # validations: get_validations(column) @@ -26,134 +27,5 @@ def fetch_fields add_field(column_name, field) end end - - def get_column_type(column) - case column.type - when :boolean - type = 'Boolean' - when :datetime - type = 'Date' - when :date - type = 'Dateonly' - when :integer, :float, :decimal - type = 'Number' - when :json, :jsonb, :hstore - type = 'Json' - when :string, :text, :citext - type = 'String' - when :time - type = 'Time' - when :uuid - type = 'Uuid' - end - - is_array = (column.respond_to?(:array) && column.array == true) - is_array ? "[#{type}]" : type - end - - def get_enum_values(column) - enum_values = [] - if get_column_type(column) == 'Enum' - if sti_column?(column) - @model.descendants.each { |sti_model| enum_values << sti_model.name } - else - @model.defined_enums[column.name].each { |name, value| enum_values << name } - end - end - enum_values - end - - def sti_column?(column) - @model.inheritance_column && column.name == @model.inheritance_column - end - - def get_validations(colunm) - validations = [] - # NOTICE: Do not consider validations if a before_validation Active Records - # Callback is detected. - return validations if @model._validation_callbacks.map(&:kind).include? :before - - if @model._validators? && @model._validators[column.name.to_sym].size > 0 - @model._validators[column.name.to_sym].each do |validator| - # NOTICE: Do not consider conditional validations - next if validator.options[:if] || validator.options[:unless] || validator.options[:on] - - case validator - when ActiveRecord::Validations::PresenceValidator - validations << { - type: 'is present', - message: validator.options[:message] - } - when ActiveModel::Validations::NumericalityValidator - validator.options.each do |option, value| - case option - when :greater_than, :greater_than_or_equal_to - validations << { - type: 'is greater than', - value: value, - message: validator.options[:message] - } - when :less_than, :less_than_or_equal_to - validations << { - type: 'is less than', - value: value, - message: validator.options[:message] - } - end - end - when ActiveModel::Validations::LengthValidator - if get_column_type(column) == 'String' - validator.options.each do |option, value| - case option - when :minimum - validations << { - type: 'is longer than', - value: value, - message: validator.options[:message] - } - when :maximum - validations << { - type: 'is shorter than', - value: value, - message: validator.options[:message] - } - when :is - validations << { - type: 'is longer than', - value: value, - message: validator.options[:message] - } - validations << { - type: 'is shorter than', - value: value, - message: validator.options[:message] - } - end - end - end - when ActiveModel::Validations::FormatValidator - validator.options.each do |option, value| - case option - when :with - options = /\?([imx]){0,3}/.match(validator.options[:with].to_s) - options = options && options[1] ? options[1] : '' - regex = value.source - - # NOTICE: Transform a Ruby regex into a JS one - regex = regex.sub('\\A' , '^').sub('\\Z' , '$').sub('\\z' , '$').gsub(/\n+|\s+/, '') - - validations << { - type: 'is like', - value: "/#{regex}/#{options}", - message: validator.options[:message] - } - end - end - end - end - end - - validations - end end end diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb new file mode 100644 index 000000000..f63885009 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb @@ -0,0 +1,43 @@ +module ForestAdminDatasourceActiveRecord + module Parser + module Column + TYPES = { + boolean: 'Boolean', + datetime: 'Date', + date: 'Dateonly', + integer: 'Number', + float: 'Number', + decimal: 'Number', + json: 'Json', + jsonb: 'Json', + hstore: 'Json', + string: 'String', + text: 'String', + citext: 'String', + time: 'Time', + uuid: 'Uuid' + }.freeze + + def get_column_type(column) + is_array = (column.respond_to?(:array) && column.array == true) + is_array ? "[#{TYPES[column.type]}]" : TYPES[column.type] + end + + def get_enum_values(column) + enum_values = [] + if get_column_type(column) == 'Enum' + if sti_column?(column) + @model.descendants.each { |sti_model| enum_values << sti_model.name } + else + @model.defined_enums[column.name].each { |name, _value| enum_values << name } + end + end + enum_values + end + + def sti_column?(column) + @model.inheritance_column && column.name == @model.inheritance_column + end + end + end +end diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb new file mode 100644 index 000000000..cb65efa24 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb @@ -0,0 +1,108 @@ +module ForestAdminDatasourceActiveRecord + module Parser + module Validation + def get_validations(column) + validations = [] + # NOTICE: Do not consider validations if a before_validation Active Records + # Callback is detected. + return validations if @model._validation_callbacks.map(&:kind).include? :before + + if @model._validators? && @model._validators[column.name.to_sym].size.positive? + @model._validators[column.name.to_sym].each do |validator| + # NOTICE: Do not consider conditional validations + next if validator.options[:if] || validator.options[:unless] || validator.options[:on] + + case validator + when ActiveRecord::Validations::PresenceValidator + validations << { + type: 'is present', + message: validator.options[:message] + } + when ActiveModel::Validations::NumericalityValidator + validations = parse_numericality_validator(validator, validations) + when ActiveModel::Validations::LengthValidator + validations = parse_length_validator(validator, validations) + when ActiveModel::Validations::FormatValidator + validations = parse_format_validator(validator, validations) + end + end + end + + validations + end + + def parse_numericality_validator(validator, parsed_validations) + validator.options.each do |option, value| + case option + when :greater_than, :greater_than_or_equal_to + parsed_validations << { + type: 'is greater than', + value: value, + message: validator.options[:message] + } + when :less_than, :less_than_or_equal_to + parsed_validations << { + type: 'is less than', + value: value, + message: validator.options[:message] + } + end + end + end + + def parse_length_validator(validator, parsed_validations) + return unless get_column_type(column) == 'String' + + validator.options.each do |option, value| + case option + when :minimum + parsed_validations << { + type: 'is longer than', + value: value, + message: validator.options[:message] + } + when :maximum + parsed_validations << { + type: 'is shorter than', + value: value, + message: validator.options[:message] + } + when :is + parsed_validations << { + type: 'is longer than', + value: value, + message: validator.options[:message] + } + parsed_validations << { + type: 'is shorter than', + value: value, + message: validator.options[:message] + } + end + end + end + + def parse_format_validator(validator, parsed_validations) + validator.options.each do |option, value| + case option + when :with + options = /\?([imx]){0,3}/.match(validator.options[:with].to_s) + options = options && options[1] ? options[1] : '' + regex = value.source + + # NOTICE: Transform a Ruby regex into a JS one + regex = regex.sub('\\A', '^').sub('\\Z', '$').sub('\\z', '$').gsub(/\n+|\s+/, '') + + parsed_validations << { + type: 'is like', + value: "/#{regex}/#{options}", + message: validator.options[:message] + } + end + end + + parsed_validations + end + end + end +end From d97f11c7d2460f5b314d169a7503076d80915297 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Thu, 21 Sep 2023 10:29:36 +0200 Subject: [PATCH 13/33] feat(datasource): add active record datasource --- .rubocop.yml | 23 ++++++- .../collection.rb | 60 +++++++++++++++++-- .../parser/relation.rb | 21 +++++++ .../schema/Relations/many_to_many_schema.rb | 22 +++---- ...lation_schema.rb => many_to_one_schema.rb} | 8 +-- .../schema/Relations/one_to_many_schema.rb | 9 ++- .../schema/Relations/one_to_one_schema.rb | 9 ++- .../Relations/single_relation_schema.rb | 18 ------ .../schema/relation_schema.rb | 2 - 9 files changed, 124 insertions(+), 48 deletions(-) create mode 100644 packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/relation.rb rename packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/{many_relation_schema.rb => many_to_one_schema.rb} (57%) delete mode 100644 packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/single_relation_schema.rb diff --git a/.rubocop.yml b/.rubocop.yml index e840e8312..4599699b2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -136,12 +136,29 @@ Style/RedundantConstantBase: Naming/PredicateName: Exclude: - - 'packages/forest_admin_datasource_toolkit/lib/collection.rb' + - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/collection.rb' Metrics/ParameterLists: Exclude: - - 'packages/forest_admin_datasource_toolkit/lib/Schema/Relations/many_to_many_schema.rb' - - 'packages/forest_admin_datasource_toolkit/lib/Schema/column_schema.rb' + - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rb' + - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb' + +Metrics/MethodLength: + Exclude: + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' + - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/collection.rb' + +Metrics/AbcSize: + Exclude: + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' + +Metrics/CyclomaticComplexity: + Exclude: + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' + +Metrics/PerceivedComplexity: + Exclude: + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' Layout/LineLength: Max: 120 diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb index 837289109..b35c9a4c6 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb @@ -1,11 +1,14 @@ module ForestAdminDatasourceActiveRecord class Collection < ForestAdminDatasourceToolkit::Collection - include Column + include Parser::Column + include Parser::Relation + def initialize(datasource, model) @model = model name = model.name.split('::').last super(datasource, name) fetch_fields + fetch_associations end private @@ -18,14 +21,63 @@ def fetch_fields # filter_operators: [], is_primary_key: column_name == @model.primary_key, is_read_only: false, - is_sortable: true - # default_value: column.default, - # enum_values: get_enum_values(column), + is_sortable: true, + default_value: column.default, + enum_values: get_enum_values(column), # validations: get_validations(column) + validations: [] ) add_field(column_name, field) end end + + def fetch_associations + associations(@model).each do |association| + case association.macro + when :has_one + add_field( + association.name.to_s, + ForestAdminDatasourceToolkit::Schema::Relations::OneToOneSchema.new( + foreign_collection: association.name, + origin_key: association.foreign_key, + origin_key_target: association.join_foreign_key + ) + ) + when :belongs_to + add_field( + association.name.to_s, + ForestAdminDatasourceToolkit::Schema::Relations::ManyToOneSchema.new( + foreign_collection: association.name, + foreign_key: association.foreign_key, + foreign_key_target: association.join_foreign_key + ) + ) + when :has_many + if association.through_reflection? + add_field( + association.name.to_s, + ForestAdminDatasourceToolkit::Schema::Relations::ManyToManySchema.new( + foreign_collection: association.name, + origin_key: association.through_reflection.foreign_key, + origin_key_target: association.through_reflection.join_foreign_key, + foreign_key: association.association_primary_key, + foreign_key_target: association.join_foreign_key, + through_collection: association.through_reflection.name + ) + ) + else + add_field( + association.name.to_s, + ForestAdminDatasourceToolkit::Schema::Relations::OneToManySchema.new( + foreign_collection: association.name, + origin_key: association.foreign_key, # TODO: remove hardcoded id + origin_key_target: association.join_foreign_key + ) + ) + end + end + end + end end end diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/relation.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/relation.rb new file mode 100644 index 000000000..2682a5932 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/relation.rb @@ -0,0 +1,21 @@ +module ForestAdminDatasourceActiveRecord + module Parser + module Relation + def associations(model) + model.reflect_on_all_associations.select do |association| + !polymorphic?(association) && !active_type?(association.klass) + end + end + + def polymorphic?(association) + association.options[:polymorphic] + end + + # NOTICE: Ignores ActiveType::Object association during introspection and interactions. + # See the gem documentation: https://github.com/makandra/active_type + def active_type?(model) + Object.const_defined?('ActiveType::Object') && model < ActiveType::Object + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_many_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_many_schema.rb index 54d706754..839c4f4d6 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_many_schema.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_many_schema.rb @@ -1,22 +1,24 @@ module ForestAdminDatasourceToolkit module Schema module Relations - class ManyToManySchema < ManyRelationSchema - attr_accessor :origin_key, :through_collection - attr_reader :origin_key_target + class ManyToManySchema < RelationSchema + attr_accessor :origin_key, :through_collection, :foreign_key + attr_reader :origin_key_target, :foreign_key_target def initialize( - origin_key, - origin_key_target, - foreign_key, - foreign_key_target, - foreign_collection, - through_collection + origin_key:, + origin_key_target:, + foreign_key:, + foreign_key_target:, + foreign_collection:, + through_collection: ) - super(foreign_key, foreign_key_target, foreign_collection, 'ManyToMany') + super(foreign_collection, 'ManyToMany') @origin_key = origin_key @origin_key_target = origin_key_target @through_collection = through_collection + @foreign_key = foreign_key + @foreign_key_target = foreign_key_target end end end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_relation_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_one_schema.rb similarity index 57% rename from packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_relation_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_one_schema.rb index 5fb70e22e..48394158d 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_relation_schema.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_one_schema.rb @@ -1,14 +1,12 @@ module ForestAdminDatasourceToolkit module Schema module Relations - class ManyRelationSchema < RelationSchema - self.abstract_class = true - + class ManyToOneSchema < RelationSchema attr_accessor :foreign_key attr_reader :foreign_key_target - def initialize(foreign_key, foreign_key_target, foreign_collection, type) - super(foreign_collection, type) + def initialize(foreign_key:, foreign_key_target:, foreign_collection:) + super(foreign_collection, 'ManyToOne') @foreign_key = foreign_key @foreign_key_target = foreign_key_target end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_many_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_many_schema.rb index 73db65c61..00cbff603 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_many_schema.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_many_schema.rb @@ -1,9 +1,12 @@ module ForestAdminDatasourceToolkit module Schema module Relations - class OneToManySchema < SingleRelationSchema - def initialize(origin_key, origin_key_target, foreign_collection) - super(origin_key, origin_key_target, foreign_collection, 'OneToMany') + class OneToManySchema < RelationSchema + attr_accessor :origin_key + attr_reader :origin_key_target + + def initialize(origin_key:, origin_key_target:, foreign_collection:) + super(foreign_collection, 'OneToMany') @origin_key = origin_key @origin_key_target = origin_key_target end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_one_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_one_schema.rb index 490db022c..664a78716 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_one_schema.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_one_schema.rb @@ -1,9 +1,12 @@ module ForestAdminDatasourceToolkit module Schema module Relations - class OneToOneSchema < SingleRelationSchema - def initialize(origin_key, origin_key_target, foreign_collection) - super(origin_key, origin_key_target, foreign_collection, 'OneToOne') + class OneToOneSchema < RelationSchema + attr_accessor :origin_key + attr_reader :origin_key_target + + def initialize(origin_key:, origin_key_target:, foreign_collection:) + super(foreign_collection, 'OneToOne') @origin_key = origin_key @origin_key_target = origin_key_target end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/single_relation_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/single_relation_schema.rb deleted file mode 100644 index bf125fbd4..000000000 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/single_relation_schema.rb +++ /dev/null @@ -1,18 +0,0 @@ -module ForestAdminDatasourceToolkit - module Schema - module Relations - class SingleRelationSchema < RelationSchema - self.abstract_class = true - - attr_accessor :origin_key - attr_reader :origin_key_target - - def initialize(origin_key, origin_key_target, foreign_collection, type) - super(foreign_collection, type) - @origin_key = origin_key - @origin_key_target = origin_key_target - end - end - end - end -end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relation_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relation_schema.rb index eaa2b75d9..18377ad74 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relation_schema.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relation_schema.rb @@ -1,8 +1,6 @@ module ForestAdminDatasourceToolkit module Schema class RelationSchema - self.abstract_class = true - attr_accessor :foreign_collection attr_reader :type From f1c0e3cbbe1675087d9a3597b06d8f8b78324de6 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Thu, 21 Sep 2023 10:32:28 +0200 Subject: [PATCH 14/33] chore: lint --- .rubocop.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 4599699b2..8de074954 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -146,11 +146,17 @@ Metrics/ParameterLists: Metrics/MethodLength: Exclude: - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb' - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/collection.rb' +Metrics/BlockLength: + Exclude: + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb' + Metrics/AbcSize: Exclude: - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb' Metrics/CyclomaticComplexity: Exclude: From 5fc07ccc615faf301323ae3e1e61727f67d11b71 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Fri, 22 Sep 2023 12:06:26 +0200 Subject: [PATCH 15/33] feat: add generation of forestadmin-schema --- .rubocop.yml | 24 ++- .../utils/schema/generator_collection.rb | 30 +++ .../utils/schema/generator_field.rb | 184 ++++++++++++++++++ .../utils/schema/schema_emitter.rb | 103 ++++++++++ .../collection.rb | 18 +- .../parser/column.rb | 3 +- .../utils/schema.rb | 14 ++ 7 files changed, 353 insertions(+), 23 deletions(-) create mode 100644 packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_collection.rb create mode 100644 packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb create mode 100644 packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb create mode 100644 packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb diff --git a/.rubocop.yml b/.rubocop.yml index 8de074954..2c2663998 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -33,15 +33,15 @@ Metrics/AbcSize: - 'packages/forest_admin_agent/lib/forest_admin_agent/auth/auth_manager.rb' - 'packages/forest_admin_agent/lib/forest_admin_agent/auth/oauth2/forest_provider.rb' - 'packages/forest_admin_agent/lib/forest_admin_agent/auth/oidc_client_manager.rb' + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb' + - 'packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb' + - 'packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb' Metrics/CyclomaticComplexity: Exclude: - 'packages/forest_admin_agent/lib/forest_admin_agent/auth/oauth2/forest_provider.rb' - -Metrics/MethodLength: - Max: 20 - Exclude: - - 'packages/forest_admin_agent/lib/forest_admin_agent/auth/oauth2/forest_provider.rb' + - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' Style/BlockComments: Exclude: @@ -144,7 +144,10 @@ Metrics/ParameterLists: - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb' Metrics/MethodLength: + CountAsOne: ['array', 'hash', 'method_call'] + Max: 20 Exclude: + - 'packages/forest_admin_agent/lib/forest_admin_agent/auth/oauth2/forest_provider.rb' - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb' - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/collection.rb' @@ -153,18 +156,13 @@ Metrics/BlockLength: Exclude: - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb' -Metrics/AbcSize: - Exclude: - - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' - - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb' - -Metrics/CyclomaticComplexity: +Metrics/PerceivedComplexity: Exclude: - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' -Metrics/PerceivedComplexity: +Metrics/ClassLength: Exclude: - - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' + - 'packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb' Layout/LineLength: Max: 120 diff --git a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_collection.rb b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_collection.rb new file mode 100644 index 000000000..69bca885f --- /dev/null +++ b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_collection.rb @@ -0,0 +1,30 @@ +module ForestAdminAgent + module Utils + module Schema + class GeneratorCollection + private_class_method :build_fields + def self.build_schema(collection) + { + actions: {}, + fields: build_fields(collection), + icon: nil, + integration: nil, + isReadOnly: false, + isSearchable: true, + isVirtual: false, + name: collection.name, + onlyForRelationships: false, + paginationType: 'page', + segments: {} + } + end + + def self.build_fields(collection) + collection.fields + .map { |name, _field| GeneratorField.build_schema(collection, name) } + .sort_by { |v| v[:field] } + end + end + end + end +end diff --git a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb new file mode 100644 index 000000000..99b10a13c --- /dev/null +++ b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb @@ -0,0 +1,184 @@ +module ForestAdminAgent + module Utils + module Schema + class GeneratorField + RELATION_MAP = { + ManyToMany: 'BelongsToMany', + ManyToOne: 'BelongsTo', + OneToMany: 'HasMany', + OneToOne: 'HasOne' + }.freeze + + def self.build_schema(collection, name) + type = collection.fields[name].type + + case type + when 'Column' + schema = build_column_schema(collection, name) + when 'ManyToOne', 'OneToMany', 'ManyToMany', 'OneToOne' + schema = build_relation_schema(collection, name) + else + raise ForestAdminDatasourceToolkit::Exceptions::ForestException, 'Invalid field type' + end + + schema.sort_by { |k, _v| k }.to_h + end + + class << self + private + + def build_column_schema(collection, name) + column = collection.fields[name] + is_foreign_key = ForestAdminDatasourceToolkit::Utils::Schema.foreign_key?(collection, name) + + { + defaultValue: column.default_value, + enums: column.enum_values.sort, + field: name, + integration: nil, + inverseOf: nil, + isFilterable: true, # TODO: FrontendFilterableUtils.isFilterable(), + isPrimaryKey: column.is_primary_key, + + # When a column is a foreign key, it is readonly. + # This may sound counter-intuitive: it is so that the user don't have two fields which + # allow updating the same foreign key in the detail-view form (fk + many to one) + isReadOnly: is_foreign_key || column.is_read_only, + isRequired: column.validations.any? { |_k, v| v.operator == 'Present' }, + isSortable: column.is_sortable, + isVirtual: false, + reference: nil, + type: convert_column_type(column.column_type), + validations: {} # TODO: FrontendValidationUtils.convertValidationList(column), + } + end + + def convert_column_type(type) + return type if type.instance_of? String + + return [convert_column_type(type.first)] if type.instance_of? Array + + { + fields: type.map do |key, _sub_type| + { + field: key, + type: convert_column_type(type.first) + } + end + } + end + + def foreign_collection_filterable? + # TODO: implement FrontendFilterable before + true + end + + def build_many_to_many_schema(relation, collection, foreign_collection, base_schema) + target_name = relation.foreign_key_target + target_field = foreign_collection.fields[target_name] + through_schema = collection.datasource.collection(relation.through_collection) + foreign_schema = through_schema.fields[relation.foreign_key] + origin_key = through_schema.fields[relation.origin_key] + + base_schema.merge( + { + type: target_field.column_type, + defaultValue: nil, + isFilterable: false, + isPrimaryKey: false, + isRequired: false, + isReadOnly: origin_key.is_read_only || foreign_schema.is_read_only, + isSortable: true, + validations: {}, + reference: "#{foreign_collection.name}.#{target_name}" + } + ) + end + + def build_one_to_many_schema(relation, collection, foreign_collection, base_schema) + target_name = relation.origin_key_target + target_field = collection.fields[target_name] + origin_key = foreign_collection.fields[relation.origin_key] + + base_schema.merge( + { + type: target_field.column_type, + defaultValue: nil, + isFilterable: false, + isPrimaryKey: false, + isRequired: false, + isReadOnly: origin_key.is_read_only, + isSortable: true, + validations: {}, + reference: "#{foreign_collection.name}.#{target_name}" + } + ) + end + + def build_one_to_one_schema(relation, collection, foreign_collection, base_schema) + target_field = collection.fields[relation.origin_key_target] + key_field = foreign_collection.fields[relation.origin_key] + + base_schema.merge( + { + type: key_field.column_type, + defaultValue: nil, + isFilterable: foreign_collection_filterable?, + isPrimaryKey: false, + isRequired: false, + isReadOnly: key_field.is_read_only, + isSortable: target_field.is_sortable, + validations: {}, + reference: "#{foreign_collection.name}.#{relation.origin_key_target}" + } + ) + end + + def build_many_to_one_schema(relation, collection, foreign_collection, base_schema) + key_field = collection.fields[relation.foreign_key] + + base_schema.merge( + { + type: key_field.column_type, + defaultValue: key_field.default_value, + isFilterable: foreign_collection_filterable?, + isPrimaryKey: false, + isRequired: false, # TODO: check with validations + isReadOnly: key_field.is_read_only, + isSortable: key_field.is_sortable, + validations: {}, # TODO: FrontendValidation::convertValidationList(foreignTargetColumn) + reference: "#{foreign_collection.name}.#{relation.foreign_key_target}" + } + ) + end + + def build_relation_schema(collection, name) + relation = collection.fields[name] + foreign_collection = collection.datasource.collection(relation.foreign_collection) + + relation_schema = { + field: name, + enums: nil, + integration: nil, + isReadOnly: nil, + isVirtual: nil, + inverseOf: nil, # TODO: CollectionUtils::getInverseRelation(collection, name) + relationship: RELATION_MAP[relation.type] + } + + case relation.type + when 'ManyToMany' + build_many_to_many_schema(relation, collection, foreign_collection, relation_schema) + when 'OneToMany' + build_one_to_many_schema(relation, collection, foreign_collection, relation_schema) + when 'OneToOne' + build_one_to_one_schema(relation, collection, foreign_collection, relation_schema) + when 'ManyToOne' + build_many_to_one_schema(relation, collection, foreign_collection, relation_schema) + end + end + end + end + end + end +end diff --git a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb new file mode 100644 index 000000000..b03392fb8 --- /dev/null +++ b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb @@ -0,0 +1,103 @@ +require 'digest/sha1' +require 'json' + +module ForestAdminAgent + module Utils + module Schema + class SchemaEmitter + LIANA_NAME = 'agent-ruby'.freeze + + LIANA_VERSION = 'beta'.freeze + + def self.get_serialized_schema(datasource) + config = ForestAdminAgent::Builder::AgentFactory.instance.container.resolve(:cache).get('config') + if config[:is_production] + schema = if config[:schema_path] && File.exist?(config[:schema_path]) + JSON.parse(File.read(config[:schema_path])) + else + # TODO: Logger::log('Warn', 'The .forestadmin-schema.json file doesn\'t exist') + { + meta: meta(hash), + collections: {} + } + end + else + schema = generate(datasource) + hash = Digest::SHA1.hexdigest(schema.to_json) + schema = { + meta: meta(hash), + collections: schema + } + + File.write(config[:schema_path], JSON.pretty_generate(schema)) + end + + serialize(schema) + end + + class << self + private + + def generate(datasource) + datasource.collections + .map { |_name, collection| GeneratorCollection.build_schema(collection) } + .sort_by { |collection| collection[:name] } + end + + def meta(hash) + { + liana: LIANA_NAME, + liana_version: LIANA_VERSION, + stack: { + engine: 'ruby', + engine_version: RUBY_VERSION + }, + schemaFileHash: hash + } + end + + def serialize(schema) + data = [] + included = [] + schema[:collections].each do |collection| + collection_actions = collection[:actions] + collection_segments = collection[:segments] + collection.delete(:actions) + collection.delete(:segments) + + included.push(get_smart_features_by_collection('actions', collection_actions, with_attributes: true)) + included.push(get_smart_features_by_collection('segments', collection_segments, with_attributes: true)) + + data.push( + { + id: collection[:name], + type: 'collections', + attributes: collection, + relationships: { + actions: { data: get_smart_features_by_collection('actions', collection_actions) }, + segments: { data: get_smart_features_by_collection('segments', collection_actions) } + } + } + ) + end + + { + data: data, + included: included.reject!(&:empty), + meta: schema[:meta] + } + end + + def get_smart_features_by_collection(type, data, with_attributes: false) + smart_features = [] + data.each do |value| + smart_feature = { id: value[:id], type: type } + smart_feature[:attributes] = value if with_attributes + smart_features.push(smart_feature) + end + end + end + end + end + end +end diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb index b35c9a4c6..bc4e5c737 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb @@ -39,7 +39,7 @@ def fetch_associations add_field( association.name.to_s, ForestAdminDatasourceToolkit::Schema::Relations::OneToOneSchema.new( - foreign_collection: association.name, + foreign_collection: association.class_name, origin_key: association.foreign_key, origin_key_target: association.join_foreign_key ) @@ -48,7 +48,7 @@ def fetch_associations add_field( association.name.to_s, ForestAdminDatasourceToolkit::Schema::Relations::ManyToOneSchema.new( - foreign_collection: association.name, + foreign_collection: association.class_name, foreign_key: association.foreign_key, foreign_key_target: association.join_foreign_key ) @@ -58,19 +58,19 @@ def fetch_associations add_field( association.name.to_s, ForestAdminDatasourceToolkit::Schema::Relations::ManyToManySchema.new( - foreign_collection: association.name, - origin_key: association.through_reflection.foreign_key, - origin_key_target: association.through_reflection.join_foreign_key, - foreign_key: association.association_primary_key, - foreign_key_target: association.join_foreign_key, - through_collection: association.through_reflection.name + foreign_collection: association.class_name, + origin_key: association.through_reflection.join_foreign_key, + origin_key_target: association.through_reflection.foreign_key, + foreign_key: association.join_foreign_key, + foreign_key_target: association.association_primary_key, + through_collection: association.through_reflection.class_name ) ) else add_field( association.name.to_s, ForestAdminDatasourceToolkit::Schema::Relations::OneToManySchema.new( - foreign_collection: association.name, + foreign_collection: association.class_name, origin_key: association.foreign_key, # TODO: remove hardcoded id origin_key_target: association.join_foreign_key ) diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb index f63885009..41c3cf2bf 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb @@ -15,7 +15,8 @@ module Column text: 'String', citext: 'String', time: 'Time', - uuid: 'Uuid' + uuid: 'Uuid', + binary: 'Binary' }.freeze def get_column_type(column) diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb new file mode 100644 index 000000000..b43e16dcd --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb @@ -0,0 +1,14 @@ +module ForestAdminDatasourceToolkit + module Utils + class Schema + def self.foreign_key?(collection, name) + field = collection.fields[name] + + field.type == 'Column' && + collection.fields.any? do |_name, relation| + relation.type == 'ManyToOne' && relation.foreign_key == name + end + end + end + end +end From c817f140a7fe3b5618e879a77ca3908cfaa21438 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Fri, 22 Sep 2023 16:21:45 +0200 Subject: [PATCH 16/33] test: add tests on base collection and base datasource --- .rubocop.yml | 8 +-- .../forest_admin_datasource_toolkit/Gemfile | 4 ++ .../collection_spec.rb | 48 +++++++++++++++++ .../datasource_spec.rb | 51 +++++++++++++++++++ .../spec/spec_helper.rb | 12 +++-- 5 files changed, 115 insertions(+), 8 deletions(-) create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/collection_spec.rb create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/datasource_spec.rb diff --git a/.rubocop.yml b/.rubocop.yml index 2c2663998..f81a7ef65 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -164,14 +164,16 @@ Metrics/ClassLength: Exclude: - 'packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb' -Layout/LineLength: - Max: 120 - RSpec/ExampleLength: + CountAsOne: [ 'array', 'hash', 'method_call' ] Max: 20 + RSpec/MultipleExpectations: Max: 5 +Layout/LineLength: + Max: 120 + RSpec/MultipleMemoizedHelpers: Max: 10 diff --git a/packages/forest_admin_datasource_toolkit/Gemfile b/packages/forest_admin_datasource_toolkit/Gemfile index 7648e5c10..7c022e942 100644 --- a/packages/forest_admin_datasource_toolkit/Gemfile +++ b/packages/forest_admin_datasource_toolkit/Gemfile @@ -8,3 +8,7 @@ gem "rake", "~> 13.0" gem "rspec", "~> 3.0" gem "rubocop", "~> 1.21" + +gem 'simplecov', "~> 0.22", require: false + +gem 'simplecov_json_formatter', "~> 0.1.4" diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/collection_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/collection_spec.rb new file mode 100644 index 000000000..0fd2688dc --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/collection_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + describe Collection do + before do + @field = Schema::ColumnSchema.new(column_type: 'String') + @datasource = Datasource.new + @collection = described_class.new(@datasource, '__collection__') + end + + describe 'add_field' do + it 'raise when a field with the same name already exist' do + expect do + @collection.add_field('__duplicated__', @field) + @collection.add_field('__duplicated__', @field) + end.to raise_error( + ForestAdminDatasourceToolkit::Exceptions::ForestException, + '🌳🌳🌳 Field __duplicated__ already defined in collection' + ) + end + + it 'add field with unique name' do + @collection.add_field('__field__', @field) + + expect(@collection.fields).to eq({ '__field__' => @field }) + end + end + + describe 'add_fields' do + it 'add all fields with unique name' do + @collection.add_fields( + { + __first__: @field, + __second__: @field, + } + ) + + expect(@collection.fields).to eq( + { + __first__: @field, + __second__: @field, + } + ) + end + end + + end +end diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/datasource_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/datasource_spec.rb new file mode 100644 index 000000000..772cfbec1 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/datasource_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + describe Datasource do + before do + @datasource = described_class.new + @collection = Collection.new(@datasource, '__collection__') + @datasource.add_collection(@collection) + end + + it 'expose collections from datasource as an hash' do + expect(@datasource.collections).to be_a Hash + end + + it 'return an empty hash for charts' do + expect(@datasource.charts).to be_a Hash + expect(@datasource.charts).to eq({}) + end + + it 'get collection from datasource' do + expect(@datasource.collection('__collection__')).to eq(@collection) + end + + it 'raise an error when collection does not exist' do + expect do + @datasource.collection('__no_such_collection__') + end.to raise_error( + ForestAdminDatasourceToolkit::Exceptions::ForestException, + '🌳🌳🌳 Collection __no_such_collection__ not found.' + ) + end + + it 'raise an error when chart does not exist' do + expect do + @datasource.render_chart({}, '__no_such_chart__') + end.to raise_error( + ForestAdminDatasourceToolkit::Exceptions::ForestException, + '🌳🌳🌳 No chart named __no_such_chart__ exists on this datasource.' + ) + end + + it 'raise an error when collection already exist' do + expect do + @datasource.add_collection(@collection) + end.to raise_error( + ForestAdminDatasourceToolkit::Exceptions::ForestException, + '🌳🌳🌳 Collection __collection__ already defined in datasource' + ) + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb b/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb index 0841ff3df..3d4f8b93c 100644 --- a/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb +++ b/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb @@ -1,14 +1,16 @@ -# frozen_string_literal: true - +require 'simplecov' +require 'simplecov_json_formatter' require "forest_admin_datasource_toolkit" +SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter +SimpleCov.start do + add_filter 'spec' +end + RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" - # Disable RSpec exposing methods globally on `Module` and `main` - config.disable_monkey_patching! - config.expect_with :rspec do |c| c.syntax = :expect end From 657531496ee46f43962de574de80285cfd470b6a Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Mon, 25 Sep 2023 11:36:59 +0200 Subject: [PATCH 17/33] test: add tests on column schema and relation schema --- .../collection_spec.rb | 5 +-- .../schema/column_schema_spec.rb | 36 +++++++++++++++ .../relations/many_to_many_schema_spec.rb | 44 +++++++++++++++++++ .../relations/many_to_one_schema_spec.rb | 34 ++++++++++++++ .../relations/one_to_many_schema_spec.rb | 34 ++++++++++++++ .../relations/one_to_one_schema_spec.rb | 34 ++++++++++++++ 6 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/column_schema_spec.rb create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema_spec.rb create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/many_to_one_schema_spec.rb create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/one_to_many_schema_spec.rb create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/one_to_one_schema_spec.rb diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/collection_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/collection_spec.rb index 0fd2688dc..44158c261 100644 --- a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/collection_spec.rb +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/collection_spec.rb @@ -31,18 +31,17 @@ module ForestAdminDatasourceToolkit @collection.add_fields( { __first__: @field, - __second__: @field, + __second__: @field } ) expect(@collection.fields).to eq( { __first__: @field, - __second__: @field, + __second__: @field } ) end end - end end diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/column_schema_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/column_schema_spec.rb new file mode 100644 index 000000000..69abe8f34 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/column_schema_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + module Schema + describe ColumnSchema do + subject(:column) { described_class.new(column_type: 'String') } + + context 'with default values' do + it { expect(column.is_primary_key).to be false } + it { expect(column.default_value).to be_nil } + it { expect(column.is_read_only).to be false } + it { expect(column.is_sortable).to be true } + it { expect(column.filter_operators).to eq [] } + it { expect(column.enum_values).to eq [] } + it { expect(column.validations).to eq [] } + it { expect(column.column_type).to eq 'String' } + end + + context 'when use setters' do + before do + column.is_read_only = true + column.is_sortable = false + column.filter_operators = ['Equal'] + column.validations = ['validation_foo'] + column.column_type = 'Number' + end + + it { expect(column.is_read_only).to be true } + it { expect(column.is_sortable).to be false } + it { expect(column.filter_operators).to eq ['Equal'] } + it { expect(column.validations).to eq ['validation_foo'] } + it { expect(column.column_type).to eq 'Number' } + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema_spec.rb new file mode 100644 index 000000000..ba410904f --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + module Schema + module Relations + describe ManyToManySchema do + subject(:relation) do + described_class.new( + foreign_key: 'foreign_key', + foreign_key_target: 'foreign_key_target', + foreign_collection: 'foreign_collection', + through_collection: 'through_collection', + origin_key: 'origin_key', + origin_key_target: 'origin_key_target' + ) + end + + describe 'getters' do + it { expect(relation.type).to eq 'ManyToMany' } + it { expect(relation.foreign_key).to eq 'foreign_key' } + it { expect(relation.foreign_key_target).to eq 'foreign_key_target' } + it { expect(relation.foreign_collection).to eq 'foreign_collection' } + it { expect(relation.origin_key).to eq 'origin_key' } + it { expect(relation.origin_key_target).to eq 'origin_key_target' } + it { expect(relation.through_collection).to eq 'through_collection' } + end + + describe 'setters' do + before do + relation.foreign_key = 'new_foreign_key' + relation.origin_key = 'new_origin_key' + relation.foreign_collection = 'new_foreign_collection' + relation.through_collection = 'new_through_collection' + end + + it { expect(relation.foreign_key).to eq 'new_foreign_key' } + it { expect(relation.origin_key).to eq 'new_origin_key' } + it { expect(relation.foreign_collection).to eq 'new_foreign_collection' } + it { expect(relation.through_collection).to eq 'new_through_collection' } + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/many_to_one_schema_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/many_to_one_schema_spec.rb new file mode 100644 index 000000000..d0f180d41 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/many_to_one_schema_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + module Schema + module Relations + describe ManyToOneSchema do + subject(:relation) do + described_class.new( + foreign_key: 'foreign_key', + foreign_key_target: 'foreign_key_target', + foreign_collection: 'foreign_collection' + ) + end + + describe 'getters' do + it { expect(relation.type).to eq 'ManyToOne' } + it { expect(relation.foreign_key).to eq 'foreign_key' } + it { expect(relation.foreign_key_target).to eq 'foreign_key_target' } + it { expect(relation.foreign_collection).to eq 'foreign_collection' } + end + + describe 'setters' do + before do + relation.foreign_key = 'new_foreign_key' + relation.foreign_collection = 'new_foreign_collection' + end + + it { expect(relation.foreign_key).to eq 'new_foreign_key' } + it { expect(relation.foreign_collection).to eq 'new_foreign_collection' } + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/one_to_many_schema_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/one_to_many_schema_spec.rb new file mode 100644 index 000000000..d31b4d818 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/one_to_many_schema_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + module Schema + module Relations + describe OneToManySchema do + subject(:relation) do + described_class.new( + origin_key: 'origin_key', + origin_key_target: 'origin_key_target', + foreign_collection: 'foreign_collection' + ) + end + + describe 'getters' do + it { expect(relation.type).to eq 'OneToMany' } + it { expect(relation.origin_key).to eq 'origin_key' } + it { expect(relation.origin_key_target).to eq 'origin_key_target' } + it { expect(relation.foreign_collection).to eq 'foreign_collection' } + end + + describe 'setters' do + before do + relation.origin_key = 'new_origin_key' + relation.foreign_collection = 'new_foreign_collection' + end + + it { expect(relation.origin_key).to eq 'new_origin_key' } + it { expect(relation.foreign_collection).to eq 'new_foreign_collection' } + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/one_to_one_schema_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/one_to_one_schema_spec.rb new file mode 100644 index 000000000..6cf05653b --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/schema/relations/one_to_one_schema_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + module Schema + module Relations + describe OneToOneSchema do + subject(:relation) do + described_class.new( + origin_key: 'origin_key', + origin_key_target: 'origin_key_target', + foreign_collection: 'foreign_collection' + ) + end + + describe 'getters' do + it { expect(relation.type).to eq 'OneToOne' } + it { expect(relation.origin_key).to eq 'origin_key' } + it { expect(relation.origin_key_target).to eq 'origin_key_target' } + it { expect(relation.foreign_collection).to eq 'foreign_collection' } + end + + describe 'setters' do + before do + relation.origin_key = 'new_origin_key' + relation.foreign_collection = 'new_foreign_collection' + end + + it { expect(relation.origin_key).to eq 'new_origin_key' } + it { expect(relation.foreign_collection).to eq 'new_foreign_collection' } + end + end + end + end +end From 945f9aa7f37c9126085e80b0b320580aa3f99654 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Mon, 25 Sep 2023 14:34:45 +0200 Subject: [PATCH 18/33] test: add tests on forest exception --- .../exceptions/forest_exception_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/exceptions/forest_exception_spec.rb diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/exceptions/forest_exception_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/exceptions/forest_exception_spec.rb new file mode 100644 index 000000000..b66498bf6 --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/exceptions/forest_exception_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + module Exceptions + describe ForestException do + subject(:exception) { described_class.new 'message error' } + + it { expect(exception.message).to eq '🌳🌳🌳 message error' } + end + end +end From 505b815bae4efd453af1c4cdba9110ae50115e39 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Mon, 25 Sep 2023 14:35:03 +0200 Subject: [PATCH 19/33] test: add tests on collection contract and datasource contract --- .../contracts/collection_contract_spec.rb | 22 +++++++++++++++++++ .../contracts/datasource_contract_spec.rb | 17 ++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/components/contracts/collection_contract_spec.rb create mode 100644 packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/components/contracts/datasource_contract_spec.rb diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/components/contracts/collection_contract_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/components/contracts/collection_contract_spec.rb new file mode 100644 index 000000000..09b43f76f --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/components/contracts/collection_contract_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + module Components + module Contracts + describe CollectionContract do + subject(:collection) { described_class.new } + + it { expect { collection.datasource }.to raise_error(NotImplementedError) } + it { expect { collection.schema }.to raise_error(NotImplementedError) } + it { expect { collection.name }.to raise_error(NotImplementedError) } + it { expect { collection.execute }.to raise_error(NotImplementedError) } + it { expect { collection.form }.to raise_error(NotImplementedError) } + it { expect { collection.create }.to raise_error(NotImplementedError) } + it { expect { collection.list }.to raise_error(NotImplementedError) } + it { expect { collection.update }.to raise_error(NotImplementedError) } + it { expect { collection.delete }.to raise_error(NotImplementedError) } + it { expect { collection.aggregate }.to raise_error(NotImplementedError) } + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/components/contracts/datasource_contract_spec.rb b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/components/contracts/datasource_contract_spec.rb new file mode 100644 index 000000000..8924696aa --- /dev/null +++ b/packages/forest_admin_datasource_toolkit/spec/lib/forest_admin_datasource_toolkit/components/contracts/datasource_contract_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +module ForestAdminDatasourceToolkit + module Components + module Contracts + describe DatasourceContract do + subject(:datasource) { described_class.new } + + it { expect { datasource.collections }.to raise_error(NotImplementedError) } + it { expect { datasource.charts }.to raise_error(NotImplementedError) } + it { expect { datasource.collection('__foo__') }.to raise_error(NotImplementedError) } + it { expect { datasource.add_collection('__collection__') }.to raise_error(NotImplementedError) } + it { expect { datasource.render_chart('caller', 'chart') }.to raise_error(NotImplementedError) } + end + end + end +end From ca58c170c9fd961035d80bc9b2348ed6eff7f7c3 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 27 Sep 2023 12:00:04 +0200 Subject: [PATCH 20/33] test: add tests on datasource active record --- .rubocop.yml | 1 + .../Gemfile | 11 +- .../db/test.db | Bin 0 -> 20480 bytes .../forest_admin_datasource_active_record.rb | 3 +- .../collection.rb | 4 +- .../datasource.rb | 2 - .../parser/column.rb | 21 +- .../results.html | 748 ++++ .../spec/dummy/Rakefile | 6 + .../spec/dummy/app/assets/images/.keep | 0 .../app/assets/stylesheets/application.css | 1 + .../app/channels/application_cable/channel.rb | 4 + .../channels/application_cable/connection.rb | 4 + .../app/controllers/application_controller.rb | 2 + .../spec/dummy/app/controllers/concerns/.keep | 0 .../dummy/app/helpers/application_helper.rb | 2 + .../spec/dummy/app/jobs/application_job.rb | 7 + .../dummy/app/mailers/application_mailer.rb | 4 + .../spec/dummy/app/models/address.rb | 3 + .../dummy/app/models/application_record.rb | 3 + .../spec/dummy/app/models/car.rb | 6 + .../spec/dummy/app/models/car_check.rb | 4 + .../spec/dummy/app/models/category.rb | 2 + .../spec/dummy/app/models/check.rb | 4 + .../spec/dummy/app/models/concerns/.keep | 0 .../spec/dummy/app/models/order.rb | 2 + .../spec/dummy/app/models/user.rb | 6 + .../app/views/layouts/application.html.erb | 15 + .../dummy/app/views/layouts/mailer.html.erb | 13 + .../dummy/app/views/layouts/mailer.text.erb | 1 + .../spec/dummy/bin/rails | 4 + .../spec/dummy/bin/rake | 4 + .../spec/dummy/bin/setup | 33 + .../spec/dummy/config.ru | 6 + .../spec/dummy/config/application.rb | 21 + .../spec/dummy/config/boot.rb | 5 + .../spec/dummy/config/cable.yml | 10 + .../spec/dummy/config/database.yml | 12 + .../spec/dummy/config/environment.rb | 5 + .../dummy/config/environments/development.rb | 68 + .../dummy/config/environments/production.rb | 87 + .../spec/dummy/config/environments/test.rb | 60 + .../initializers/content_security_policy.rb | 25 + .../initializers/filter_parameter_logging.rb | 8 + .../dummy/config/initializers/inflections.rb | 16 + .../config/initializers/permissions_policy.rb | 11 + .../spec/dummy/config/locales/en.yml | 33 + .../spec/dummy/config/puma.rb | 43 + .../spec/dummy/config/routes.rb | 6 + .../spec/dummy/config/storage.yml | 34 + .../spec/dummy/db/database.db | Bin 0 -> 20480 bytes .../20230810094706_create_addresses.rb | 11 + .../20230810094707_create_categories.rb | 9 + .../db/migrate/20230810095724_create_cars.rb | 16 + .../db/migrate/20230810095725_create_users.rb | 29 + .../migrate/20230810102316_create_checks.rb | 10 + ...30810123423_create_join_table_car_check.rb | 8 + .../migrate/20230816094641_create_orders.rb | 10 + .../spec/dummy/lib/assets/.keep | 0 .../spec/dummy/log/.keep | 0 .../spec/dummy/log/test.log | 3144 +++++++++++++++++ .../spec/dummy/public/404.html | 67 + .../spec/dummy/public/422.html | 67 + .../spec/dummy/public/500.html | 66 + .../public/apple-touch-icon-precomposed.png | 0 .../spec/dummy/public/apple-touch-icon.png | 0 .../spec/dummy/public/favicon.ico | 0 .../spec/dummy/storage/.keep | 0 .../spec/dummy/tmp/.keep | 0 .../spec/dummy/tmp/development_secret.txt | 1 + .../spec/dummy/tmp/pids/.keep | 0 .../spec/dummy/tmp/storage/.keep | 0 .../20230810094706_create_addresses.rb | 11 + .../20230810094707_create_categories.rb | 9 + .../db/migrate/20230810095724_create_cars.rb | 16 + .../db/migrate/20230810095725_create_users.rb | 29 + .../migrate/20230810102316_create_checks.rb | 10 + ...30810123423_create_join_table_car_check.rb | 8 + .../migrate/20230816094641_create_orders.rb | 10 + .../spec/dummy_old/models/address.rb | 3 + .../spec/dummy_old/models/car.rb | 6 + .../spec/dummy_old/models/car_check.rb | 4 + .../spec/dummy_old/models/category.rb | 2 + .../spec/dummy_old/models/check.rb | 4 + .../spec/dummy_old/models/order.rb | 2 + .../spec/dummy_old/models/user.rb | 6 + .../collection_spec.rb | 33 + .../datasource_spec.rb | 12 + .../parser/column_spec.rb | 35 + .../parser/relation_spec.rb | 46 + .../spec/spec_helper.rb | 42 +- 91 files changed, 5075 insertions(+), 21 deletions(-) create mode 100644 packages/forest_admin_datasource_active_record/db/test.db create mode 100644 packages/forest_admin_datasource_active_record/results.html create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/Rakefile create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/assets/images/.keep create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/assets/stylesheets/application.css create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/channels/application_cable/channel.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/channels/application_cable/connection.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/controllers/application_controller.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/controllers/concerns/.keep create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/helpers/application_helper.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/jobs/application_job.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/mailers/application_mailer.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/models/address.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/models/application_record.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/models/car.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/models/car_check.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/models/category.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/models/check.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/models/concerns/.keep create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/models/order.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/models/user.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/application.html.erb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/mailer.html.erb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/mailer.text.erb create mode 100755 packages/forest_admin_datasource_active_record/spec/dummy/bin/rails create mode 100755 packages/forest_admin_datasource_active_record/spec/dummy/bin/rake create mode 100755 packages/forest_admin_datasource_active_record/spec/dummy/bin/setup create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config.ru create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/application.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/boot.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/cable.yml create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/database.yml create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/environment.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/environments/development.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/environments/production.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/environments/test.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/content_security_policy.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/filter_parameter_logging.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/inflections.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/permissions_policy.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/locales/en.yml create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/puma.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/routes.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/config/storage.yml create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/db/database.db create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/db/migrate/20230810094706_create_addresses.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/db/migrate/20230810094707_create_categories.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/db/migrate/20230810095724_create_cars.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/db/migrate/20230810095725_create_users.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/db/migrate/20230810102316_create_checks.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/db/migrate/20230810123423_create_join_table_car_check.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/db/migrate/20230816094641_create_orders.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/lib/assets/.keep create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/log/.keep create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/log/test.log create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/public/404.html create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/public/422.html create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/public/500.html create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/public/apple-touch-icon-precomposed.png create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/public/apple-touch-icon.png create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/public/favicon.ico create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/storage/.keep create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/tmp/.keep create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/tmp/development_secret.txt create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/tmp/pids/.keep create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/tmp/storage/.keep create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094706_create_addresses.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094707_create_categories.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095724_create_cars.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095725_create_users.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810102316_create_checks.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810123423_create_join_table_car_check.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230816094641_create_orders.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/address.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/car.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/car_check.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/category.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/check.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/order.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/user.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/collection_spec.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/datasource_spec.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb create mode 100644 packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/relation_spec.rb diff --git a/.rubocop.yml b/.rubocop.yml index f81a7ef65..47f923166 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -150,6 +150,7 @@ Metrics/MethodLength: - 'packages/forest_admin_agent/lib/forest_admin_agent/auth/oauth2/forest_provider.rb' - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/validation.rb' - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb' + - 'packages/forest_admin_datasource_active_record/spec/dummy/**/*' - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/collection.rb' Metrics/BlockLength: diff --git a/packages/forest_admin_datasource_active_record/Gemfile b/packages/forest_admin_datasource_active_record/Gemfile index 8b07b92c1..691e802f5 100644 --- a/packages/forest_admin_datasource_active_record/Gemfile +++ b/packages/forest_admin_datasource_active_record/Gemfile @@ -7,6 +7,13 @@ gem 'forest_admin_datasource_toolkit', path: '../forest_admin_datasource_toolkit gem "rake", "~> 13.0" -gem "rspec", "~> 3.0" - gem "rubocop", "~> 1.21" + +group :test do + gem "rspec-rails", "~> 3.0" + gem 'rails' + gem 'database_cleaner-active_record' + gem 'sqlite3' + gem 'simplecov', "~> 0.22", require: false + gem 'simplecov_json_formatter', "~> 0.1.4" +end diff --git a/packages/forest_admin_datasource_active_record/db/test.db b/packages/forest_admin_datasource_active_record/db/test.db new file mode 100644 index 0000000000000000000000000000000000000000..150268908c6695db8c9291daf68ab8bd5be1563c GIT binary patch literal 20480 zcmeI%J#W)M7{Kv!URpqE(k(*=PR`Ouv}qC$Ii2EX9?(?v?)H z%85$*mnxMfr#*Rc*6GOC-IuTY?zuc}pFfc9L`7pg%d&xfs+G}$Kp9us>uVFndiP;% zcD_v+f669Sr_^2)HY)EtM})~hUynXVcKI8qu^CQ}gJriHG?qn+*Uo08UUzQpPkBcD zOC75q4nL&Igu`UC5Xk)vvoN2jOmsT3C(ml0RW>hE^K%=Ov-+wM7QQ%WEQGSP{hjPr zwUu?-Sw}+v0R#|0009ILKmY**5I_Kdbrram6~_91T^}!XA%Fk^2q1s}0tg_000Iag zFcrw&|2ySx!frGK5I_I{1Q0*~0R#|0009IL_&)?ronp1>`#PC~=`e|PVg~v`jUyA- zQ1hVK+B*Ysq=J8C^TYBlz4sO255p2^<-JLR9kZZrfCKmY**5I_I{1Q0*~0R#|O N7lBf~dUx*cgFiE<%fbKv literal 0 HcmV?d00001 diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record.rb index 53764f794..af99d3703 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record.rb @@ -1,4 +1,5 @@ -require_relative "forest_admin_datasource_active_record/version" +require_relative 'forest_admin_datasource_active_record/version' +# require 'forest_admin_datasource_toolkit' require 'zeitwerk' loader = Zeitwerk::Loader.for_gem diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb index bc4e5c737..b2a2557ff 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb @@ -17,13 +17,13 @@ def fetch_fields @model.columns_hash.each do |column_name, column| # TODO: check is not sti column field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new( - column_type: get_column_type(column), + column_type: get_column_type(@model, column), # filter_operators: [], is_primary_key: column_name == @model.primary_key, is_read_only: false, is_sortable: true, default_value: column.default, - enum_values: get_enum_values(column), + enum_values: get_enum_values(@model, column), # validations: get_validations(column) validations: [] ) diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/datasource.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/datasource.rb index 3c399ab2a..f0e39d99a 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/datasource.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/datasource.rb @@ -2,8 +2,6 @@ module ForestAdminDatasourceActiveRecord class Datasource < ForestAdminDatasourceToolkit::Datasource - attr_reader :collections, :charts - def initialize(db_config = {}) super() @models = [] diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb index 41c3cf2bf..3ad1272bd 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/parser/column.rb @@ -19,25 +19,30 @@ module Column binary: 'Binary' }.freeze - def get_column_type(column) + def get_column_type(model, column) + if model.respond_to?(:defined_enums) && + model.defined_enums.key?(column.name) + return 'Enum' + end + is_array = (column.respond_to?(:array) && column.array == true) is_array ? "[#{TYPES[column.type]}]" : TYPES[column.type] end - def get_enum_values(column) + def get_enum_values(model, column) enum_values = [] - if get_column_type(column) == 'Enum' - if sti_column?(column) - @model.descendants.each { |sti_model| enum_values << sti_model.name } + if get_column_type(model, column) == 'Enum' + if sti_column?(model, column) + model.descendants.each { |sti_model| enum_values << sti_model.name } else - @model.defined_enums[column.name].each { |name, _value| enum_values << name } + model.defined_enums[column.name].each { |name, _value| enum_values << name } end end enum_values end - def sti_column?(column) - @model.inheritance_column && column.name == @model.inheritance_column + def sti_column?(model, column) + model.inheritance_column && column.name == model.inheritance_column end end end diff --git a/packages/forest_admin_datasource_active_record/results.html b/packages/forest_admin_datasource_active_record/results.html new file mode 100644 index 000000000..ccfa530ee --- /dev/null +++ b/packages/forest_admin_datasource_active_record/results.html @@ -0,0 +1,748 @@ + + + + RSpec results + + + + + + + + +
+ +
+
+

RSpec Code Examples

+
+ +
+ + + +
+ +
+

 

+

 

+
+
+ + +
+
+
+
ForestAdminDatasourceActiveRecord
+ +
has a version number0.00107s
+
+
+
+
+
ForestAdminDatasourceActiveRecord::Collection
+
+
+
+
+
fetch_fields
+ + + + +
+ add all fields of model to the collection + 0.00305s +
+
  Failure/Error:
+    @model.columns_hash.each do |column_name, column|
+      # TODO: check is not sti column
+      field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new(
+        column_type: get_column_type(@model, column),
+        # filter_operators: [],
+        is_primary_key: column_name == @model.primary_key,
+        is_read_only: false,
+        is_sortable: true,
+        default_value: column.default,
+        enum_values: get_enum_values(@model, column),
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'cars'
+  # ./lib/forest_admin_datasource_active_record/collection.rb:17:in `fetch_fields'
+  # ./lib/forest_admin_datasource_active_record/collection.rb:10:in `initialize'
+  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `new'
+  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
+  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:12:in `block (3 levels) in <module:ForestAdminDatasourceActiveRecord>'
+
./lib/forest_admin_datasource_active_record/collection.rb:17:in `fetch_fields'
+./lib/forest_admin_datasource_active_record/collection.rb:10:in `initialize'
+./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `new'
+./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
+./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:12:in `block (3 levels) in <module:ForestAdminDatasourceActiveRecord>'
+
15
+16    def fetch_fields
+17      @model.columns_hash.each do |column_name, column|
+18        # TODO: check is not sti column
+19        field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new(
+20# Install the coderay gem to get syntax highlighting
+
+
+
+
+
+
+
fetch_associations
+ + + +
+ add all relation of model to the collection + 0.00134s +
+
  Failure/Error:
+    @model.columns_hash.each do |column_name, column|
+      # TODO: check is not sti column
+      field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new(
+        column_type: get_column_type(@model, column),
+        # filter_operators: [],
+        is_primary_key: column_name == @model.primary_key,
+        is_read_only: false,
+        is_sortable: true,
+        default_value: column.default,
+        enum_values: get_enum_values(@model, column),
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'cars'
+  # ./lib/forest_admin_datasource_active_record/collection.rb:17:in `fetch_fields'
+  # ./lib/forest_admin_datasource_active_record/collection.rb:10:in `initialize'
+  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `new'
+  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
+  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:29:in `block (3 levels) in <module:ForestAdminDatasourceActiveRecord>'
+
./lib/forest_admin_datasource_active_record/collection.rb:17:in `fetch_fields'
+./lib/forest_admin_datasource_active_record/collection.rb:10:in `initialize'
+./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `new'
+./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
+./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:29:in `block (3 levels) in <module:ForestAdminDatasourceActiveRecord>'
+
15
+16    def fetch_fields
+17      @model.columns_hash.each do |column_name, column|
+18        # TODO: check is not sti column
+19        field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new(
+20# Install the coderay gem to get syntax highlighting
+
+
+
+
+
+
+
ForestAdminDatasourceActiveRecord::Datasource
+ + + +
+ fetch all models + 0.01081s +
+
  Failure/Error: expect(datasource.collections.keys).to match_array(expected)
+
+    expected collection contained:  ["Address", "Car", "CarCheck", "Category", "Check", "InternalMetadata", "Order", "SchemaMigration", "User"]
+    actual collection contained:    ["InternalMetadata", "SchemaMigration"]
+    the missing elements were:      ["Address", "Car", "CarCheck", "Category", "Check", "Order", "User"]
+  # ./spec/lib/forest_admin_datasource_active_record/datasource_spec.rb:9:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
+
./spec/lib/forest_admin_datasource_active_record/datasource_spec.rb:9:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
+
7      expected = %w[InternalMetadata SchemaMigration User Order Check Category CarCheck Car Address]
+8
+9      expect(datasource.collections.keys).to match_array(expected)
+10    end
+11  end
+12# Install the coderay gem to get syntax highlighting
+
+
+
+
+
+
+
ForestAdminDatasourceActiveRecord::Parser::Column
+
+
+
+
+
get_column_type
+ + + +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:10 + 0.00042s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:10:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:10:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:11 + 0.00034s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:11:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:11:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:12 + 0.00043s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:12:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:12:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:13 + 0.00021s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:13:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:13:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:14 + 0.00045s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:14:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:14:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:15 + 0.00029s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:15:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:15:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:16 + 0.00024s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:16:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:16:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:17 + 0.00022s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:17:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:17:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:18 + 0.00765s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:18:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:18:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:19 + 0.00046s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:19:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:19:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:20 + 0.00024s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:20:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:20:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:21 + 0.00022s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:21:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:21:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+
+
+
+
+
get_enum_values
+ + + +
+ return an empty array if column is not Enum + 0.00023s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:26:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:26:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+ +
+ return the enum values + 0.00021s +
+
  Failure/Error: let(:columns) { User.columns_hash }
+
+  ActiveRecord::StatementInvalid:
+    Could not find table 'users'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:30:in `block (3 levels) in <module:Parser>'
+
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
+./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:30:in `block (3 levels) in <module:Parser>'
+
5    describe Column do
+6      let(:dummy_class) { Class.new { extend Column } }
+7      let(:columns) { User.columns_hash }
+8
+9      describe 'get_column_type' do
+10# Install the coderay gem to get syntax highlighting
+
+
+
+
+
+
+
ForestAdminDatasourceActiveRecord::Parser::Relation
+
+
+
+
+
associations
+ +
fetch belongs_to relation0.00031s
+ +
fetch belongs_to relation0.00008s
+ +
fetch has_many relation0.00007s
+ +
fetch many_to_many relation defined with has_many through0.00007s
+ +
not fetch polymorphic relation0.00020s
+
+
+ + +
+
+ + diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/Rakefile b/packages/forest_admin_datasource_active_record/spec/dummy/Rakefile new file mode 100644 index 000000000..9a5ea7383 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative "config/application" + +Rails.application.load_tasks diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/assets/images/.keep b/packages/forest_admin_datasource_active_record/spec/dummy/app/assets/images/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/assets/stylesheets/application.css b/packages/forest_admin_datasource_active_record/spec/dummy/app/assets/stylesheets/application.css new file mode 100644 index 000000000..dcd72732e --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/assets/stylesheets/application.css @@ -0,0 +1 @@ +/* Application styles */ diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/channels/application_cable/channel.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/channels/application_cable/channel.rb new file mode 100644 index 000000000..d67269728 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/channels/application_cable/connection.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/channels/application_cable/connection.rb new file mode 100644 index 000000000..0ff5442f4 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/controllers/application_controller.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/controllers/application_controller.rb new file mode 100644 index 000000000..09705d12a --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::Base +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/controllers/concerns/.keep b/packages/forest_admin_datasource_active_record/spec/dummy/app/controllers/concerns/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/helpers/application_helper.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/jobs/application_job.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/jobs/application_job.rb new file mode 100644 index 000000000..d394c3d10 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/jobs/application_job.rb @@ -0,0 +1,7 @@ +class ApplicationJob < ActiveJob::Base + # Automatically retry jobs that encountered a deadlock + # retry_on ActiveRecord::Deadlocked + + # Most jobs are safe to ignore if the underlying records are no longer available + # discard_on ActiveJob::DeserializationError +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/mailers/application_mailer.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/mailers/application_mailer.rb new file mode 100644 index 000000000..3c34c8148 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: "from@example.com" + layout "mailer" +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/models/address.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/address.rb new file mode 100644 index 000000000..d80b23795 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/address.rb @@ -0,0 +1,3 @@ +class Address < ApplicationRecord + belongs_to :addressable, polymorphic: true +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/models/application_record.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/application_record.rb new file mode 100644 index 000000000..b63caeb8a --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + primary_abstract_class +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/models/car.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/car.rb new file mode 100644 index 000000000..0b49880b0 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/car.rb @@ -0,0 +1,6 @@ +class Car < ApplicationRecord + belongs_to :category + has_one :user + has_many :car_checks + has_many :checks, through: :car_checks +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/models/car_check.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/car_check.rb new file mode 100644 index 000000000..d97b0158a --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/car_check.rb @@ -0,0 +1,4 @@ +class CarCheck < ApplicationRecord + belongs_to :car + belongs_to :check +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/models/category.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/category.rb new file mode 100644 index 000000000..54cb6aee3 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/category.rb @@ -0,0 +1,2 @@ +class Category < ApplicationRecord +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/models/check.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/check.rb new file mode 100644 index 000000000..afc1b25cb --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/check.rb @@ -0,0 +1,4 @@ +class Check < ApplicationRecord + has_many :car_checks + has_many :cars, through: :car_checks +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/models/concerns/.keep b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/concerns/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/models/order.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/order.rb new file mode 100644 index 000000000..10281b345 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/order.rb @@ -0,0 +1,2 @@ +class Order < ApplicationRecord +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/models/user.rb b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/user.rb new file mode 100644 index 000000000..f1df24e7e --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/models/user.rb @@ -0,0 +1,6 @@ +class User < ApplicationRecord + belongs_to :car + has_one :address, as: :addressable + + enum :enum_field, { draft: 0, published: 1, archived: 2, trashed: 3 } +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/application.html.erb b/packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/application.html.erb new file mode 100644 index 000000000..f72b4ef0e --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/application.html.erb @@ -0,0 +1,15 @@ + + + + Dummy + + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + <%= stylesheet_link_tag "application" %> + + + + <%= yield %> + + diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/mailer.html.erb b/packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/mailer.html.erb new file mode 100644 index 000000000..cbd34d2e9 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ + + + + + + + + + <%= yield %> + + diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/mailer.text.erb b/packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/mailer.text.erb new file mode 100644 index 000000000..37f0bddbd --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/bin/rails b/packages/forest_admin_datasource_active_record/spec/dummy/bin/rails new file mode 100755 index 000000000..efc037749 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/bin/rake b/packages/forest_admin_datasource_active_record/spec/dummy/bin/rake new file mode 100755 index 000000000..4fbf10b96 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative "../config/boot" +require "rake" +Rake.application.run diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/bin/setup b/packages/forest_admin_datasource_active_record/spec/dummy/bin/setup new file mode 100755 index 000000000..ec47b79b3 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/bin/setup @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby +require "fileutils" + +# path to your application root. +APP_ROOT = File.expand_path("..", __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +FileUtils.chdir APP_ROOT do + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. + # Add necessary setup steps to this file. + + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # FileUtils.cp "config/database.yml.sample", "config/database.yml" + # end + + puts "\n== Preparing database ==" + system! "bin/rails db:prepare" + + puts "\n== Removing old logs and tempfiles ==" + system! "bin/rails log:clear tmp:clear" + + puts "\n== Restarting application server ==" + system! "bin/rails restart" +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config.ru b/packages/forest_admin_datasource_active_record/spec/dummy/config.ru new file mode 100644 index 000000000..4a3c09a68 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config.ru @@ -0,0 +1,6 @@ +# This file is used by Rack-based servers to start the application. + +require_relative "config/environment" + +run Rails.application +Rails.application.load_server diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/application.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/application.rb new file mode 100644 index 000000000..fa0d753db --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/application.rb @@ -0,0 +1,21 @@ +require_relative "boot" + +require "rails/all" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Dummy + class Application < Rails::Application + config.load_defaults Rails::VERSION::STRING.to_f + + # Configuration for the application, engines, and railties goes here. + # + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/boot.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/boot.rb new file mode 100644 index 000000000..116591a4e --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/boot.rb @@ -0,0 +1,5 @@ +# Set up gems listed in the Gemfile. +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__) + +require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) +$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__) diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/cable.yml b/packages/forest_admin_datasource_active_record/spec/dummy/config/cable.yml new file mode 100644 index 000000000..98367f895 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: test + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: dummy_production diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/database.yml b/packages/forest_admin_datasource_active_record/spec/dummy/config/database.yml new file mode 100644 index 000000000..f3753ab95 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/database.yml @@ -0,0 +1,12 @@ +default: &default + adapter: sqlite3 + database: 'db/database.db' + +development: + <<: *default + +test: + <<: *default + +production: + <<: *default diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/environment.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/environment.rb new file mode 100644 index 000000000..cac531577 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative "application" + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/environments/development.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/environments/development.rb new file mode 100644 index 000000000..8d1635ee6 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/environments/development.rb @@ -0,0 +1,68 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable server timing + config.server_timing = true + + # Enable/disable caching. By default caching is disabled. + # Run rails dev:cache to toggle caching. + if Rails.root.join("tmp/caching-dev.txt").exist? + config.action_controller.perform_caching = true + config.action_controller.enable_fragment_cache_logging = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + "Cache-Control" => "public, max-age=#{2.days.to_i}" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Store uploaded files on the local file system (see config/storage.yml for options). + config.active_storage.service = :local + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + config.action_mailer.perform_caching = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = true +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/environments/production.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/environments/production.rb new file mode 100644 index 000000000..83a5a16ee --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/environments/production.rb @@ -0,0 +1,87 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.asset_host = "http://assets.example.com" + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX + + # Store uploaded files on the local file system (see config/storage.yml for options). + config.active_storage.service = :local + + # Mount Action Cable outside main process or domain. + # config.action_cable.mount_path = nil + # config.action_cable.url = "wss://example.com/cable" + # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Include generic and useful information about system operation, but avoid logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). + config.log_level = :info + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment). + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "dummy_production" + + config.action_mailer.perform_caching = false + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Don't log any deprecations. + config.active_support.report_deprecations = false + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require "syslog/logger" + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/environments/test.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/environments/test.rb new file mode 100644 index 000000000..6ea4d1e70 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/environments/test.rb @@ -0,0 +1,60 @@ +require "active_support/core_ext/integer/time" + +# The test environment is used exclusively to run your application's +# test suite. You never need to work with it otherwise. Remember that +# your test database is "scratch space" for the test suite and is wiped +# and recreated between test runs. Don't rely on the data there! + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Turn false under Spring and add config.action_view.cache_template_loading = true. + config.cache_classes = true + + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. + config.eager_load = ENV["CI"].present? + + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + "Cache-Control" => "public, max-age=#{1.hour.to_i}" + } + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + config.cache_store = :null_store + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Store uploaded files on the local file system in a temporary directory. + config.active_storage.service = :test + + config.action_mailer.perform_caching = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/content_security_policy.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/content_security_policy.rb new file mode 100644 index 000000000..54f47cf15 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header + +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true +# end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/filter_parameter_logging.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..adc6568ce --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# Configure parameters to be filtered from the log file. Use this to limit dissemination of +# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported +# notations and behaviors. +Rails.application.config.filter_parameters += [ + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/inflections.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/inflections.rb new file mode 100644 index 000000000..3860f659e --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym "RESTful" +# end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/permissions_policy.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/permissions_policy.rb new file mode 100644 index 000000000..00f64d71b --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/initializers/permissions_policy.rb @@ -0,0 +1,11 @@ +# Define an application-wide HTTP permissions policy. For further +# information see https://developers.google.com/web/updates/2018/06/feature-policy +# +# Rails.application.config.permissions_policy do |f| +# f.camera :none +# f.gyroscope :none +# f.microphone :none +# f.usb :none +# f.fullscreen :self +# f.payment :self, "https://secure.example.com" +# end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/locales/en.yml b/packages/forest_admin_datasource_active_record/spec/dummy/config/locales/en.yml new file mode 100644 index 000000000..8ca56fc74 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/locales/en.yml @@ -0,0 +1,33 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t "hello" +# +# In views, this is aliased to just `t`: +# +# <%= t("hello") %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# "true": "foo" +# +# To learn more, please read the Rails Internationalization guide +# available at https://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/puma.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/puma.rb new file mode 100644 index 000000000..daaf03699 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/puma.rb @@ -0,0 +1,43 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +# +max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +threads min_threads_count, max_threads_count + +# Specifies the `worker_timeout` threshold that Puma will use to wait before +# terminating a worker in development environments. +# +worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the `pidfile` that Puma will use. +pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked web server processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. +# +# preload_app! + +# Allow puma to be restarted by `bin/rails restart` command. +plugin :tmp_restart diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/routes.rb b/packages/forest_admin_datasource_active_record/spec/dummy/config/routes.rb new file mode 100644 index 000000000..262ffd547 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/routes.rb @@ -0,0 +1,6 @@ +Rails.application.routes.draw do + # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html + + # Defines the root path route ("/") + # root "articles#index" +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/config/storage.yml b/packages/forest_admin_datasource_active_record/spec/dummy/config/storage.yml new file mode 100644 index 000000000..4942ab669 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket-<%= Rails.env %> + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket-<%= Rails.env %> + +# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name-<%= Rails.env %> + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/db/database.db b/packages/forest_admin_datasource_active_record/spec/dummy/db/database.db new file mode 100644 index 0000000000000000000000000000000000000000..28a7ba1ae1c50e83930cb12fec7a191e4afe6efc GIT binary patch literal 20480 zcmeI%J#W)M7{Kv!URpqE(gkJcz{y=2i8gMEQ?)D@6ai`|5YnMyu#V(P4Y32xB`Rb2 zPVhPSDljo}j?^e9$qb7AC;M`K?s4qr=PVb$dEJVPmKTFGRz@C(P2o7=k(5G+yxog- zziBx;DBK*_PiJPlY?v2&AAW3L1zm_EvM*sl?5I_I{1Q0*~0R#~E zCj!@<{CdUrov$ZGz3Xe0hEZa4ny7vlYomI~s70~DlXf%cG-W4v+-gd9QHm>f+>iQ; zE5|DBUaC}{zU;`;vsO#KYCnGww9n;9^ZdSa$ErWl(<~e4rdk=@3zc!Dy}mY4talpK z>G?Kg^eLNIo>F~USgXAC9T6oxeKq{tx69v9jm%(j94@-uaDP#>c;&2DYBlHj-h^k^ zz0|P^% + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/public/422.html b/packages/forest_admin_datasource_active_record/spec/dummy/public/422.html new file mode 100644 index 000000000..c08eac0d1 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/public/500.html b/packages/forest_admin_datasource_active_record/spec/dummy/public/500.html new file mode 100644 index 000000000..78a030af2 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/public/apple-touch-icon-precomposed.png b/packages/forest_admin_datasource_active_record/spec/dummy/public/apple-touch-icon-precomposed.png new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/public/apple-touch-icon.png b/packages/forest_admin_datasource_active_record/spec/dummy/public/apple-touch-icon.png new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/public/favicon.ico b/packages/forest_admin_datasource_active_record/spec/dummy/public/favicon.ico new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/storage/.keep b/packages/forest_admin_datasource_active_record/spec/dummy/storage/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/tmp/.keep b/packages/forest_admin_datasource_active_record/spec/dummy/tmp/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/tmp/development_secret.txt b/packages/forest_admin_datasource_active_record/spec/dummy/tmp/development_secret.txt new file mode 100644 index 000000000..2f91f53a8 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy/tmp/development_secret.txt @@ -0,0 +1 @@ +5e7e529d64029e290d92ee62bd2967000b9959e0fa32eb8168810376b9193585f73a12c712c87de927e927d8b6487730b15a9d97c6aab0402885bc726bd4bf30 \ No newline at end of file diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/tmp/pids/.keep b/packages/forest_admin_datasource_active_record/spec/dummy/tmp/pids/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/tmp/storage/.keep b/packages/forest_admin_datasource_active_record/spec/dummy/tmp/storage/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094706_create_addresses.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094706_create_addresses.rb new file mode 100644 index 000000000..72e8a6a39 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094706_create_addresses.rb @@ -0,0 +1,11 @@ +class CreateAddresses < ActiveRecord::Migration[7.0] + def change + create_table :addresses do |t| + t.string :city + t.string :zip_code + t.string :street + t.references :addressable, polymorphic: true + t.timestamps + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094707_create_categories.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094707_create_categories.rb new file mode 100644 index 000000000..5d9d1db53 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094707_create_categories.rb @@ -0,0 +1,9 @@ +class CreateCategories < ActiveRecord::Migration[7.0] + def change + create_table :categories do |t| + t.string :label + + t.timestamps + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095724_create_cars.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095724_create_cars.rb new file mode 100644 index 000000000..cb65d175a --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095724_create_cars.rb @@ -0,0 +1,16 @@ +class CreateCars < ActiveRecord::Migration[7.0] + def change + create_table :cars do |t| + t.references :category, null: false, foreign_key: true + t.string :reference + t.string :model + t.string :brand + t.integer :year + t.integer :nb_seats + t.boolean :is_manual + t.json :options + + t.timestamps + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095725_create_users.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095725_create_users.rb new file mode 100644 index 000000000..2911bf78e --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095725_create_users.rb @@ -0,0 +1,29 @@ +class CreateUsers < ActiveRecord::Migration[7.0] + def change + create_table :users do |t| + t.references :car, null: false, foreign_key: true + + t.string :first_name + t.string :last_name + + t.string :string_field + t.text :text_field + t.boolean :boolean_field + t.date :date_field + t.datetime :datetime_field + t.integer :integer_field + t.float :float_field + t.decimal :decimal_field + t.json :json_field + t.time :time_field + t.binary :binary_field + t.integer :enum_field, default: 0 + # t.jsonb :options_b + # t.hstore :options_hstore + # t.citext :citext_field + # t.uuid :uuid + + t.timestamps + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810102316_create_checks.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810102316_create_checks.rb new file mode 100644 index 000000000..90874d97e --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810102316_create_checks.rb @@ -0,0 +1,10 @@ +class CreateChecks < ActiveRecord::Migration[7.0] + def change + create_table :checks do |t| + t.string :garage_name + t.date :date + + t.timestamps + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810123423_create_join_table_car_check.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810123423_create_join_table_car_check.rb new file mode 100644 index 000000000..1b69d5814 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810123423_create_join_table_car_check.rb @@ -0,0 +1,8 @@ +class CreateJoinTableCarCheck < ActiveRecord::Migration[7.0] + def change + create_table :car_checks do |t| + t.references :car, null: false, foreign_key: true + t.references :check, null: false, foreign_key: true + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230816094641_create_orders.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230816094641_create_orders.rb new file mode 100644 index 000000000..d0e650766 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230816094641_create_orders.rb @@ -0,0 +1,10 @@ +class CreateOrders < ActiveRecord::Migration[7.0] + def change + create_table :orders do |t| + t.string :reference + t.binary :invoice + + t.timestamps + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/address.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/address.rb new file mode 100644 index 000000000..0903be47c --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/address.rb @@ -0,0 +1,3 @@ +class Address < ActiveRecord::Base + belongs_to :addressable, polymorphic: true +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car.rb new file mode 100644 index 000000000..1c5947acb --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car.rb @@ -0,0 +1,6 @@ +class Car < ActiveRecord::Base + belongs_to :category + has_one :user + has_many :car_checks + has_many :checks, through: :car_checks +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car_check.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car_check.rb new file mode 100644 index 000000000..68111517f --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car_check.rb @@ -0,0 +1,4 @@ +class CarCheck < ActiveRecord::Base + belongs_to :car + belongs_to :check +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/category.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/category.rb new file mode 100644 index 000000000..910a0098c --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/category.rb @@ -0,0 +1,2 @@ +class Category < ActiveRecord::Base +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/check.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/check.rb new file mode 100644 index 000000000..8f1d9814b --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/check.rb @@ -0,0 +1,4 @@ +class Check < ActiveRecord::Base + has_many :car_checks + has_many :cars, through: :car_checks +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/order.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/order.rb new file mode 100644 index 000000000..0bcb15832 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/order.rb @@ -0,0 +1,2 @@ +class Order < ActiveRecord::Base +end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/user.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/user.rb new file mode 100644 index 000000000..6f61da046 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/user.rb @@ -0,0 +1,6 @@ +class User < ActiveRecord::Base + belongs_to :car + has_one :address, as: :addressable + + enum :enum_field, { draft: 0, published: 1, archived: 2, trashed: 3 } +end diff --git a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/collection_spec.rb b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/collection_spec.rb new file mode 100644 index 000000000..9478489d7 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/collection_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +module ForestAdminDatasourceActiveRecord + describe Collection do + let(:collection) do + datasource = Datasource.new(adapter: 'sqlite3', database: 'db/database.db') + described_class.new(datasource, Car) + end + + describe 'fetch_fields' do + it 'add all fields of model to the collection' do + expect(collection.fields.keys).to include( + 'id', + 'category_id', + 'reference', + 'model', + 'brand', + 'year', + 'nb_seats', + 'is_manual', + 'options', + 'created_at', + 'updated_at' + ) + end + end + describe 'fetch_associations' do + it 'add all relation of model to the collection' do + expect(collection.fields.keys).to include('category', 'user', 'car_checks', 'checks') + end + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/datasource_spec.rb b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/datasource_spec.rb new file mode 100644 index 000000000..c2da58645 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/datasource_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +module ForestAdminDatasourceActiveRecord + describe Datasource do + it 'fetch all models' do + datasource = Datasource.new(adapter: 'sqlite3', database: 'db/database.db') + expected = %w[InternalMetadata SchemaMigration User Order Check Category CarCheck Car Address] + + expect(datasource.collections.keys).to match_array(expected) + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb new file mode 100644 index 000000000..522771c6c --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +module ForestAdminDatasourceActiveRecord + module Parser + describe Column do + let(:dummy_class) { Class.new { extend Column } } + let(:columns) { User.columns_hash } + + describe 'get_column_type' do + it { expect(dummy_class.get_column_type(User, columns['string_field'])).to eq 'String' } + it { expect(dummy_class.get_column_type(User, columns['text_field'])).to eq 'String' } + it { expect(dummy_class.get_column_type(User, columns['boolean_field'])).to eq 'Boolean' } + it { expect(dummy_class.get_column_type(User, columns['date_field'])).to eq 'Dateonly' } + it { expect(dummy_class.get_column_type(User, columns['datetime_field'])).to eq 'Date' } + it { expect(dummy_class.get_column_type(User, columns['integer_field'])).to eq 'Number' } + it { expect(dummy_class.get_column_type(User, columns['float_field'])).to eq 'Number' } + it { expect(dummy_class.get_column_type(User, columns['decimal_field'])).to eq 'Number' } + it { expect(dummy_class.get_column_type(User, columns['json_field'])).to eq 'Json' } + it { expect(dummy_class.get_column_type(User, columns['time_field'])).to eq 'Time' } + it { expect(dummy_class.get_column_type(User, columns['binary_field'])).to eq 'Binary' } + it { expect(dummy_class.get_column_type(User, columns['enum_field'])).to eq 'Enum' } + end + + describe 'get_enum_values' do + it 'return an empty array if column is not Enum' do + expect(dummy_class.get_enum_values(User, columns['string_field'])).to eq [] + end + + it 'return the enum values' do + expect(dummy_class.get_enum_values(User, columns['enum_field'])).to eq(%w[draft published archived trashed]) + end + end + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/relation_spec.rb b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/relation_spec.rb new file mode 100644 index 000000000..c730faa98 --- /dev/null +++ b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/relation_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +module ForestAdminDatasourceActiveRecord + module Parser + describe Relation do + let(:dummy_class) { Class.new { extend Relation } } + + describe 'associations' do + it 'fetch belongs_to relation' do + associations = dummy_class.associations(Car) + association = associations.select { |a| a.macro == :belongs_to } + + expect(association).not_to be_nil + end + + it 'fetch belongs_to relation' do + associations = dummy_class.associations(Car) + association = associations.select { |a| a.macro == :has_one } + + expect(association).not_to be_nil + end + + it 'fetch has_many relation' do + associations = dummy_class.associations(Car) + association = associations.select { |a| a.macro == :has_many } + + expect(association).not_to be_nil + end + + it 'fetch many_to_many relation defined with has_many through' do + associations = dummy_class.associations(Car) + association = associations.select { |a| a.macro == :has_many && a.through_reflection? } + + expect(association).not_to be_nil + end + + it 'not fetch polymorphic relation' do + associations = dummy_class.associations(Car) + association = associations.select { |a| a.options[:polymorphic] } + + expect(association).to be_empty + end + end + end + end +end diff --git a/packages/forest_admin_datasource_active_record/spec/spec_helper.rb b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb index 7d00295c1..d7cb21db2 100644 --- a/packages/forest_admin_datasource_active_record/spec/spec_helper.rb +++ b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb @@ -1,15 +1,45 @@ -# frozen_string_literal: true +require 'simplecov' +# require 'simplecov_json_formatter' +# SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter +SimpleCov.start do + add_filter 'spec' + add_group "Lib", "lib" +end + +require 'forest_admin_datasource_active_record' +require 'active_record' +require 'database_cleaner-active_record' -require "forest_admin_datasource_active_record" +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../dummy/config/environment', __FILE__) +Rails.application.eager_load! + +ActiveRecord::Migration.verbose = false +ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'db/database.db') +ActiveRecord::MigrationContext.new("db/migrate").migrate RSpec.configure do |config| - # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" - # Disable RSpec exposing methods globally on `Module` and `main` - config.disable_monkey_patching! - config.expect_with :rspec do |c| c.syntax = :expect end + + + # database_cleaner config + config.before(:suite) do + DatabaseCleaner.clean_with :truncation, except: %w[ar_internal_metadata] + end + + config.before do + DatabaseCleaner.strategy = :transaction + end + + config.before do + DatabaseCleaner.start + end + + config.after do + DatabaseCleaner.clean + end end From 1350b19c90db0933c5392dc7809f2a8eac12e5e6 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 27 Sep 2023 14:19:04 +0200 Subject: [PATCH 21/33] chore: update all rspec configurations --- packages/forest_admin_agent/Gemfile | 7 +++-- .../forest_admin_agent/spec/spec_helper.rb | 3 +- .../Gemfile | 13 +++++---- .../20230810094706_create_addresses.rb | 11 ------- .../20230810094707_create_categories.rb | 9 ------ .../db/migrate/20230810095724_create_cars.rb | 16 ---------- .../db/migrate/20230810095725_create_users.rb | 29 ------------------- .../migrate/20230810102316_create_checks.rb | 10 ------- ...30810123423_create_join_table_car_check.rb | 8 ----- .../migrate/20230816094641_create_orders.rb | 10 ------- .../spec/dummy_old/models/address.rb | 3 -- .../spec/dummy_old/models/car.rb | 6 ---- .../spec/dummy_old/models/car_check.rb | 4 --- .../spec/dummy_old/models/category.rb | 2 -- .../spec/dummy_old/models/check.rb | 4 --- .../spec/dummy_old/models/order.rb | 2 -- .../spec/dummy_old/models/user.rb | 6 ---- .../spec/spec_helper.rb | 13 +++++---- .../forest_admin_datasource_toolkit/Gemfile | 18 ++++++------ .../spec/spec_helper.rb | 5 ++-- 20 files changed, 32 insertions(+), 147 deletions(-) delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094706_create_addresses.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094707_create_categories.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095724_create_cars.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095725_create_users.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810102316_create_checks.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810123423_create_join_table_car_check.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230816094641_create_orders.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/address.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/car.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/car_check.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/category.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/check.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/order.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy_old/models/user.rb diff --git a/packages/forest_admin_agent/Gemfile b/packages/forest_admin_agent/Gemfile index ffde56103..3bc7329b7 100644 --- a/packages/forest_admin_agent/Gemfile +++ b/packages/forest_admin_agent/Gemfile @@ -3,7 +3,8 @@ source "https://rubygems.org" gemspec group :development, :test do - gem "rspec", "~> 3.0" - gem 'simplecov', "~> 0.22", require: false - gem 'simplecov_json_formatter', "~> 0.1.4" + gem 'rspec', '~> 3.0' + gem 'simplecov', '~> 0.22', require: false + gem 'simplecov_json_formatter', '~> 0.1.4' + gem 'simplecov-html', '~> 0.10.0' end diff --git a/packages/forest_admin_agent/spec/spec_helper.rb b/packages/forest_admin_agent/spec/spec_helper.rb index 15d1fa68a..3f2e7f3ea 100644 --- a/packages/forest_admin_agent/spec/spec_helper.rb +++ b/packages/forest_admin_agent/spec/spec_helper.rb @@ -1,9 +1,10 @@ require 'lightly' require 'simplecov' require 'simplecov_json_formatter' +require 'simplecov-html' require 'forest_admin_agent' -SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter +SimpleCov.formatters = [SimpleCov::Formatter::JSONFormatter, SimpleCov::Formatter::HTMLFormatter] SimpleCov.start do add_filter 'spec' add_filter 'lib/forest_admin_agent/auth/oauth2/oidc_config.rb' diff --git a/packages/forest_admin_datasource_active_record/Gemfile b/packages/forest_admin_datasource_active_record/Gemfile index 691e802f5..7e0bcc611 100644 --- a/packages/forest_admin_datasource_active_record/Gemfile +++ b/packages/forest_admin_datasource_active_record/Gemfile @@ -5,15 +5,16 @@ gemspec gem 'forest_admin_datasource_toolkit', path: '../forest_admin_datasource_toolkit' -gem "rake", "~> 13.0" +gem 'rake', '~> 13.0' -gem "rubocop", "~> 1.21" +gem 'rubocop', '~> 1.21' -group :test do - gem "rspec-rails", "~> 3.0" +group :development, :test do + gem 'rspec-rails', '~> 3.0' gem 'rails' gem 'database_cleaner-active_record' gem 'sqlite3' - gem 'simplecov', "~> 0.22", require: false - gem 'simplecov_json_formatter', "~> 0.1.4" + gem 'simplecov', '~> 0.22', require: false + gem 'simplecov_json_formatter', '~> 0.1.4' + gem 'simplecov-html', '~> 0.10.0' end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094706_create_addresses.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094706_create_addresses.rb deleted file mode 100644 index 72e8a6a39..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094706_create_addresses.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateAddresses < ActiveRecord::Migration[7.0] - def change - create_table :addresses do |t| - t.string :city - t.string :zip_code - t.string :street - t.references :addressable, polymorphic: true - t.timestamps - end - end -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094707_create_categories.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094707_create_categories.rb deleted file mode 100644 index 5d9d1db53..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810094707_create_categories.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateCategories < ActiveRecord::Migration[7.0] - def change - create_table :categories do |t| - t.string :label - - t.timestamps - end - end -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095724_create_cars.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095724_create_cars.rb deleted file mode 100644 index cb65d175a..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095724_create_cars.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateCars < ActiveRecord::Migration[7.0] - def change - create_table :cars do |t| - t.references :category, null: false, foreign_key: true - t.string :reference - t.string :model - t.string :brand - t.integer :year - t.integer :nb_seats - t.boolean :is_manual - t.json :options - - t.timestamps - end - end -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095725_create_users.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095725_create_users.rb deleted file mode 100644 index 2911bf78e..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810095725_create_users.rb +++ /dev/null @@ -1,29 +0,0 @@ -class CreateUsers < ActiveRecord::Migration[7.0] - def change - create_table :users do |t| - t.references :car, null: false, foreign_key: true - - t.string :first_name - t.string :last_name - - t.string :string_field - t.text :text_field - t.boolean :boolean_field - t.date :date_field - t.datetime :datetime_field - t.integer :integer_field - t.float :float_field - t.decimal :decimal_field - t.json :json_field - t.time :time_field - t.binary :binary_field - t.integer :enum_field, default: 0 - # t.jsonb :options_b - # t.hstore :options_hstore - # t.citext :citext_field - # t.uuid :uuid - - t.timestamps - end - end -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810102316_create_checks.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810102316_create_checks.rb deleted file mode 100644 index 90874d97e..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810102316_create_checks.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateChecks < ActiveRecord::Migration[7.0] - def change - create_table :checks do |t| - t.string :garage_name - t.date :date - - t.timestamps - end - end -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810123423_create_join_table_car_check.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810123423_create_join_table_car_check.rb deleted file mode 100644 index 1b69d5814..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230810123423_create_join_table_car_check.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateJoinTableCarCheck < ActiveRecord::Migration[7.0] - def change - create_table :car_checks do |t| - t.references :car, null: false, foreign_key: true - t.references :check, null: false, foreign_key: true - end - end -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230816094641_create_orders.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230816094641_create_orders.rb deleted file mode 100644 index d0e650766..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/db/migrate/20230816094641_create_orders.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateOrders < ActiveRecord::Migration[7.0] - def change - create_table :orders do |t| - t.string :reference - t.binary :invoice - - t.timestamps - end - end -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/address.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/address.rb deleted file mode 100644 index 0903be47c..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/address.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Address < ActiveRecord::Base - belongs_to :addressable, polymorphic: true -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car.rb deleted file mode 100644 index 1c5947acb..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Car < ActiveRecord::Base - belongs_to :category - has_one :user - has_many :car_checks - has_many :checks, through: :car_checks -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car_check.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car_check.rb deleted file mode 100644 index 68111517f..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/car_check.rb +++ /dev/null @@ -1,4 +0,0 @@ -class CarCheck < ActiveRecord::Base - belongs_to :car - belongs_to :check -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/category.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/category.rb deleted file mode 100644 index 910a0098c..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/category.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Category < ActiveRecord::Base -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/check.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/check.rb deleted file mode 100644 index 8f1d9814b..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/check.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Check < ActiveRecord::Base - has_many :car_checks - has_many :cars, through: :car_checks -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/order.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/order.rb deleted file mode 100644 index 0bcb15832..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/order.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Order < ActiveRecord::Base -end diff --git a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/user.rb b/packages/forest_admin_datasource_active_record/spec/dummy_old/models/user.rb deleted file mode 100644 index 6f61da046..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy_old/models/user.rb +++ /dev/null @@ -1,6 +0,0 @@ -class User < ActiveRecord::Base - belongs_to :car - has_one :address, as: :addressable - - enum :enum_field, { draft: 0, published: 1, archived: 2, trashed: 3 } -end diff --git a/packages/forest_admin_datasource_active_record/spec/spec_helper.rb b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb index d7cb21db2..3d2b14cf1 100644 --- a/packages/forest_admin_datasource_active_record/spec/spec_helper.rb +++ b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb @@ -1,15 +1,16 @@ require 'simplecov' -# require 'simplecov_json_formatter' -# SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter +require 'simplecov_json_formatter' +require 'simplecov-html' +require 'forest_admin_datasource_active_record' +require 'active_record' +require 'database_cleaner-active_record' + +SimpleCov.formatters = [SimpleCov::Formatter::JSONFormatter, SimpleCov::Formatter::HTMLFormatter] SimpleCov.start do add_filter 'spec' add_group "Lib", "lib" end -require 'forest_admin_datasource_active_record' -require 'active_record' -require 'database_cleaner-active_record' - ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../dummy/config/environment', __FILE__) Rails.application.eager_load! diff --git a/packages/forest_admin_datasource_toolkit/Gemfile b/packages/forest_admin_datasource_toolkit/Gemfile index 7c022e942..4dcf9df9f 100644 --- a/packages/forest_admin_datasource_toolkit/Gemfile +++ b/packages/forest_admin_datasource_toolkit/Gemfile @@ -3,12 +3,12 @@ source "https://rubygems.org" # Specify your gem's dependencies in forest_admin_datasource_toolkit.gemspec gemspec -gem "rake", "~> 13.0" - -gem "rspec", "~> 3.0" - -gem "rubocop", "~> 1.21" - -gem 'simplecov', "~> 0.22", require: false - -gem 'simplecov_json_formatter', "~> 0.1.4" +gem 'rake', '~> 13.0' +gem 'rubocop', '~> 1.21' + +group :development, :test do + gem 'rspec', '~> 3.0' + gem 'simplecov', '~> 0.22', require: false + gem 'simplecov_json_formatter', '~> 0.1.4' + gem 'simplecov-html', '~> 0.10.0' +end diff --git a/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb b/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb index 3d4f8b93c..410ceae7c 100644 --- a/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb +++ b/packages/forest_admin_datasource_toolkit/spec/spec_helper.rb @@ -1,8 +1,9 @@ require 'simplecov' require 'simplecov_json_formatter' -require "forest_admin_datasource_toolkit" +require 'simplecov-html' +require 'forest_admin_datasource_toolkit' -SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter +SimpleCov.formatters = [SimpleCov::Formatter::JSONFormatter, SimpleCov::Formatter::HTMLFormatter] SimpleCov.start do add_filter 'spec' end From d44ea929affedbc92383814cb2197e3645d8ec80 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 27 Sep 2023 14:28:23 +0200 Subject: [PATCH 22/33] chore: fix dependency version --- packages/forest_admin_agent/Gemfile | 2 +- packages/forest_admin_datasource_active_record/Gemfile | 2 +- packages/forest_admin_datasource_toolkit/Gemfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/forest_admin_agent/Gemfile b/packages/forest_admin_agent/Gemfile index 3bc7329b7..47fcac500 100644 --- a/packages/forest_admin_agent/Gemfile +++ b/packages/forest_admin_agent/Gemfile @@ -6,5 +6,5 @@ group :development, :test do gem 'rspec', '~> 3.0' gem 'simplecov', '~> 0.22', require: false gem 'simplecov_json_formatter', '~> 0.1.4' - gem 'simplecov-html', '~> 0.10.0' + gem 'simplecov-html', '~> 0.12.3' end diff --git a/packages/forest_admin_datasource_active_record/Gemfile b/packages/forest_admin_datasource_active_record/Gemfile index 7e0bcc611..b22d06e4b 100644 --- a/packages/forest_admin_datasource_active_record/Gemfile +++ b/packages/forest_admin_datasource_active_record/Gemfile @@ -16,5 +16,5 @@ group :development, :test do gem 'sqlite3' gem 'simplecov', '~> 0.22', require: false gem 'simplecov_json_formatter', '~> 0.1.4' - gem 'simplecov-html', '~> 0.10.0' + gem 'simplecov-html', '~> 0.12.3' end diff --git a/packages/forest_admin_datasource_toolkit/Gemfile b/packages/forest_admin_datasource_toolkit/Gemfile index 4dcf9df9f..be2cc6dab 100644 --- a/packages/forest_admin_datasource_toolkit/Gemfile +++ b/packages/forest_admin_datasource_toolkit/Gemfile @@ -10,5 +10,5 @@ group :development, :test do gem 'rspec', '~> 3.0' gem 'simplecov', '~> 0.22', require: false gem 'simplecov_json_formatter', '~> 0.1.4' - gem 'simplecov-html', '~> 0.10.0' + gem 'simplecov-html', '~> 0.12.3' end From 75f36623ec4cea2b3557f54d9886f6895668efcb Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 27 Sep 2023 14:38:58 +0200 Subject: [PATCH 23/33] chore: lint --- .rubocop.yml | 2 ++ packages/forest_admin_agent/Gemfile | 2 +- packages/forest_admin_datasource_active_record/Gemfile | 8 ++++---- .../collection_spec.rb | 1 + .../datasource_spec.rb | 2 +- .../parser/relation_spec.rb | 2 +- .../spec/spec_helper.rb | 5 ++--- packages/forest_admin_datasource_toolkit/Gemfile | 2 +- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 47f923166..2582967dc 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,6 +5,8 @@ require: AllCops: TargetRubyVersion: 3.0 NewCops: enable + Exclude: + - 'packages/forest_admin_datasource_active_record/spec/dummy/**/*' Gemspec/OrderedDependencies: Exclude: diff --git a/packages/forest_admin_agent/Gemfile b/packages/forest_admin_agent/Gemfile index 47fcac500..3ca8888b8 100644 --- a/packages/forest_admin_agent/Gemfile +++ b/packages/forest_admin_agent/Gemfile @@ -5,6 +5,6 @@ gemspec group :development, :test do gem 'rspec', '~> 3.0' gem 'simplecov', '~> 0.22', require: false - gem 'simplecov_json_formatter', '~> 0.1.4' gem 'simplecov-html', '~> 0.12.3' + gem 'simplecov_json_formatter', '~> 0.1.4' end diff --git a/packages/forest_admin_datasource_active_record/Gemfile b/packages/forest_admin_datasource_active_record/Gemfile index b22d06e4b..a20f8da71 100644 --- a/packages/forest_admin_datasource_active_record/Gemfile +++ b/packages/forest_admin_datasource_active_record/Gemfile @@ -10,11 +10,11 @@ gem 'rake', '~> 13.0' gem 'rubocop', '~> 1.21' group :development, :test do - gem 'rspec-rails', '~> 3.0' - gem 'rails' gem 'database_cleaner-active_record' - gem 'sqlite3' + gem 'rails' + gem 'rspec-rails', '~> 3.0' gem 'simplecov', '~> 0.22', require: false - gem 'simplecov_json_formatter', '~> 0.1.4' gem 'simplecov-html', '~> 0.12.3' + gem 'simplecov_json_formatter', '~> 0.1.4' + gem 'sqlite3' end diff --git a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/collection_spec.rb b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/collection_spec.rb index 9478489d7..dad32a50c 100644 --- a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/collection_spec.rb +++ b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/collection_spec.rb @@ -24,6 +24,7 @@ module ForestAdminDatasourceActiveRecord ) end end + describe 'fetch_associations' do it 'add all relation of model to the collection' do expect(collection.fields.keys).to include('category', 'user', 'car_checks', 'checks') diff --git a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/datasource_spec.rb b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/datasource_spec.rb index c2da58645..c7e6a468d 100644 --- a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/datasource_spec.rb +++ b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/datasource_spec.rb @@ -3,7 +3,7 @@ module ForestAdminDatasourceActiveRecord describe Datasource do it 'fetch all models' do - datasource = Datasource.new(adapter: 'sqlite3', database: 'db/database.db') + datasource = described_class.new(adapter: 'sqlite3', database: 'db/database.db') expected = %w[InternalMetadata SchemaMigration User Order Check Category CarCheck Car Address] expect(datasource.collections.keys).to match_array(expected) diff --git a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/relation_spec.rb b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/relation_spec.rb index c730faa98..73d429d49 100644 --- a/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/relation_spec.rb +++ b/packages/forest_admin_datasource_active_record/spec/lib/forest_admin_datasource_active_record/parser/relation_spec.rb @@ -13,7 +13,7 @@ module Parser expect(association).not_to be_nil end - it 'fetch belongs_to relation' do + it 'fetch has_one relation' do associations = dummy_class.associations(Car) association = associations.select { |a| a.macro == :has_one } diff --git a/packages/forest_admin_datasource_active_record/spec/spec_helper.rb b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb index 3d2b14cf1..b51410a4e 100644 --- a/packages/forest_admin_datasource_active_record/spec/spec_helper.rb +++ b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb @@ -6,13 +6,13 @@ require 'database_cleaner-active_record' SimpleCov.formatters = [SimpleCov::Formatter::JSONFormatter, SimpleCov::Formatter::HTMLFormatter] -SimpleCov.start do +SimpleCov.start do add_filter 'spec' add_group "Lib", "lib" end ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../dummy/config/environment', __FILE__) +require File.expand_path('dummy/config/environment', __dir__) Rails.application.eager_load! ActiveRecord::Migration.verbose = false @@ -26,7 +26,6 @@ c.syntax = :expect end - # database_cleaner config config.before(:suite) do DatabaseCleaner.clean_with :truncation, except: %w[ar_internal_metadata] diff --git a/packages/forest_admin_datasource_toolkit/Gemfile b/packages/forest_admin_datasource_toolkit/Gemfile index be2cc6dab..05fdf2813 100644 --- a/packages/forest_admin_datasource_toolkit/Gemfile +++ b/packages/forest_admin_datasource_toolkit/Gemfile @@ -9,6 +9,6 @@ gem 'rubocop', '~> 1.21' group :development, :test do gem 'rspec', '~> 3.0' gem 'simplecov', '~> 0.22', require: false - gem 'simplecov_json_formatter', '~> 0.1.4' gem 'simplecov-html', '~> 0.12.3' + gem 'simplecov_json_formatter', '~> 0.1.4' end From 0bce8ddab7849c11c8a2248d6720bd484075730b Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 27 Sep 2023 14:46:01 +0200 Subject: [PATCH 24/33] chore: force rename case sensitive relations folder --- .../schema/{Relations => relations}/many_to_many_schema.rb | 0 .../schema/{Relations => relations}/many_to_one_schema.rb | 0 .../schema/{Relations => relations}/one_to_many_schema.rb | 0 .../schema/{Relations => relations}/one_to_one_schema.rb | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/{Relations => relations}/many_to_many_schema.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/{Relations => relations}/many_to_one_schema.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/{Relations => relations}/one_to_many_schema.rb (100%) rename packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/{Relations => relations}/one_to_one_schema.rb (100%) diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_many_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_many_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_one_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/many_to_one_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/many_to_one_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/many_to_one_schema.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_many_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/one_to_many_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_many_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/one_to_many_schema.rb diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_one_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/one_to_one_schema.rb similarity index 100% rename from packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/Relations/one_to_one_schema.rb rename to packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/one_to_one_schema.rb From 09e14aae3f33eb190ddbac6778c2be6a4aca2a6c Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Wed, 27 Sep 2023 15:30:06 +0200 Subject: [PATCH 25/33] test: add missing tests on datasource toolkit --- .../.gitignore | 3 + .../db/test.db | Bin 20480 -> 0 bytes .../spec/dummy/db/database.db | Bin 20480 -> 0 bytes .../spec/dummy/log/test.log | 307 ++++++++++++++++++ .../spec/spec_helper.rb | 8 +- .../collection_spec.rb | 22 ++ .../contracts/collection_contract_spec.rb | 1 + 7 files changed, 338 insertions(+), 3 deletions(-) delete mode 100644 packages/forest_admin_datasource_active_record/db/test.db delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/db/database.db diff --git a/packages/forest_admin_datasource_active_record/.gitignore b/packages/forest_admin_datasource_active_record/.gitignore index b04a8c840..3d3f0a8b1 100644 --- a/packages/forest_admin_datasource_active_record/.gitignore +++ b/packages/forest_admin_datasource_active_record/.gitignore @@ -7,5 +7,8 @@ /spec/reports/ /tmp/ +/spec/dummy/tmp/ +/spec/dummy/db/*.db + # rspec failure tracking .rspec_status diff --git a/packages/forest_admin_datasource_active_record/db/test.db b/packages/forest_admin_datasource_active_record/db/test.db deleted file mode 100644 index 150268908c6695db8c9291daf68ab8bd5be1563c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20480 zcmeI%J#W)M7{Kv!URpqE(k(*=PR`Ouv}qC$Ii2EX9?(?v?)H z%85$*mnxMfr#*Rc*6GOC-IuTY?zuc}pFfc9L`7pg%d&xfs+G}$Kp9us>uVFndiP;% zcD_v+f669Sr_^2)HY)EtM})~hUynXVcKI8qu^CQ}gJriHG?qn+*Uo08UUzQpPkBcD zOC75q4nL&Igu`UC5Xk)vvoN2jOmsT3C(ml0RW>hE^K%=Ov-+wM7QQ%WEQGSP{hjPr zwUu?-Sw}+v0R#|0009ILKmY**5I_Kdbrram6~_91T^}!XA%Fk^2q1s}0tg_000Iag zFcrw&|2ySx!frGK5I_I{1Q0*~0R#|0009IL_&)?ronp1>`#PC~=`e|PVg~v`jUyA- zQ1hVK+B*Ysq=J8C^TYBlz4sO255p2^<-JLR9kZZrfCKmY**5I_I{1Q0*~0R#|O N7lBf~dUx*cgFiE<%fbKv diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/db/database.db b/packages/forest_admin_datasource_active_record/spec/dummy/db/database.db deleted file mode 100644 index 28a7ba1ae1c50e83930cb12fec7a191e4afe6efc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20480 zcmeI%J#W)M7{Kv!URpqE(gkJcz{y=2i8gMEQ?)D@6ai`|5YnMyu#V(P4Y32xB`Rb2 zPVhPSDljo}j?^e9$qb7AC;M`K?s4qr=PVb$dEJVPmKTFGRz@C(P2o7=k(5G+yxog- zziBx;DBK*_PiJPlY?v2&AAW3L1zm_EvM*sl?5I_I{1Q0*~0R#~E zCj!@<{CdUrov$ZGz3Xe0hEZa4ny7vlYomI~s70~DlXf%cG-W4v+-gd9QHm>f+>iQ; zE5|DBUaC}{zU;`;vsO#KYCnGww9n;9^ZdSa$ErWl(<~e4rdk=@3zc!Dy}mY4talpK z>G?Kg^eLNIo>F~USgXAC9T6oxeKq{tx69v9jm%(j94@-uaDP#>c;&2DYBlHj-h^k^ zz0|P^% Date: Wed, 27 Sep 2023 18:14:25 +0200 Subject: [PATCH 26/33] test: add tests on generator field for all relations schema --- .rubocop.yml | 7 + packages/forest_admin_agent/Gemfile | 2 + .../utils/schema/generator_field.rb | 16 +- .../generator_field_many_to_many_spec.rb | 141 + .../generator_field_one_to_many_spec.rb | 92 + .../schema/generator_field_one_to_one_spec.rb | 95 + .../forest_admin_agent/spec/spec_helper.rb | 2 + .../.gitignore | 1 + .../spec/dummy/log/test.log | 3451 ----------------- .../spec/spec_helper.rb | 5 +- .../schema/column_schema.rb | 2 +- 11 files changed, 350 insertions(+), 3464 deletions(-) create mode 100644 packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_many_to_many_spec.rb create mode 100644 packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_one_to_many_spec.rb create mode 100644 packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_one_to_one_spec.rb delete mode 100644 packages/forest_admin_datasource_active_record/spec/dummy/log/test.log diff --git a/.rubocop.yml b/.rubocop.yml index 2582967dc..3baec4f8e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -128,6 +128,10 @@ Style/WordArray: EnforcedStyle: percent MinSize: 3 +Style/SymbolArray: + Exclude: + - 'packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_many_to_many_spec.rb' + Style/StringLiteralsInInterpolation: Enabled: true EnforcedStyle: double_quotes @@ -145,6 +149,9 @@ Metrics/ParameterLists: - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rb' - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb' +Metrics/ModuleLength: + CountAsOne: [ 'array', 'hash', 'method_call' ] + Metrics/MethodLength: CountAsOne: ['array', 'hash', 'method_call'] Max: 20 diff --git a/packages/forest_admin_agent/Gemfile b/packages/forest_admin_agent/Gemfile index 3ca8888b8..7e3afca3c 100644 --- a/packages/forest_admin_agent/Gemfile +++ b/packages/forest_admin_agent/Gemfile @@ -2,6 +2,8 @@ source "https://rubygems.org" gemspec +gem 'forest_admin_datasource_toolkit', path: '../forest_admin_datasource_toolkit' + group :development, :test do gem 'rspec', '~> 3.0' gem 'simplecov', '~> 0.22', require: false diff --git a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb index 99b10a13c..e0bf1b637 100644 --- a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb +++ b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb @@ -3,10 +3,10 @@ module Utils module Schema class GeneratorField RELATION_MAP = { - ManyToMany: 'BelongsToMany', - ManyToOne: 'BelongsTo', - OneToMany: 'HasMany', - OneToOne: 'HasOne' + 'ManyToMany' => 'BelongsToMany', + 'ManyToOne' => 'BelongsTo', + 'OneToMany' => 'HasMany', + 'OneToOne' => 'HasOne' }.freeze def self.build_schema(collection, name) @@ -37,7 +37,7 @@ def build_column_schema(collection, name) field: name, integration: nil, inverseOf: nil, - isFilterable: true, # TODO: FrontendFilterableUtils.isFilterable(), + isFilterable: false, # TODO: FrontendFilterableUtils.isFilterable(), isPrimaryKey: column.is_primary_key, # When a column is a foreign key, it is readonly. @@ -82,7 +82,7 @@ def build_many_to_many_schema(relation, collection, foreign_collection, base_sch base_schema.merge( { - type: target_field.column_type, + type: [target_field.column_type], defaultValue: nil, isFilterable: false, isPrimaryKey: false, @@ -102,7 +102,7 @@ def build_one_to_many_schema(relation, collection, foreign_collection, base_sche base_schema.merge( { - type: target_field.column_type, + type: [target_field.column_type], defaultValue: nil, isFilterable: false, isPrimaryKey: false, @@ -161,7 +161,7 @@ def build_relation_schema(collection, name) enums: nil, integration: nil, isReadOnly: nil, - isVirtual: nil, + isVirtual: false, inverseOf: nil, # TODO: CollectionUtils::getInverseRelation(collection, name) relationship: RELATION_MAP[relation.type] } diff --git a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_many_to_many_spec.rb b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_many_to_many_spec.rb new file mode 100644 index 000000000..cddccf621 --- /dev/null +++ b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_many_to_many_spec.rb @@ -0,0 +1,141 @@ +require 'spec_helper' + +module ForestAdminAgent + module Utils + module Schema + include ForestAdminDatasourceToolkit + include ForestAdminDatasourceToolkit::Schema + describe GeneratorField do + context 'when field is OneToMany relation' do + before do + @datasource = Datasource.new + collection_book = Collection.new(@datasource, 'Book') + collection_book.add_fields( + { + 'id' => ColumnSchema.new(column_type: 'Number', is_primary_key: true), + 'reviewers' => Relations::ManyToManySchema.new( + origin_key: 'book_id', + origin_key_target: 'id', + foreign_collection: 'Person', + foreign_key: 'person_id', + foreign_key_target: 'id', + through_collection: 'BookPerson' + ) + } + ) + + collection_book_person = Collection.new(@datasource, 'BookPerson') + collection_book_person.add_fields( + { + 'person_id' => ColumnSchema.new(column_type: 'Number', is_read_only: true), + 'person' => Relations::ManyToOneSchema.new( + foreign_key: 'person_id', + foreign_key_target: 'id', + foreign_collection: 'Person' + ), + 'book_id' => ColumnSchema.new(column_type: 'Number', is_read_only: true), + 'book' => Relations::ManyToOneSchema.new( + foreign_key: 'book_id', + foreign_key_target: 'id', + foreign_collection: 'Book' + ) + } + ) + + collection_person = Collection.new(@datasource, 'Person') + collection_person.add_fields( + { + 'id' => ColumnSchema.new(column_type: 'Number', is_primary_key: true), + 'books' => Relations::ManyToManySchema.new( + origin_key: 'person_id', + origin_key_target: 'id', + foreign_collection: 'Book', + foreign_key: 'book_id', + foreign_key_target: 'id', + through_collection: 'BookPerson' + ) + } + ) + + @datasource.add_collection(collection_book) + @datasource.add_collection(collection_book_person) + @datasource.add_collection(collection_person) + end + + it 'generate relation' do + schema = described_class.build_schema(@datasource.collection('Book'), 'reviewers') + + expect(schema).to match( + { + field: 'reviewers', + inverseOf: nil, + reference: 'Person.id', + relationship: 'BelongsToMany', + type: ['Number'], + defaultValue: nil, + enums: nil, + integration: nil, + isFilterable: false, + isPrimaryKey: false, + isReadOnly: true, + isRequired: false, + isSortable: true, + isVirtual: false, + validations: {} + } + ) + end + + it 'sort schema property' do + schema = described_class.build_schema(@datasource.collection('Book'), 'reviewers') + + expect(schema.keys).to eq( + [ + :defaultValue, + :enums, + :field, + :integration, + :inverseOf, + :isFilterable, + :isPrimaryKey, + :isReadOnly, + :isRequired, + :isSortable, + :isVirtual, + :reference, + :relationship, + :type, + :validations + ] + ) + end + + context 'when the field reference is the primary key' do + it 'the many to one relation should not be a primary key' do + schema = described_class.build_schema(@datasource.collection('BookPerson'), 'book') + expect(schema).to match( + { + field: 'book', + inverseOf: nil, + reference: 'Book.id', + relationship: 'BelongsTo', + type: 'Number', + defaultValue: nil, + enums: nil, + integration: nil, + isFilterable: true, + isPrimaryKey: false, + isReadOnly: true, + isRequired: false, + isSortable: false, + isVirtual: false, + validations: {} + } + ) + end + end + end + end + end + end +end diff --git a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_one_to_many_spec.rb b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_one_to_many_spec.rb new file mode 100644 index 000000000..e725dada3 --- /dev/null +++ b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_one_to_many_spec.rb @@ -0,0 +1,92 @@ +require 'spec_helper' + +module ForestAdminAgent + module Utils + module Schema + include ForestAdminDatasourceToolkit + include ForestAdminDatasourceToolkit::Schema + describe GeneratorField do + context 'when field is OneToMany relation' do + before do + @datasource = Datasource.new + collection_book = Collection.new(@datasource, 'Book') + collection_book.add_fields( + { + 'id' => ColumnSchema.new(column_type: 'Number', is_primary_key: true), + 'author_id' => ColumnSchema.new(column_type: 'Number', is_read_only: true, is_sortable: true), + 'author' => Relations::ManyToOneSchema.new( + foreign_key: 'author_id', + foreign_key_target: 'id', + foreign_collection: 'Person' + ) + } + ) + + collection_person = Collection.new(@datasource, 'Person') + collection_person.add_fields( + { + 'id' => ColumnSchema.new(column_type: 'Number', is_primary_key: true), + 'written_books' => Relations::OneToManySchema.new( + origin_key: 'author_id', + origin_key_target: 'id', + foreign_collection: 'Book' + ) + } + ) + + @datasource.add_collection(collection_book) + @datasource.add_collection(collection_person) + end + + it 'generate relation' do + schema = described_class.build_schema(@datasource.collection('Book'), 'author') + + expect(schema).to match( + { + field: 'author', + inverseOf: nil, + reference: 'Person.id', + relationship: 'BelongsTo', + type: 'Number', + defaultValue: nil, + enums: nil, + integration: nil, + isFilterable: true, + isPrimaryKey: false, + isReadOnly: true, + isRequired: false, + isSortable: true, + isVirtual: false, + validations: {} + } + ) + end + + it 'generate inverse relation' do + schema = described_class.build_schema(@datasource.collection('Person'), 'written_books') + + expect(schema).to match( + { + field: 'written_books', + inverseOf: nil, + reference: 'Book.id', + relationship: 'HasMany', + type: ['Number'], + isSortable: true, + defaultValue: nil, + enums: nil, + integration: nil, + isFilterable: false, + isPrimaryKey: false, + isReadOnly: true, + isRequired: false, + isVirtual: false, + validations: {} + } + ) + end + end + end + end + end +end diff --git a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_one_to_one_spec.rb b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_one_to_one_spec.rb new file mode 100644 index 000000000..aed8563f4 --- /dev/null +++ b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_one_to_one_spec.rb @@ -0,0 +1,95 @@ +require 'spec_helper' + +module ForestAdminAgent + module Utils + module Schema + include ForestAdminDatasourceToolkit + include ForestAdminDatasourceToolkit::Schema + describe GeneratorField do + context 'when field is OneToOne relation' do + before do + @datasource = Datasource.new + collection_book = Collection.new(@datasource, 'Book') + collection_book.add_fields( + { + 'id' => ColumnSchema.new(column_type: 'Number', is_primary_key: true), + 'author_id' => ColumnSchema.new(column_type: 'String', is_read_only: true, is_sortable: true), + 'author' => Relations::ManyToOneSchema.new( + foreign_key: 'author_id', + foreign_key_target: 'id', + foreign_collection: 'Person' + ) + } + ) + + collection_person = Collection.new(@datasource, 'Person') + collection_person.add_fields( + { + 'id' => ColumnSchema.new(column_type: 'Number', is_primary_key: true), + 'book' => Relations::OneToOneSchema.new( + origin_key: 'author_id', + origin_key_target: 'id', + foreign_collection: 'Book' + ) + } + ) + + @datasource.add_collection(collection_book) + @datasource.add_collection(collection_person) + end + + it 'generate relation' do + schema = described_class.build_schema(@datasource.collection('Person'), 'book') + + expect(schema).to match( + { + field: 'book', + inverseOf: nil, + + reference: 'Book.id', + relationship: 'HasOne', + type: 'String', + + defaultValue: nil, + enums: nil, + integration: nil, + isFilterable: true, + isPrimaryKey: false, + isReadOnly: true, + isRequired: false, + isSortable: false, + isVirtual: false, + validations: {} + } + ) + end + + it 'generate inverse relation' do + schema = described_class.build_schema(@datasource.collection('Book'), 'author') + + expect(schema).to match( + { + field: 'author', + inverseOf: nil, + reference: 'Person.id', + relationship: 'BelongsTo', + type: 'String', + isSortable: true, + + defaultValue: nil, + enums: nil, + integration: nil, + isFilterable: true, + isPrimaryKey: false, + isReadOnly: true, + isRequired: false, + isVirtual: false, + validations: {} + } + ) + end + end + end + end + end +end diff --git a/packages/forest_admin_agent/spec/spec_helper.rb b/packages/forest_admin_agent/spec/spec_helper.rb index 3f2e7f3ea..6204a0503 100644 --- a/packages/forest_admin_agent/spec/spec_helper.rb +++ b/packages/forest_admin_agent/spec/spec_helper.rb @@ -3,6 +3,8 @@ require 'simplecov_json_formatter' require 'simplecov-html' require 'forest_admin_agent' +require 'forest_admin_datasource_toolkit' +require 'singleton' SimpleCov.formatters = [SimpleCov::Formatter::JSONFormatter, SimpleCov::Formatter::HTMLFormatter] SimpleCov.start do diff --git a/packages/forest_admin_datasource_active_record/.gitignore b/packages/forest_admin_datasource_active_record/.gitignore index 3d3f0a8b1..971206634 100644 --- a/packages/forest_admin_datasource_active_record/.gitignore +++ b/packages/forest_admin_datasource_active_record/.gitignore @@ -8,6 +8,7 @@ /tmp/ /spec/dummy/tmp/ +/spec/dummy/log/ /spec/dummy/db/*.db # rspec failure tracking diff --git a/packages/forest_admin_datasource_active_record/spec/dummy/log/test.log b/packages/forest_admin_datasource_active_record/spec/dummy/log/test.log deleted file mode 100644 index f2cd8a06b..000000000 --- a/packages/forest_admin_datasource_active_record/spec/dummy/log/test.log +++ /dev/null @@ -1,3451 +0,0 @@ -  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 15:48:03.846683"], ["updated_at", "2023-09-26 15:48:03.846683"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 15:48:14.255776"], ["updated_at", "2023-09-26 15:48:14.255776"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 15:48:25.381307"], ["updated_at", "2023-09-26 15:48:25.381307"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 15:56:59.567777"], ["updated_at", "2023-09-26 15:56:59.567777"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.1ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 15:59:17.589551"], ["updated_at", "2023-09-26 15:59:17.589551"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.1ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.1ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.1ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 15:59:26.100326"], ["updated_at", "2023-09-26 15:59:26.100326"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 15:59:31.682930"], ["updated_at", "2023-09-26 15:59:31.682930"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 15:59:38.644711"], ["updated_at", "2023-09-26 15:59:38.644711"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 15:59:47.348040"], ["updated_at", "2023-09-26 15:59:47.348040"]] - TRANSACTION (0.0ms) commit transaction -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.1ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:00:30.006198"], ["updated_at", "2023-09-26 16:00:30.006198"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.1ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.1ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:00:39.115009"], ["updated_at", "2023-09-26 16:00:39.115009"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:00:48.028118"], ["updated_at", "2023-09-26 16:00:48.028118"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.1ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:01:28.349212"], ["updated_at", "2023-09-26 16:01:28.349212"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:01:51.016029"], ["updated_at", "2023-09-26 16:01:51.016029"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:02:34.615056"], ["updated_at", "2023-09-26 16:02:34.615056"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:03:30.305565"], ["updated_at", "2023-09-26 16:03:30.305565"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:03:48.840641"], ["updated_at", "2023-09-26 16:03:48.840641"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:05:44.735542"], ["updated_at", "2023-09-26 16:05:44.735542"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.1ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.1ms) begin transaction -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:06:58.983042"], ["updated_at", "2023-09-26 16:06:58.983042"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.1ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-26 16:08:33.711062"], ["updated_at", "2023-09-26 16:08:33.711062"]] - TRANSACTION (0.0ms) commit transaction -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction -  (0.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-27 07:27:34.400015"], ["updated_at", "2023-09-27 07:27:34.400015"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.1ms) begin transaction -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-27 07:33:34.792327"], ["updated_at", "2023-09-27 07:33:34.792327"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.1ms) begin transaction -  (0.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-27 07:36:31.843627"], ["updated_at", "2023-09-27 07:36:31.843627"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.1ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.1ms) begin transaction -  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.0ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.0ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.0ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-27 07:40:55.347017"], ["updated_at", "2023-09-27 07:40:55.347017"]] - TRANSACTION (0.0ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.0ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.2ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.1ms) begin transaction -  (0.6ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (0.4ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Pluck (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.2ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.0ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.2ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.2ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.2ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.3ms) commit transaction - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-27 07:52:03.512100"], ["updated_at", "2023-09-27 07:52:03.512100"]] - TRANSACTION (0.2ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.5ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.4ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.4ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.4ms) DELETE FROM "checks" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.5ms) DELETE FROM "car_checks" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.1ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (1.1ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.6ms) DELETE FROM "categories" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (0.7ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.1ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.4ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.5ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.1ms) TRUNCATE TABLE "orders" -  (0.4ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - ActiveRecord::SchemaMigration Pluck (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC - ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (2.7ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (1.9ms) DELETE FROM "categories" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (1.8ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.1ms) TRUNCATE TABLE "users" -  (1.8ms) DELETE FROM "users" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (1.7ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (1.8ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (1.7ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - ActiveRecord::SchemaMigration Pluck (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC - ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.8ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.4ms) DELETE FROM "categories" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (0.4ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.1ms) TRUNCATE TABLE "checks" -  (0.5ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.5ms) DELETE FROM "car_checks" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.4ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.1ms) begin transaction - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.6ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.3ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.4ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.1ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.1ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.2ms) begin transaction - ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.9ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (1.1ms) DELETE FROM "categories" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.7ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.1ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.3ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.1ms) begin transaction - ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.7ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.7ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.6ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.4ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.6ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.8ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.3ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.1ms) TRUNCATE TABLE "users" -  (0.5ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.1ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.7ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (1.0ms) DELETE FROM "categories" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.4ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (1.1ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.2ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (1.8ms) TRUNCATE TABLE "categories" -  (0.5ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.5ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (1.9ms) TRUNCATE TABLE "users" -  (0.7ms) DELETE FROM "users" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (1.8ms) TRUNCATE TABLE "checks" -  (0.4ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (1.9ms) TRUNCATE TABLE "car_checks" -  (0.5ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (1.4ms) TRUNCATE TABLE "orders" -  (0.4ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (1.7ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (1.0ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (1.1ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (1.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (1.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (1.1ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (1.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (1.1ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.9ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.4ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.5ms) DELETE FROM "users" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.4ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.9ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.4ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (0.4ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (3.9ms) DELETE FROM "users" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.1ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.6ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.4ms) DELETE FROM "categories" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.6ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.3ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.9ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.6ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.3ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.5ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.7ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.4ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.3ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.3ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (1.6ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (1.1ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (1.1ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (1.0ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (1.0ms) DELETE FROM "checks" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.1ms) TRUNCATE TABLE "car_checks" -  (1.3ms) DELETE FROM "car_checks" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.1ms) TRUNCATE TABLE "orders" -  (1.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.8ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.4ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (0.4ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.9ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.4ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.4ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.6ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.3ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (0.4ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.1ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (1.7ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (1.2ms) DELETE FROM "categories" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (1.1ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.1ms) TRUNCATE TABLE "users" -  (1.2ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (1.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (1.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (1.0ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (1.0ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.5ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.5ms) DELETE FROM "cars" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.1ms) TRUNCATE TABLE "users" -  (0.5ms) DELETE FROM "users" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.1ms) TRUNCATE TABLE "checks" -  (0.5ms) DELETE FROM "checks" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.1ms) TRUNCATE TABLE "car_checks" -  (0.8ms) DELETE FROM "car_checks" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.1ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.5ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.3ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.3ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.3ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.2ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.3ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (2.7ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (1.7ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (2.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (1.7ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (1.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.9ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.6ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.3ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.3ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.4ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.6ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.4ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.3ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.3ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.2ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.7ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.1ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.3ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.3ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.3ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 -  (2.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY) -  (1.8ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] - TRANSACTION (0.0ms) begin transaction - ActiveRecord::InternalMetadata Create (0.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2023-09-27 09:54:26.570006"], ["updated_at", "2023-09-27 09:54:26.570006"]] - TRANSACTION (1.4ms) commit transaction -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.0ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - TRANSACTION (0.0ms) begin transaction - TRANSACTION (0.0ms) rollback transaction - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC -Migrating to CreateAddresses (20230810094706) - TRANSACTION (0.0ms) begin transaction -  (0.8ms) CREATE TABLE "addresses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "city" varchar, "zip_code" varchar, "street" varchar, "addressable_type" varchar, "addressable_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) -  (0.1ms) CREATE INDEX "index_addresses_on_addressable" ON "addresses" ("addressable_type", "addressable_id") - ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094706"]] - TRANSACTION (0.6ms) commit transaction -Migrating to CreateCategories (20230810094707) - TRANSACTION (0.0ms) begin transaction -  (0.2ms) CREATE TABLE "categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "label" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810094707"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateCars (20230810095724) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "cars" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category_id" integer NOT NULL, "reference" varchar, "model" varchar, "brand" varchar, "year" integer, "nb_seats" integer, "is_manual" boolean, "options" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_cdda616a64" -FOREIGN KEY ("category_id") - REFERENCES "categories" ("id") -) -  (0.0ms) CREATE INDEX "index_cars_on_category_id" ON "cars" ("category_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095724"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateUsers (20230810095725) - TRANSACTION (0.0ms) begin transaction -  (0.1ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "first_name" varchar, "last_name" varchar, "string_field" varchar, "text_field" text, "boolean_field" boolean, "date_field" date, "datetime_field" datetime(6), "integer_field" integer, "float_field" float, "decimal_field" decimal, "json_field" json, "time_field" time, "binary_field" blob, "enum_field" integer DEFAULT 0, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_04fbd72ed7" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -) -  (0.0ms) CREATE INDEX "index_users_on_car_id" ON "users" ("car_id") - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810095725"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateChecks (20230810102316) - TRANSACTION (0.0ms) begin transaction -  (0.2ms) CREATE TABLE "checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "garage_name" varchar, "date" date, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810102316"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateJoinTableCarCheck (20230810123423) - TRANSACTION (0.0ms) begin transaction -  (0.2ms) CREATE TABLE "car_checks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "car_id" integer NOT NULL, "check_id" integer NOT NULL, CONSTRAINT "fk_rails_74c41dc947" -FOREIGN KEY ("car_id") - REFERENCES "cars" ("id") -, CONSTRAINT "fk_rails_a8b021cd36" -FOREIGN KEY ("check_id") - REFERENCES "checks" ("id") -) -  (0.0ms) CREATE INDEX "index_car_checks_on_car_id" ON "car_checks" ("car_id") -  (0.0ms) CREATE INDEX "index_car_checks_on_check_id" ON "car_checks" ("check_id") - ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230810123423"]] - TRANSACTION (0.3ms) commit transaction -Migrating to CreateOrders (20230816094641) - TRANSACTION (0.0ms) begin transaction -  (0.2ms) CREATE TABLE "orders" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "reference" varchar, "invoice" blob, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL) - ActiveRecord::SchemaMigration Create (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20230816094641"]] - TRANSACTION (0.2ms) commit transaction - ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (0.9ms) DELETE FROM "addresses" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.0ms) TRUNCATE TABLE "categories" -  (0.4ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (0.3ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.3ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.4ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.3ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.0ms) TRUNCATE TABLE "orders" -  (0.3ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (1.1ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (0.4ms) DELETE FROM "categories" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.1ms) TRUNCATE TABLE "cars" -  (0.3ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (0.4ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (0.3ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (0.5ms) DELETE FROM "car_checks" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (0.1ms) TRUNCATE TABLE "orders" -  (0.4ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 - ActiveRecord::SchemaMigration Pluck (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC - ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]] -  (0.1ms) PRAGMA foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys -  (0.0ms) PRAGMA defer_foreign_keys = ON -  (0.0ms) PRAGMA foreign_keys = OFF -  (0.1ms) TRUNCATE TABLE "addresses" -  (1.8ms) DELETE FROM "addresses" -  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'addresses'; -  (0.1ms) TRUNCATE TABLE "categories" -  (1.1ms) DELETE FROM "categories" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'categories'; -  (0.0ms) TRUNCATE TABLE "cars" -  (1.0ms) DELETE FROM "cars" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'cars'; -  (0.0ms) TRUNCATE TABLE "users" -  (1.1ms) DELETE FROM "users" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'users'; -  (0.0ms) TRUNCATE TABLE "checks" -  (1.0ms) DELETE FROM "checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'checks'; -  (0.0ms) TRUNCATE TABLE "car_checks" -  (1.0ms) DELETE FROM "car_checks" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'car_checks'; -  (4.2ms) TRUNCATE TABLE "orders" -  (1.2ms) DELETE FROM "orders" -  (0.0ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence'; -  (0.0ms) DELETE FROM sqlite_sequence where name = 'orders'; -  (0.0ms) PRAGMA defer_foreign_keys = 0 -  (0.0ms) PRAGMA foreign_keys = 1 diff --git a/packages/forest_admin_datasource_active_record/spec/spec_helper.rb b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb index f94b669cd..02fd111e4 100644 --- a/packages/forest_admin_datasource_active_record/spec/spec_helper.rb +++ b/packages/forest_admin_datasource_active_record/spec/spec_helper.rb @@ -11,16 +11,13 @@ end ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../dummy/config/environment', __FILE__) -# require File.expand_path('dummy/config/environment', __dir__) +require File.expand_path('dummy/config/environment', __dir__) Rails.application.eager_load! ActiveRecord::Migration.verbose = false ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'db/database.db') ActiveRecord::MigrationContext.new("spec/dummy/db/migrate").migrate -a = ActiveRecord::Base.connection.tables - RSpec.configure do |config| config.example_status_persistence_file_path = ".rspec_status" diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb index bf19cd5c0..d144f7c0f 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/schema/column_schema.rb @@ -14,7 +14,7 @@ def initialize( filter_operators: [], is_primary_key: false, is_read_only: false, - is_sortable: true, + is_sortable: false, default_value: nil, enum_values: [], validations: [] From 63b12b65415cf3a914b05a988bd6387541e8f1ce Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Thu, 28 Sep 2023 11:58:35 +0200 Subject: [PATCH 27/33] test: add test on generate field for column schema --- .../forest_admin_agent/utils/schema/generator_field.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb index e0bf1b637..e2d0594bc 100644 --- a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb +++ b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_field.rb @@ -17,8 +17,6 @@ def self.build_schema(collection, name) schema = build_column_schema(collection, name) when 'ManyToOne', 'OneToMany', 'ManyToMany', 'OneToOne' schema = build_relation_schema(collection, name) - else - raise ForestAdminDatasourceToolkit::Exceptions::ForestException, 'Invalid field type' end schema.sort_by { |k, _v| k }.to_h @@ -44,7 +42,7 @@ def build_column_schema(collection, name) # This may sound counter-intuitive: it is so that the user don't have two fields which # allow updating the same foreign key in the detail-view form (fk + many to one) isReadOnly: is_foreign_key || column.is_read_only, - isRequired: column.validations.any? { |_k, v| v.operator == 'Present' }, + isRequired: column.validations.any? { |v| v[:operator] == 'Present' }, isSortable: column.is_sortable, isVirtual: false, reference: nil, @@ -59,10 +57,10 @@ def convert_column_type(type) return [convert_column_type(type.first)] if type.instance_of? Array { - fields: type.map do |key, _sub_type| + fields: type.map do |key, sub_type| { field: key, - type: convert_column_type(type.first) + type: convert_column_type(sub_type) } end } From c1efe010999d7e5c623e1cfdea276c156d444991 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Thu, 28 Sep 2023 11:59:05 +0200 Subject: [PATCH 28/33] test: add tests on generate collection --- packages/forest_admin_agent/forest_admin | 1 + .../utils/schema/generator_collection.rb | 15 ++- .../utils/schema/generator_collection_spec.rb | 76 ++++++++++++ .../utils/schema/generator_field_spec.rb | 114 ++++++++++++++++++ .../utils/schema.rb | 6 + 5 files changed, 207 insertions(+), 5 deletions(-) create mode 100644 packages/forest_admin_agent/forest_admin create mode 100644 packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_collection_spec.rb create mode 100644 packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb diff --git a/packages/forest_admin_agent/forest_admin b/packages/forest_admin_agent/forest_admin new file mode 100644 index 000000000..b6f1a18ec --- /dev/null +++ b/packages/forest_admin_agent/forest_admin @@ -0,0 +1 @@ +# Logfile created on 2023-09-27 15:44:52 +0200 by logger.rb/v1.5.3 diff --git a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_collection.rb b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_collection.rb index 69bca885f..332f40c01 100644 --- a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_collection.rb +++ b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/generator_collection.rb @@ -2,14 +2,15 @@ module ForestAdminAgent module Utils module Schema class GeneratorCollection - private_class_method :build_fields + include ForestAdminDatasourceToolkit::Utils + def self.build_schema(collection) { actions: {}, fields: build_fields(collection), icon: nil, integration: nil, - isReadOnly: false, + isReadOnly: collection.fields.all? { |_k, field| field.type != 'Column' || field.is_read_only }, isSearchable: true, isVirtual: false, name: collection.name, @@ -20,9 +21,13 @@ def self.build_schema(collection) end def self.build_fields(collection) - collection.fields - .map { |name, _field| GeneratorField.build_schema(collection, name) } - .sort_by { |v| v[:field] } + fields = collection.fields.select do |name, _field| + !ForestAdminDatasourceToolkit::Utils::Schema.foreign_key?(collection, name) || + ForestAdminDatasourceToolkit::Utils::Schema.primary_key?(collection, name) + end + + fields.map { |name, _field| GeneratorField.build_schema(collection, name) } + .sort_by { |v| v[:field] } end end end diff --git a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_collection_spec.rb b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_collection_spec.rb new file mode 100644 index 000000000..54ac00fed --- /dev/null +++ b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_collection_spec.rb @@ -0,0 +1,76 @@ +require 'spec_helper' + +module ForestAdminAgent + module Utils + module Schema + include ForestAdminDatasourceToolkit + include ForestAdminDatasourceToolkit::Schema + describe GeneratorCollection do + before do + @datasource = Datasource.new + collection_book = Collection.new(@datasource, 'Book') + collection_book.add_fields( + { + 'id' => ColumnSchema.new(column_type: '', is_primary_key: true), + 'author_id' => ColumnSchema.new(column_type: 'Number'), + 'author' => Relations::ManyToOneSchema.new( + foreign_key: 'author_id', + foreign_key_target: 'id', + foreign_collection: 'Person' + ) + } + ) + + collection_person = Collection.new(@datasource, 'Person') + collection_person.add_fields( + { + 'id' => ColumnSchema.new(column_type: 'Number', is_primary_key: true, is_read_only: true), + 'my_self' => Relations::OneToOneSchema.new( + origin_key: 'id', + origin_key_target: 'id', + foreign_collection: 'Person' + ) + } + ) + + @datasource.add_collection(collection_book) + @datasource.add_collection(collection_person) + end + + it 'generate schema with readonly false and skipped foreign keys' do + schema = described_class.build_schema(@datasource.collection('Book')) + + expect(schema[:isReadOnly]).to be false + expect(schema[:fields].size).to eq 2 + expect(schema[:fields][0][:field]).to eq 'author' + expect(schema[:fields][1][:field]).to eq 'id' + end + + it 'generate schema with readonly true' do + schema = described_class.build_schema(@datasource.collection('Person')) + + expect(schema[:isReadOnly]).to be true + end + + it 'have an id, regardless of the fact that it is also a fk on Person collection' do + schema = described_class.build_schema(@datasource.collection('Person')) + + expect(schema[:fields][0][:field]).to eq 'id' + expect(schema[:fields][0][:isPrimaryKey]).to be true + end + + it 'have a one-to-one relationship' do + schema = described_class.build_schema(@datasource.collection('Person')) + + expect(schema[:fields][1]).to include( + field: 'my_self', + isPrimaryKey: false, # Otherwise the UI will try to use it as a column + isReadOnly: true, # because the foreignKey that is being used is readonly + reference: 'Person.id', + relationship: 'HasOne' + ) + end + end + end + end +end diff --git a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb new file mode 100644 index 000000000..f48116289 --- /dev/null +++ b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb @@ -0,0 +1,114 @@ +require 'spec_helper' + +module ForestAdminAgent + module Utils + module Schema + include ForestAdminDatasourceToolkit + include ForestAdminDatasourceToolkit::Schema + describe GeneratorField do + before do + @datasource = Datasource.new + collection_book = Collection.new(@datasource, 'Book') + collection_book.add_fields( + { + 'isbn' => ColumnSchema.new( + column_type: 'String', + is_primary_key: true, + filter_operators: %w[Equal NotEqual Present], + is_sortable: true, + is_read_only: true, + validations: [{ operator: 'Present' }] + ), + 'origin_key' => ColumnSchema.new( + column_type: 'Number', + is_primary_key: false, + is_sortable: false, + is_read_only: false + ), + 'composite' => ColumnSchema.new( + column_type: { firstname: 'String', lastname: 'String' } + ), + 'array_of_composite' => ColumnSchema.new( + column_type: { firstname: 'String', lastname: 'String' } + ) + } + ) + + @datasource.add_collection(collection_book) + end + + it 'generate the proper schema for the isbn field' do + schema = described_class.build_schema(@datasource.collection('Book'), 'isbn') + + expect(schema).to match( + { + field: 'isbn', + type: 'String', + isSortable: true, + inverseOf: nil, + defaultValue: nil, + enums: [], + integration: nil, + isFilterable: false, + isPrimaryKey: true, + isReadOnly: true, + isRequired: true, + isVirtual: false, + reference: nil, + validations: {} + } + ) + end + + it 'generate the proper schema for the other field' do + schema = described_class.build_schema(@datasource.collection('Book'), 'origin_key') + + expect(schema).to match( + { + field: 'origin_key', + type: 'Number', + isSortable: false, + inverseOf: nil, + defaultValue: nil, + enums: [], + integration: nil, + isFilterable: false, + isPrimaryKey: false, + isReadOnly: false, + isRequired: false, + isVirtual: false, + reference: nil, + validations: {} + } + ) + end + + it 'generate the proper schema for composite types' do + schema = described_class.build_schema(@datasource.collection('Book'), 'composite') + + expect(schema[:type]).to match( + { + fields: [ + { field: :firstname, type: 'String' }, + { field: :lastname, type: 'String' } + ] + } + ) + end + + it 'generate the proper schema for array of composites types' do + schema = described_class.build_schema(@datasource.collection('Book'), 'array_of_composite') + + expect(schema[:type]).to match( + { + fields: [ + { field: :firstname, type: 'String' }, + { field: :lastname, type: 'String' } + ] + } + ) + end + end + end + end +end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb index b43e16dcd..df70171eb 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb @@ -9,6 +9,12 @@ def self.foreign_key?(collection, name) relation.type == 'ManyToOne' && relation.foreign_key == name end end + + def self.primary_key?(collection, name) + field = collection.fields[name] + + field.type == 'Column' && field.is_primary_key + end end end end From 015ec2dce9e82a14c14d20b8d81514d9b52e7743 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Thu, 28 Sep 2023 17:15:53 +0200 Subject: [PATCH 29/33] test: add tests on schema emitter --- .rubocop.yml | 2 +- .../utils/schema/schema_emitter.rb | 20 +-- .../utils/schema/schema_emitter_spec.rb | 135 ++++++++++++++++++ .../forest_admin_agent/spec/spec_helper.rb | 1 + 4 files changed, 147 insertions(+), 11 deletions(-) create mode 100644 packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/schema_emitter_spec.rb diff --git a/.rubocop.yml b/.rubocop.yml index 3baec4f8e..13fb08e5e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -180,7 +180,7 @@ RSpec/ExampleLength: RSpec/MultipleExpectations: - Max: 5 + Max: 6 Layout/LineLength: Max: 120 diff --git a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb index b03392fb8..11b3dc2e3 100644 --- a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb +++ b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb @@ -10,14 +10,14 @@ class SchemaEmitter LIANA_VERSION = 'beta'.freeze def self.get_serialized_schema(datasource) - config = ForestAdminAgent::Builder::AgentFactory.instance.container.resolve(:cache).get('config') - if config[:is_production] - schema = if config[:schema_path] && File.exist?(config[:schema_path]) - JSON.parse(File.read(config[:schema_path])) + schema_path = Facades::Container.cache(:schema_path) + if Facades::Container.cache(:is_production) + schema = if schema_path && File.exist?(schema_path) + JSON.parse(File.read(schema_path), { symbolize_names: true }) else # TODO: Logger::log('Warn', 'The .forestadmin-schema.json file doesn\'t exist') { - meta: meta(hash), + meta: meta(Digest::SHA1.hexdigest('')), collections: {} } end @@ -29,7 +29,7 @@ def self.get_serialized_schema(datasource) collections: schema } - File.write(config[:schema_path], JSON.pretty_generate(schema)) + File.write(schema_path, JSON.pretty_generate(schema)) end serialize(schema) @@ -65,8 +65,8 @@ def serialize(schema) collection.delete(:actions) collection.delete(:segments) - included.push(get_smart_features_by_collection('actions', collection_actions, with_attributes: true)) - included.push(get_smart_features_by_collection('segments', collection_segments, with_attributes: true)) + included << get_smart_features_by_collection('actions', collection_actions, with_attributes: true) + included << get_smart_features_by_collection('segments', collection_segments, with_attributes: true) data.push( { @@ -83,7 +83,7 @@ def serialize(schema) { data: data, - included: included.reject!(&:empty), + included: included.reject!(&:empty?), meta: schema[:meta] } end @@ -93,7 +93,7 @@ def get_smart_features_by_collection(type, data, with_attributes: false) data.each do |value| smart_feature = { id: value[:id], type: type } smart_feature[:attributes] = value if with_attributes - smart_features.push(smart_feature) + smart_features << smart_feature end end end diff --git a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/schema_emitter_spec.rb b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/schema_emitter_spec.rb new file mode 100644 index 000000000..752df64a0 --- /dev/null +++ b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/schema_emitter_spec.rb @@ -0,0 +1,135 @@ +require 'spec_helper' +require 'digest/sha1' +require 'json' + +module ForestAdminAgent + module Utils + module Schema + include ForestAdminDatasourceToolkit + include ForestAdminDatasourceToolkit::Schema + + describe SchemaEmitter do + before do + @datasource = Datasource.new + collection_book = Collection.new(@datasource, 'Book') + collection_book.add_fields( + { + 'id' => ColumnSchema.new(column_type: '', is_primary_key: true), + 'author_id' => ColumnSchema.new(column_type: 'Number'), + 'author' => Relations::ManyToOneSchema.new( + foreign_key: 'author_id', + foreign_key_target: 'id', + foreign_collection: 'Person' + ) + } + ) + collection_person = Collection.new(@datasource, 'Person') + collection_person.add_fields( + { + 'id' => ColumnSchema.new(column_type: 'Number', is_primary_key: true), + 'book' => Relations::OneToOneSchema.new( + origin_key: 'author_id', + origin_key_target: 'id', + foreign_collection: 'Book' + ) + } + ) + + @datasource.add_collection(collection_book) + @datasource.add_collection(collection_person) + end + + context 'when env is not production' do + before do + cache = ForestAdminAgent::Builder::AgentFactory.instance.container.resolve(:cache) + config = cache.get('config') + cache.clear 'config' + config[:is_production] = false + cache.get 'config' do + config + end + end + + it 'generate serialized schema' do + schema = described_class.get_serialized_schema(@datasource) + + expect(schema).to include(:data, :included, :meta) + expect(schema[:data][0].keys).to eq(%i[id type attributes relationships]) + expect(schema[:data][0][:attributes].keys).to eq( + %i[fields icon integration isReadOnly isSearchable isVirtual name onlyForRelationships paginationType] + ) + expect(schema[:data][0][:relationships].keys).to eq(%i[actions segments]) + expect(schema[:data][0][:relationships][:actions].keys).to eq(%i[data]) + expect(schema[:data][0][:relationships][:segments].keys).to eq(%i[data]) + end + + it 'generate the schema json' do + schema_path = Facades::Container.cache(:schema_path) + FileUtils.rm_f schema_path + described_class.get_serialized_schema(@datasource) + + expect(File.exist?(schema_path)).to be true + end + end + + context 'when env is production' do + before do + cache = ForestAdminAgent::Builder::AgentFactory.instance.container.resolve(:cache) + config = cache.get('config') + cache.clear 'config' + config[:is_production] = true + cache.get 'config' do + config + end + end + + it 'generate empty serialized schema when json does not exist' do + schema_path = Facades::Container.cache(:schema_path) + FileUtils.rm_f schema_path + schema = described_class.get_serialized_schema(@datasource) + + expect(schema).to eq( + { + data: [], + included: nil, + meta: { + liana: described_class::LIANA_NAME, + liana_version: described_class::LIANA_VERSION, + stack: { + engine: 'ruby', + engine_version: RUBY_VERSION + }, + schemaFileHash: Digest::SHA1.hexdigest('') + } + } + ) + end + + it 'generate serialized schema with the existing json' do + schema_path = Facades::Container.cache(:schema_path) + FileUtils.rm_f schema_path + json_schema = { + meta: { + liana: 'agent-ruby', + liana_version: 'beta', + stack: { engine: 'ruby', engine_version: '3.2.0' }, + schemaFileHash: 'c3af464045ea4b3a2ddefd986a19b746680e1177' + }, + collections: [] + } + File.write(schema_path, JSON.pretty_generate(json_schema)) + schema = described_class.get_serialized_schema(@datasource) + + expect(schema).to eq( + { + data: [], + included: nil, + meta: json_schema[:meta] + } + ) + end + end + end + end + end +end diff --git a/packages/forest_admin_agent/spec/spec_helper.rb b/packages/forest_admin_agent/spec/spec_helper.rb index 6204a0503..4539ebced 100644 --- a/packages/forest_admin_agent/spec/spec_helper.rb +++ b/packages/forest_admin_agent/spec/spec_helper.rb @@ -40,6 +40,7 @@ env_secret: '89719c6d8e2e2de2694c2f220fe2dbf02d5289487364daf1e4c6b13733ed0cdb', is_production: false, cache_dir: 'tmp/cache/forest_admin', + schema_path: File.join('tmp', '.forestadmin-schema.json'), forest_server_url: 'https://api.development.forestadmin.com', debug: true } From 76af19b81a9f3bb404c6b21abd7e400a3f3b17b8 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Fri, 29 Sep 2023 11:18:12 +0200 Subject: [PATCH 30/33] test: update test on generator field --- .../utils/schema/generator_field_spec.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb index f48116289..85ae70212 100644 --- a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb +++ b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb @@ -29,7 +29,7 @@ module Schema column_type: { firstname: 'String', lastname: 'String' } ), 'array_of_composite' => ColumnSchema.new( - column_type: { firstname: 'String', lastname: 'String' } + column_type: [{ firstname: 'String', lastname: 'String' }] ) } ) @@ -100,12 +100,14 @@ module Schema schema = described_class.build_schema(@datasource.collection('Book'), 'array_of_composite') expect(schema[:type]).to match( - { - fields: [ - { field: :firstname, type: 'String' }, - { field: :lastname, type: 'String' } - ] - } + [ + { + fields: [ + { field: :firstname, type: 'String' }, + { field: :lastname, type: 'String' } + ] + } + ] ) end end From 7595e98a23bb29db2043bed72c1f676b785fd3f8 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Fri, 29 Sep 2023 11:21:58 +0200 Subject: [PATCH 31/33] chore: lint --- .../collection.rb | 2 +- .../results.html | 748 ------------------ .../utils/schema.rb | 2 +- .../version.rb | 2 - 4 files changed, 2 insertions(+), 752 deletions(-) delete mode 100644 packages/forest_admin_datasource_active_record/results.html diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb index b2a2557ff..6ebb6c45e 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/collection.rb @@ -71,7 +71,7 @@ def fetch_associations association.name.to_s, ForestAdminDatasourceToolkit::Schema::Relations::OneToManySchema.new( foreign_collection: association.class_name, - origin_key: association.foreign_key, # TODO: remove hardcoded id + origin_key: association.foreign_key, origin_key_target: association.join_foreign_key ) ) diff --git a/packages/forest_admin_datasource_active_record/results.html b/packages/forest_admin_datasource_active_record/results.html deleted file mode 100644 index ccfa530ee..000000000 --- a/packages/forest_admin_datasource_active_record/results.html +++ /dev/null @@ -1,748 +0,0 @@ - - - - RSpec results - - - - - - - - -
- -
-
-

RSpec Code Examples

-
- -
- - - -
- -
-

 

-

 

-
-
- - -
-
-
-
ForestAdminDatasourceActiveRecord
- -
has a version number0.00107s
-
-
-
-
-
ForestAdminDatasourceActiveRecord::Collection
-
-
-
-
-
fetch_fields
- - - - -
- add all fields of model to the collection - 0.00305s -
-
  Failure/Error:
-    @model.columns_hash.each do |column_name, column|
-      # TODO: check is not sti column
-      field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new(
-        column_type: get_column_type(@model, column),
-        # filter_operators: [],
-        is_primary_key: column_name == @model.primary_key,
-        is_read_only: false,
-        is_sortable: true,
-        default_value: column.default,
-        enum_values: get_enum_values(@model, column),
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'cars'
-  # ./lib/forest_admin_datasource_active_record/collection.rb:17:in `fetch_fields'
-  # ./lib/forest_admin_datasource_active_record/collection.rb:10:in `initialize'
-  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `new'
-  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
-  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:12:in `block (3 levels) in <module:ForestAdminDatasourceActiveRecord>'
-
./lib/forest_admin_datasource_active_record/collection.rb:17:in `fetch_fields'
-./lib/forest_admin_datasource_active_record/collection.rb:10:in `initialize'
-./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `new'
-./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
-./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:12:in `block (3 levels) in <module:ForestAdminDatasourceActiveRecord>'
-
15
-16    def fetch_fields
-17      @model.columns_hash.each do |column_name, column|
-18        # TODO: check is not sti column
-19        field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new(
-20# Install the coderay gem to get syntax highlighting
-
-
-
-
-
-
-
fetch_associations
- - - -
- add all relation of model to the collection - 0.00134s -
-
  Failure/Error:
-    @model.columns_hash.each do |column_name, column|
-      # TODO: check is not sti column
-      field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new(
-        column_type: get_column_type(@model, column),
-        # filter_operators: [],
-        is_primary_key: column_name == @model.primary_key,
-        is_read_only: false,
-        is_sortable: true,
-        default_value: column.default,
-        enum_values: get_enum_values(@model, column),
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'cars'
-  # ./lib/forest_admin_datasource_active_record/collection.rb:17:in `fetch_fields'
-  # ./lib/forest_admin_datasource_active_record/collection.rb:10:in `initialize'
-  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `new'
-  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
-  # ./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:29:in `block (3 levels) in <module:ForestAdminDatasourceActiveRecord>'
-
./lib/forest_admin_datasource_active_record/collection.rb:17:in `fetch_fields'
-./lib/forest_admin_datasource_active_record/collection.rb:10:in `initialize'
-./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `new'
-./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:7:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
-./spec/lib/forest_admin_datasource_active_record/collection_spec.rb:29:in `block (3 levels) in <module:ForestAdminDatasourceActiveRecord>'
-
15
-16    def fetch_fields
-17      @model.columns_hash.each do |column_name, column|
-18        # TODO: check is not sti column
-19        field = ForestAdminDatasourceToolkit::Schema::ColumnSchema.new(
-20# Install the coderay gem to get syntax highlighting
-
-
-
-
-
-
-
ForestAdminDatasourceActiveRecord::Datasource
- - - -
- fetch all models - 0.01081s -
-
  Failure/Error: expect(datasource.collections.keys).to match_array(expected)
-
-    expected collection contained:  ["Address", "Car", "CarCheck", "Category", "Check", "InternalMetadata", "Order", "SchemaMigration", "User"]
-    actual collection contained:    ["InternalMetadata", "SchemaMigration"]
-    the missing elements were:      ["Address", "Car", "CarCheck", "Category", "Check", "Order", "User"]
-  # ./spec/lib/forest_admin_datasource_active_record/datasource_spec.rb:9:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
-
./spec/lib/forest_admin_datasource_active_record/datasource_spec.rb:9:in `block (2 levels) in <module:ForestAdminDatasourceActiveRecord>'
-
7      expected = %w[InternalMetadata SchemaMigration User Order Check Category CarCheck Car Address]
-8
-9      expect(datasource.collections.keys).to match_array(expected)
-10    end
-11  end
-12# Install the coderay gem to get syntax highlighting
-
-
-
-
-
-
-
ForestAdminDatasourceActiveRecord::Parser::Column
-
-
-
-
-
get_column_type
- - - -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:10 - 0.00042s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:10:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:10:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:11 - 0.00034s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:11:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:11:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:12 - 0.00043s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:12:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:12:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:13 - 0.00021s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:13:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:13:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:14 - 0.00045s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:14:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:14:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:15 - 0.00029s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:15:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:15:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:16 - 0.00024s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:16:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:16:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:17 - 0.00022s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:17:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:17:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:18 - 0.00765s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:18:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:18:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:19 - 0.00046s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:19:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:19:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:20 - 0.00024s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:20:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:20:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- example at ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:21 - 0.00022s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:21:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:21:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
-
-
-
-
-
get_enum_values
- - - -
- return an empty array if column is not Enum - 0.00023s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:26:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:26:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
- -
- return the enum values - 0.00021s -
-
  Failure/Error: let(:columns) { User.columns_hash }
-
-  ActiveRecord::StatementInvalid:
-    Could not find table 'users'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-  # ./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:30:in `block (3 levels) in <module:Parser>'
-
./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:7:in `block (2 levels) in <module:Parser>'
-./spec/lib/forest_admin_datasource_active_record/parser/column_spec.rb:30:in `block (3 levels) in <module:Parser>'
-
5    describe Column do
-6      let(:dummy_class) { Class.new { extend Column } }
-7      let(:columns) { User.columns_hash }
-8
-9      describe 'get_column_type' do
-10# Install the coderay gem to get syntax highlighting
-
-
-
-
-
-
-
ForestAdminDatasourceActiveRecord::Parser::Relation
-
-
-
-
-
associations
- -
fetch belongs_to relation0.00031s
- -
fetch belongs_to relation0.00008s
- -
fetch has_many relation0.00007s
- -
fetch many_to_many relation defined with has_many through0.00007s
- -
not fetch polymorphic relation0.00020s
-
-
- - -
-
- - diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb index df70171eb..0ec4e044b 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/utils/schema.rb @@ -5,7 +5,7 @@ def self.foreign_key?(collection, name) field = collection.fields[name] field.type == 'Column' && - collection.fields.any? do |_name, relation| + collection.fields.any? do |_key, relation| relation.type == 'ManyToOne' && relation.foreign_key == name end end diff --git a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb index 5bd76138b..50bf41ed3 100644 --- a/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb +++ b/packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - module ForestAdminDatasourceToolkit VERSION = "0.1.0" end From 56a7f0f755e453d54133c4c11c77ec79b472c579 Mon Sep 17 00:00:00 2001 From: Nicolas Alexandre Date: Fri, 29 Sep 2023 11:22:37 +0200 Subject: [PATCH 32/33] chore: lint --- .../lib/forest_admin_agent/utils/schema/generator_field_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb index 85ae70212..5ca22f164 100644 --- a/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb +++ b/packages/forest_admin_agent/spec/lib/forest_admin_agent/utils/schema/generator_field_spec.rb @@ -100,7 +100,7 @@ module Schema schema = described_class.build_schema(@datasource.collection('Book'), 'array_of_composite') expect(schema[:type]).to match( - [ + [ { fields: [ { field: :firstname, type: 'String' }, From 0f69be55c780f4db889c6da1a2a63e4487ab5bd0 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 29 Sep 2023 12:04:59 +0200 Subject: [PATCH 33/33] chore: add config coverage & release for packages datasource_active_record and daatource_toolkit --- .github/workflows/build.yml | 4 ++++ .releaserc.js | 8 ++++++++ .rubocop.yml | 3 +++ .../lib/forest_admin_agent/utils/schema/schema_emitter.rb | 4 ++-- .../lib/forest_admin_datasource_active_record/version.rb | 2 -- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f160a237a..658ca4c9e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,8 @@ jobs: ruby-version: ['3.0', '3.1', '3.2'] package: - forest_admin_agent + - forest_admin_datasource_active_record + - forest_admin_datasource_toolkit - forest_admin_rails steps: @@ -97,6 +99,8 @@ jobs: with: coverageLocations: | ${{github.workspace}}/reports/forest_admin_agent/coverage.json:simplecov + ${{github.workspace}}/reports/forest_admin_datasource_active_record/coverage.json:simplecov + ${{github.workspace}}/reports/forest_admin_datasource_toolkit/coverage.json:simplecov # ${{github.workspace}}/reports/forest_admin_rails/coverage.json:simplecov debug: true diff --git a/.releaserc.js b/.releaserc.js index 72d49589e..bb16a76df 100644 --- a/.releaserc.js +++ b/.releaserc.js @@ -19,6 +19,9 @@ module.exports = { 'sed -i \'s/VERSION = ".*"/VERSION = "${nextRelease.version}"/g\' lib/agent_ruby/version.rb; ' + 'sed -i \'s/"version": ".*"/"version": "${nextRelease.version}"/g\' package.json; ' + 'sed -i \'s/VERSION = ".*"/VERSION = "${nextRelease.version}"/g\' packages/forest_admin_agent/lib/forest_admin_agent/version.rb; ' + + 'sed -i \'s/LIANA_VERSION = ".*"/LIANA_VERSION = "${nextRelease.version}"/g\' packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb; ' + + 'sed -i \'s/VERSION = ".*"/VERSION = "${nextRelease.version}"/g\' packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb; '+ + 'sed -i \'s/VERSION = ".*"/VERSION = "${nextRelease.version}"/g\' packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb; '+ 'sed -i \'s/VERSION = ".*"/VERSION = "${nextRelease.version}"/g\' packages/forest_admin_rails/lib/forest_admin_rails/version.rb; ', successCmd: 'mkdir -p $HOME/.gem '+ @@ -26,6 +29,8 @@ module.exports = { 'chmod 0600 $HOME/.gem/credentials '+ 'printf -- "---\n:rubygems_api_key: ${env.GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials '+ '( cd packages/forest_admin_agent && gem build && gem push forest_admin_agent-${nextRelease.version}.gem )' + + '( cd packages/forest_admin_datasource_toolkit && gem build && gem push forest_admin_datasource_toolkit-${nextRelease.version}.gem )' + + '( cd packages/forest_admin_datasource_toolkit && gem build && gem push forest_admin_datasource_toolkit-${nextRelease.version}.gem )' + '( cd packages/forest_admin_rails && gem build && gem push forest_admin_rails-${nextRelease.version}.gem )' , }, ], @@ -36,6 +41,9 @@ module.exports = { 'CHANGELOG.md', 'lib/agent_ruby/version.rb', 'packages/forest_admin_agent/lib/forest_admin_agent/version.rb', + 'packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb', + 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb', + 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb', 'packages/forest_admin_rails/lib/forest_admin_rails/version.rb', 'package.json' ], diff --git a/.rubocop.yml b/.rubocop.yml index 13fb08e5e..8599907af 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,6 +7,7 @@ AllCops: NewCops: enable Exclude: - 'packages/forest_admin_datasource_active_record/spec/dummy/**/*' + - 'node_modules/semantic-release-rubygem/**/*' Gemspec/OrderedDependencies: Exclude: @@ -72,6 +73,7 @@ Style/MutableConstant: Exclude: - 'lib/agent_ruby/version.rb' - 'packages/forest_admin_agent/lib/forest_admin_agent/version.rb' + - 'packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb' - 'packages/forest_admin_rails/lib/forest_admin_rails/version.rb' - 'packages/forest_admin_datasource_toolkit/lib/forest_admin_datasource_toolkit/version.rb' - 'packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb' @@ -96,6 +98,7 @@ Style/StringLiterals: - 'packages/forest_admin_agent/lib/forest_admin_agent/version.rb' - 'packages/forest_admin_agent/spec/forest_admin_agent_spec.rb' - 'packages/forest_admin_agent/spec/spec_helper.rb' + - 'packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb' - 'packages/forest_admin_rails/forest_admin_rails.gemspec' - 'packages/forest_admin_rails/Gemfile' - 'packages/forest_admin_rails/Rakefile' diff --git a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb index 11b3dc2e3..c6b945566 100644 --- a/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb +++ b/packages/forest_admin_agent/lib/forest_admin_agent/utils/schema/schema_emitter.rb @@ -5,9 +5,9 @@ module ForestAdminAgent module Utils module Schema class SchemaEmitter - LIANA_NAME = 'agent-ruby'.freeze + LIANA_NAME = "agent-ruby" - LIANA_VERSION = 'beta'.freeze + LIANA_VERSION = "beta" def self.get_serialized_schema(datasource) schema_path = Facades::Container.cache(:schema_path) diff --git a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb index 34fc89106..66a0a3f88 100644 --- a/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb +++ b/packages/forest_admin_datasource_active_record/lib/forest_admin_datasource_active_record/version.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - module ForestAdminDatasourceActiveRecord VERSION = "0.1.0" end