diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..8b2cdbe --- /dev/null +++ b/.eslintignore @@ -0,0 +1,13 @@ +**/*{.,-}min.js +decidim-*/vendor/**/*.js +**/node_modules/** +bundle.js +karma.conf.js +webpack.config.js +webpack.config.babel.js +entry.test.js +entry.js +*_manifest.js +coverage +vendor/bundle +**/vendor/**/*.js diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..08de8c7 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "@decidim" +} diff --git a/.github/workflows/.erb-lint.yml b/.github/workflows/.erb-lint.yml new file mode 100644 index 0000000..3321add --- /dev/null +++ b/.github/workflows/.erb-lint.yml @@ -0,0 +1,30 @@ +--- + +linters: + ExtraNewline: + enabled: true + + FinalNewline: + enabled: true + + SpaceAroundErbTag: + enabled: true + + AllowedScriptType: + enabled: true + allowed_types: + - text/javascript + - text/template + + Rubocop: + enabled: true + + rubocop_config: + AllCops: + DisabledByDefault: true + + Style/StringLiterals: + EnforcedStyle: double_quotes + + Layout/SpaceInsideHashLiteralBraces: + Enabled: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..dff7229 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,47 @@ +name: Lint + +on: + push: + branches: + - main + pull_request: + +env: + RUBY_VERSION: 3.1.1 + NODE_VERSION: 18.17.1 + +jobs: + lint: + name: Lint code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.0.0 + with: + fetch-depth: 1 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ env.RUBY_VERSION }} + bundler-cache: true + + - uses: actions/setup-node@master + with: + node-version: ${{ env.NODE_VERSION }} + + - run: npm ci + name: Install JS deps + + - run: bundle exec rubocop -P + name: Lint Ruby files + + - run: bundle exec mdl *.md + name: Lint Markdown files + + - run: bundle exec erblint app/views/**/*.erb + name: Lint ERB files + + - run: npm run stylelint + name: Lint SCSS files + + - run: npm run lint + name: Lint JS files diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..819594b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,58 @@ +name: Test + +on: + push: + branches: + - main + pull_request: + +env: + RUBY_VERSION: 3.1.1 + NODE_VERSION: 18.17.1 + +jobs: + test: + name: Test + runs-on: ubuntu-latest + services: + postgres: + image: postgres:11 + ports: + - 5432:5432 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_HOST_AUTH_METHOD: trust + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ env.RUBY_VERSION }} + bundler-cache: true + - uses: actions/setup-node@master + with: + node-version: ${{ env.NODE_VERSION }} + - uses: nanasess/setup-chromedriver@v2 + - name: Setup & create Database + run: bundle exec rake db:test:prepare + env: + RAILS_ENV: test + DATABASE_USERNAME: postgres + DATABASE_PASSWORD: postgres + - name: Precompile assets + run: | + npm install + bundle exec rake assets:precompile + env: + RAILS_ENV: test + DATABASE_USERNAME: postgres + DATABASE_PASSWORD: postgres + - name: Run RSpec + run: SIMPLECOV=1 bundle exec rspec + env: + RAILS_ENV: test + DATABASE_USERNAME: postgres + DATABASE_PASSWORD: postgres diff --git a/.mdl_style.rb b/.mdl_style.rb new file mode 100644 index 0000000..4ec1c5a --- /dev/null +++ b/.mdl_style.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +all + +exclude_rule "first-line-h1" + +exclude_rule "line-length" + +exclude_rule "no-bare-urls" + +exclude_rule "no-inline-html" + +exclude_rule "ol-prefix" + +exclude_rule "ul-indent" + +rule "no-trailing-punctuation", punctuation: ".,;:!" diff --git a/.mdlrc b/.mdlrc new file mode 100644 index 0000000..27f3882 --- /dev/null +++ b/.mdlrc @@ -0,0 +1 @@ +style ".mdl_style.rb" diff --git a/.rubocop.yml b/.rubocop.yml index 928b486..c80dd73 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,2 +1,26 @@ +inherit_from: .rubocop_todo.yml + inherit_gem: decidim-dev: rubocop-decidim.yml + +inherit_mode: + merge: + - Exclude + +AllCops: + Include: + - "**/*.rb" + - "**/*.rake" + - "**/*.ru" + - "**/Gemfile" + - "**/Rakefile" + Exclude: + - "spec/decidim_dummy_app/**/*" + - "**/spec/decidim_dummy_app/**/*" + - "bin/**/*" + - "node_modules/**/*" + - "**/node_modules/**/*" + - "db/schema.rb" + - "db/migrate/*" + - "vendor/**/*" + - "**/vendor/**/*" diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..e69de29 diff --git a/Gemfile b/Gemfile index b0ee43f..372ee8c 100644 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,7 @@ group :development, :test do gem "brakeman", "~> 5.4" gem "decidim-dev", "0.28.1" + gem "mdl" gem "net-imap", "~> 0.2.3" gem "net-pop", "~> 0.1.1" gem "net-smtp", "~> 0.3.1" diff --git a/Gemfile.lock b/Gemfile.lock index a8fcaec..8cb8c5f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -157,6 +157,8 @@ GEM actionpack (>= 5.0) cells (>= 4.1.6, < 5.0.0) charlock_holmes (0.7.7) + chef-utils (18.4.12) + concurrent-ruby commonmarker (0.23.10) concurrent-ruby (1.2.2) connection_pool (2.4.1) @@ -480,6 +482,10 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) launchy (2.5.2) addressable (~> 2.8) letter_opener (1.8.1) @@ -502,6 +508,12 @@ GEM net-smtp marcel (1.0.2) matrix (0.4.2) + mdl (0.13.0) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.1) + mixlib-cli (~> 2.1, >= 2.1.1) + mixlib-config (>= 2.2.1, < 4) + mixlib-shellout method_source (1.0.0) mime-types (3.4.1) mime-types-data (~> 3.2015) @@ -510,6 +522,11 @@ GEM mini_mime (1.1.5) mini_portile2 (2.8.5) minitest (5.20.0) + mixlib-cli (2.1.8) + mixlib-config (3.0.27) + tomlrb + mixlib-shellout (3.2.8) + chef-utils msgpack (1.4.5) multi_json (1.15.0) multi_xml (0.6.0) @@ -782,6 +799,7 @@ GEM thor (1.3.0) tilt (2.1.0) timeout (0.4.0) + tomlrb (2.0.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) @@ -846,6 +864,7 @@ DEPENDENCIES figaro (~> 1.2) letter_opener_web (~> 2.0) listen (~> 3.1) + mdl net-imap (~> 0.2.3) net-pop (~> 0.1.1) net-smtp (~> 0.3.1) diff --git a/Rakefile b/Rakefile index 9a5ea73..d2a78aa 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # 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. diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index d672697..9aec230 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 0ff5442..8d6c2a1 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09705d1..7944f9f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + class ApplicationController < ActionController::Base end diff --git a/app/controllers/decidim_controller.rb b/app/controllers/decidim_controller.rb index d61ffd0..85919c0 100644 --- a/app/controllers/decidim_controller.rb +++ b/app/controllers/decidim_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Entry point for Decidim. It will use the `DecidimController` as # entry point, but you can change what controller it inherits from # so you can customize some methods. diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..15b06f0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module ApplicationHelper end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index d394c3d..bef3959 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 286b223..5cc63a0 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,4 +1,6 @@ +# frozen_string_literal: true + class ApplicationMailer < ActionMailer::Base - default from: 'from@example.com' - layout 'mailer' + default from: "from@example.com" + layout "mailer" end diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 10a4cba..71fbba5 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index cbd34d2..3aac900 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,7 +1,7 @@
- + diff --git a/bin/rails b/bin/rails index 21d3e02..e4577c4 100755 --- a/bin/rails +++ b/bin/rails @@ -1,5 +1,7 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + load File.expand_path("spring", __dir__) -APP_PATH = File.expand_path('../config/application', __dir__) +APP_PATH = File.expand_path("../config/application", __dir__) require_relative "../config/boot" require "rails/commands" diff --git a/bin/rake b/bin/rake index 7327f47..731329c 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + load File.expand_path("spring", __dir__) require_relative "../config/boot" require "rake" diff --git a/bin/setup b/bin/setup index 90700ac..dad8d96 100755 --- a/bin/setup +++ b/bin/setup @@ -1,8 +1,10 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + require "fileutils" # path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -13,12 +15,12 @@ FileUtils.chdir APP_ROOT do # 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 "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") # Install JavaScript dependencies - system! 'bin/yarn' + system! "bin/yarn" # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') @@ -26,11 +28,11 @@ FileUtils.chdir APP_ROOT do # end puts "\n== Preparing database ==" - system! 'bin/rails db:prepare' + system! "bin/rails db:prepare" puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! "bin/rails log:clear tmp:clear" puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! "bin/rails restart" end diff --git a/bin/shakapacker b/bin/shakapacker index abd14d6..0513f20 100755 --- a/bin/shakapacker +++ b/bin/shakapacker @@ -1,7 +1,8 @@ #!/usr/bin/env ruby +# frozen_string_literal: true ENV["RAILS_ENV"] ||= "development" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" diff --git a/bin/shakapacker-dev-server b/bin/shakapacker-dev-server index de85418..1416541 100755 --- a/bin/shakapacker-dev-server +++ b/bin/shakapacker-dev-server @@ -1,7 +1,8 @@ #!/usr/bin/env ruby +# frozen_string_literal: true ENV["RAILS_ENV"] ||= "development" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" diff --git a/bin/spring b/bin/spring index b4147e8..377edc8 100755 --- a/bin/spring +++ b/bin/spring @@ -1,5 +1,7 @@ #!/usr/bin/env ruby -if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) +# frozen_string_literal: true + +if !defined?(Spring) && [nil, "development", "test"].include?(ENV.fetch("RAILS_ENV", nil)) gem "bundler" require "bundler" diff --git a/config.ru b/config.ru index 4a3c09a..2e03084 100644 --- a/config.ru +++ b/config.ru @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. require_relative "config/environment" diff --git a/config/application.rb b/config/application.rb index bfb9e25..eed5f9a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative "boot" require "decidim/rails" diff --git a/config/boot.rb b/config/boot.rb index 093b490..c154378 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,6 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) +# frozen_string_literal: true + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. require "bootsnap" diff --git a/config/environment.rb b/config/environment.rb index cac5315..7df99e8 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load the Rails application. require_relative "application" diff --git a/config/environments/development.rb b/config/environments/development.rb index f2d8f4c..b843b36 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/integer/time" Rails.application.configure do @@ -16,13 +18,13 @@ # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. - if Rails.root.join('tmp', 'caching-dev.txt').exist? + 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}" + "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false @@ -58,10 +60,8 @@ # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. - # Suppress logger output for asset requests. - # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 476ae00..bf20d4e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/integer/time" Rails.application.configure do @@ -13,7 +15,7 @@ config.eager_load = true # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false + 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"] @@ -22,16 +24,15 @@ # 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? + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress CSS using a preprocessor. - # + # # Do not fallback to assets pipeline if a precompiled asset is missed. - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - config.asset_host = ENV['RAILS_ASSET_HOST'] if ENV['RAILS_ASSET_HOST'].present? + config.asset_host = ENV["RAILS_ASSET_HOST"] if ENV["RAILS_ASSET_HOST"].present? # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache @@ -50,16 +51,16 @@ # 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 = %w(debug info warn error fatal).include?(ENV['RAILS_LOG_LEVEL']) ? ENV['RAILS_LOG_LEVEL'] : :info + config.log_level = %w(debug info warn error fatal).include?(ENV["RAILS_LOG_LEVEL"]) ? ENV["RAILS_LOG_LEVEL"] : :info # Prepend all log lines with the following tags. - config.log_tags = [ :request_id ] + 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 = ENV['QUEUE_ADAPTER'] if ENV['QUEUE_ADAPTER'].present? + config.active_job.queue_adapter = ENV["QUEUE_ADAPTER"] if ENV["QUEUE_ADAPTER"].present? # config.active_job.queue_name_prefix = "decidim_ub_production" config.action_mailer.perform_caching = false @@ -82,16 +83,16 @@ config.active_support.disallowed_deprecation_warnings = [] # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new config.action_mailer.smtp_settings = { - :address => Rails.application.secrets.smtp_address, - :port => Rails.application.secrets.smtp_port, - :authentication => Rails.application.secrets.smtp_authentication, - :user_name => Rails.application.secrets.smtp_username, - :password => Rails.application.secrets.smtp_password, - :domain => Rails.application.secrets.smtp_domain, - :enable_starttls_auto => Rails.application.secrets.smtp_starttls_auto, - :openssl_verify_mode => 'none' + address: Rails.application.secrets.smtp_address, + port: Rails.application.secrets.smtp_port, + authentication: Rails.application.secrets.smtp_authentication, + user_name: Rails.application.secrets.smtp_username, + password: Rails.application.secrets.smtp_password, + domain: Rails.application.secrets.smtp_domain, + enable_starttls_auto: Rails.application.secrets.smtp_starttls_auto, + openssl_verify_mode: "none" } # Use a different logger for distributed setups. @@ -99,9 +100,9 @@ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') if ENV["RAILS_LOG_TO_STDOUT"].present? - logger = ActiveSupport::Logger.new(STDOUT) + logger = ActiveSupport::Logger.new($stdout) logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) + config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. diff --git a/config/environments/test.rb b/config/environments/test.rb index 93ed4f1..83625a0 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's @@ -19,11 +21,11 @@ # 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}" + "Cache-Control" => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. - config.consider_all_requests_local = true + config.consider_all_requests_local = true config.action_controller.perform_caching = false config.cache_store = :null_store diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb index 89d2efa..f4556db 100644 --- a/config/initializers/application_controller_renderer.rb +++ b/config/initializers/application_controller_renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 33699c3..74f30e8 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 01a4d6a..b15a372 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true # For tuning the Content Security Policy, check the Decidim documentation site -# https://docs.decidim.org/develop/en/customize/content_security_policy \ No newline at end of file +# https://docs.decidim.org/develop/en/customize/content_security_policy diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 5a6a32d..ee8dff9 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Specify a serializer for the signed and encrypted cookie jars. diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4b34a03..5118eb6 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf..aa7435f 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index dc18996..6e1d16f 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 00f64d7..50bcf4e 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Define an application-wide HTTP permissions policy. For further # information see https://developers.google.com/web/updates/2018/06/feature-policy # diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index bbfc396..2f3c0db 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which diff --git a/config/locales/en.yml b/config/locales/en.yml index cf9b342..5463f43 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,33 +1,3 @@ -# 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" + hello: Hello world diff --git a/config/puma.rb b/config/puma.rb index d9b3e83..e663c14 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + # 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 } +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 @@ -15,14 +17,14 @@ # Specifies the `port` that Puma will listen on to receive requests; default is 3000. # -port ENV.fetch("PORT") { 3000 } +port ENV.fetch("PORT", 3000) # Specifies the `environment` that Puma will run in. # -environment ENV.fetch("RAILS_ENV") { "development" } +environment ENV.fetch("RAILS_ENV", "development") # Specifies the `pidfile` that Puma will use. -pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } +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 diff --git a/config/routes.rb b/config/routes.rb index 872d594..9c85405 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,11 +1,11 @@ +# frozen_string_literal: true + require "sidekiq/web" Rails.application.routes.draw do - if Rails.env.development? - mount LetterOpenerWeb::Engine, at: "/letter_opener" - end + mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? - mount Decidim::Core::Engine => '/' + mount Decidim::Core::Engine => "/" authenticate :user, ->(u) { u.admin? } do mount Sidekiq::Web => "/sidekiq" end diff --git a/config/spring.rb b/config/spring.rb index af03ec4..6a854d5 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "decidim/spring" Spring.watch( diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..8fdbd40 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,1720 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 2024_06_17_131347) do + + # These are extensions that must be enabled in order to support this database + enable_extension "ltree" + enable_extension "pg_trgm" + enable_extension "plpgsql" + + create_table "active_storage_attachments", force: :cascade do |t| + t.string "name", null: false + t.string "record_type", null: false + t.bigint "record_id", null: false + t.bigint "blob_id", null: false + t.datetime "created_at", null: false + t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" + t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true + end + + create_table "active_storage_blobs", force: :cascade do |t| + t.string "key", null: false + t.string "filename", null: false + t.string "content_type" + t.text "metadata" + t.bigint "byte_size", null: false + t.string "checksum", null: false + t.datetime "created_at", null: false + t.string "service_name", null: false + t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true + end + + create_table "active_storage_variant_records", force: :cascade do |t| + t.bigint "blob_id", null: false + t.string "variation_digest", null: false + t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true + end + + create_table "decidim_accountability_results", id: :serial, force: :cascade do |t| + t.jsonb "title" + t.jsonb "description" + t.string "reference" + t.date "start_date" + t.date "end_date" + t.decimal "progress", precision: 5, scale: 2 + t.integer "parent_id" + t.integer "decidim_accountability_status_id" + t.integer "decidim_component_id" + t.integer "decidim_scope_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "children_count", default: 0 + t.float "weight", default: 1.0 + t.string "external_id" + t.integer "comments_count", default: 0, null: false + t.index ["decidim_accountability_status_id"], name: "decidim_accountability_results_on_status_id" + t.index ["decidim_component_id"], name: "index_decidim_accountability_results_on_decidim_component_id" + t.index ["decidim_scope_id"], name: "index_decidim_accountability_results_on_decidim_scope_id" + t.index ["external_id"], name: "index_decidim_accountability_results_on_external_id" + t.index ["parent_id"], name: "decidim_accountability_results_on_parent_id" + end + + create_table "decidim_accountability_statuses", id: :serial, force: :cascade do |t| + t.string "key" + t.jsonb "name" + t.integer "decidim_component_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "description" + t.integer "progress" + t.index ["decidim_component_id"], name: "index_decidim_accountability_statuses_on_decidim_component_id" + end + + create_table "decidim_accountability_timeline_entries", id: :serial, force: :cascade do |t| + t.date "entry_date" + t.jsonb "description" + t.integer "decidim_accountability_result_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "title" + t.index ["decidim_accountability_result_id"], name: "index_decidim_accountability_timeline_entries_on_results_id" + t.index ["entry_date"], name: "index_decidim_accountability_timeline_entries_on_entry_date" + end + + create_table "decidim_action_logs", force: :cascade do |t| + t.bigint "decidim_organization_id", null: false + t.bigint "decidim_user_id", null: false + t.bigint "decidim_component_id" + t.string "resource_type", null: false + t.bigint "resource_id", null: false + t.string "participatory_space_type" + t.bigint "participatory_space_id" + t.string "action", null: false + t.jsonb "extra" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "version_id" + t.string "visibility", default: "admin-only" + t.integer "decidim_scope_id" + t.integer "decidim_area_id" + t.index ["created_at"], name: "index_decidim_action_logs_on_created_at" + t.index ["decidim_area_id"], name: "index_decidim_action_logs_on_decidim_area_id" + t.index ["decidim_component_id"], name: "index_action_logs_on_component_id" + t.index ["decidim_organization_id"], name: "index_action_logs_on_organization_id" + t.index ["decidim_scope_id"], name: "index_decidim_action_logs_on_decidim_scope_id" + t.index ["decidim_user_id"], name: "index_action_logs_on_user_id" + t.index ["participatory_space_type", "participatory_space_id"], name: "index_action_logs_on_space_type_and_id" + t.index ["resource_type", "resource_id"], name: "index_action_logs_on_resource_type_and_id" + t.index ["version_id"], name: "index_decidim_action_logs_on_version_id" + t.index ["visibility"], name: "index_decidim_action_logs_on_visibility" + end + + create_table "decidim_amendments", force: :cascade do |t| + t.bigint "decidim_user_id", null: false + t.string "decidim_amendable_type" + t.bigint "decidim_amendable_id" + t.string "decidim_emendation_type" + t.bigint "decidim_emendation_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "state", default: 0, null: false + t.index ["decidim_amendable_id", "decidim_amendable_type"], name: "index_on_amendable" + t.index ["decidim_emendation_id"], name: "index_decidim_amendments_on_decidim_emendation_id" + t.index ["decidim_user_id", "decidim_amendable_id", "decidim_amendable_type"], name: "index_on_amender_and_amendable" + t.index ["decidim_user_id"], name: "index_decidim_amendments_on_decidim_user_id" + end + + create_table "decidim_area_types", force: :cascade do |t| + t.bigint "decidim_organization_id" + t.jsonb "name", null: false + t.jsonb "plural", null: false + t.index ["decidim_organization_id"], name: "index_decidim_area_types_on_decidim_organization_id" + end + + create_table "decidim_areas", force: :cascade do |t| + t.jsonb "name" + t.bigint "area_type_id" + t.bigint "decidim_organization_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["area_type_id"], name: "index_decidim_areas_on_area_type_id" + t.index ["decidim_organization_id"], name: "index_decidim_areas_on_decidim_organization_id" + end + + create_table "decidim_assemblies", id: :serial, force: :cascade do |t| + t.string "slug", null: false + t.string "hashtag" + t.integer "decidim_organization_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "title", null: false + t.jsonb "subtitle", null: false + t.jsonb "short_description", null: false + t.jsonb "description", null: false + t.string "hero_image" + t.string "banner_image" + t.boolean "promoted", default: false + t.datetime "published_at" + t.jsonb "developer_group" + t.jsonb "meta_scope" + t.jsonb "local_area" + t.jsonb "target" + t.jsonb "participatory_scope" + t.jsonb "participatory_structure" + t.boolean "show_statistics", default: false + t.integer "decidim_scope_id" + t.boolean "scopes_enabled", default: true, null: false + t.boolean "private_space", default: false + t.string "reference" + t.bigint "decidim_area_id" + t.bigint "parent_id" + t.ltree "parents_path" + t.integer "children_count", default: 0 + t.jsonb "purpose_of_action" + t.jsonb "composition" + t.date "creation_date" + t.string "created_by" + t.jsonb "created_by_other" + t.date "duration" + t.date "included_at" + t.date "closing_date" + t.jsonb "closing_date_reason" + t.jsonb "internal_organisation" + t.boolean "is_transparent", default: true + t.jsonb "special_features" + t.string "twitter_handler" + t.string "instagram_handler" + t.string "facebook_handler" + t.string "youtube_handler" + t.string "github_handler" + t.bigint "decidim_assemblies_type_id" + t.integer "weight", default: 1, null: false + t.integer "follows_count", default: 0, null: false + t.jsonb "announcement" + t.index ["decidim_area_id"], name: "index_decidim_assemblies_on_decidim_area_id" + t.index ["decidim_assemblies_type_id"], name: "index_decidim_assemblies_on_decidim_assemblies_type_id" + t.index ["decidim_organization_id", "slug"], name: "index_unique_assembly_slug_and_organization", unique: true + t.index ["decidim_organization_id"], name: "index_decidim_assemblies_on_decidim_organization_id" + t.index ["decidim_scope_id"], name: "index_decidim_assemblies_on_decidim_scope_id" + t.index ["parent_id"], name: "decidim_assemblies_assemblies_on_parent_id" + end + + create_table "decidim_assemblies_settings", force: :cascade do |t| + t.boolean "enable_organization_chart", default: true + t.bigint "decidim_organization_id" + t.index ["decidim_organization_id"], name: "index_decidim_assemblies_settings_on_decidim_organization_id" + end + + create_table "decidim_assemblies_types", force: :cascade do |t| + t.jsonb "title", null: false + t.integer "decidim_organization_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_organization_id"], name: "index_decidim_assemblies_types_on_decidim_organization_id" + end + + create_table "decidim_assembly_members", force: :cascade do |t| + t.bigint "decidim_assembly_id" + t.integer "weight", default: 0, null: false + t.string "full_name" + t.string "gender" + t.date "birthday" + t.string "birthplace" + t.date "designation_date" + t.string "position" + t.string "position_other" + t.date "ceased_date" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "decidim_user_id" + t.index ["decidim_assembly_id"], name: "index_decidim_assembly_members_on_decidim_assembly_id" + t.index ["decidim_user_id"], name: "index_decidim_assembly_members_on_decidim_user_id" + t.index ["weight", "created_at"], name: "index_decidim_assembly_members_on_weight_and_created_at" + end + + create_table "decidim_assembly_user_roles", force: :cascade do |t| + t.integer "decidim_user_id" + t.integer "decidim_assembly_id" + t.string "role" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_assembly_id", "decidim_user_id", "role"], name: "index_unique_user_and_assembly_role", unique: true + t.index ["decidim_user_id"], name: "index_decidim_assembly_user_roles_on_decidim_user_id" + end + + create_table "decidim_attachment_collections", force: :cascade do |t| + t.jsonb "name", null: false + t.jsonb "description", null: false + t.integer "weight", default: 0, null: false + t.string "collection_for_type", null: false + t.bigint "collection_for_id", null: false + t.index ["collection_for_type", "collection_for_id"], name: "decidim_attachment_collections_collection_for_id_and_type" + end + + create_table "decidim_attachments", id: :serial, force: :cascade do |t| + t.jsonb "title", null: false + t.jsonb "description" + t.string "file" + t.string "content_type", null: false + t.string "file_size", null: false + t.integer "attached_to_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "attached_to_type", null: false + t.integer "weight", default: 0, null: false + t.integer "attachment_collection_id" + t.index ["attached_to_id", "attached_to_type"], name: "index_decidim_attachments_on_attached_to" + t.index ["attachment_collection_id"], name: "index_decidim_attachments_on_attachment_collection_id" + end + + create_table "decidim_authorization_transfer_records", force: :cascade do |t| + t.bigint "transfer_id", null: false + t.string "resource_type", null: false + t.bigint "resource_id", null: false + t.datetime "created_at", null: false + t.index ["resource_type", "resource_id"], name: "index_decidim_authorization_transfer_records_on_resource" + t.index ["transfer_id"], name: "index_decidim_authorization_transfer_records_on_transfer_id" + end + + create_table "decidim_authorization_transfers", force: :cascade do |t| + t.bigint "user_id", null: false + t.bigint "source_user_id", null: false + t.bigint "authorization_id", null: false + t.datetime "created_at", null: false + t.index ["authorization_id"], name: "index_decidim_authorization_transfers_on_authorization_id" + t.index ["source_user_id"], name: "index_decidim_authorization_transfers_on_source_user_id" + t.index ["user_id"], name: "index_decidim_authorization_transfers_on_user_id" + end + + create_table "decidim_authorizations", id: :serial, force: :cascade do |t| + t.string "name", null: false + t.jsonb "metadata" + t.integer "decidim_user_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "unique_id" + t.datetime "granted_at" + t.jsonb "verification_metadata", default: {} + t.string "verification_attachment" + t.index ["decidim_user_id", "name"], name: "index_decidim_authorizations_on_decidim_user_id_and_name", unique: true + t.index ["decidim_user_id"], name: "index_decidim_authorizations_on_decidim_user_id" + t.index ["unique_id"], name: "index_decidim_authorizations_on_unique_id" + end + + create_table "decidim_blogs_posts", id: :serial, force: :cascade do |t| + t.jsonb "title" + t.jsonb "body" + t.integer "decidim_component_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "decidim_author_id", null: false + t.string "decidim_author_type", null: false + t.integer "decidim_user_group_id" + t.integer "endorsements_count", default: 0, null: false + t.integer "comments_count", default: 0, null: false + t.integer "follows_count", default: 0, null: false + t.datetime "published_at" + t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_blogs_posts_on_decidim_author" + t.index ["decidim_component_id"], name: "index_decidim_blogs_posts_on_decidim_component_id" + t.index ["decidim_user_group_id"], name: "index_decidim_blogs_posts_on_decidim_user_group_id" + end + + create_table "decidim_budgets_budgets", id: :serial, force: :cascade do |t| + t.jsonb "title" + t.integer "weight", default: 0, null: false + t.jsonb "description" + t.integer "total_budget", default: 0 + t.integer "decidim_component_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "decidim_scope_id" + t.index ["decidim_component_id"], name: "index_decidim_budgets_budgets_on_decidim_component_id" + t.index ["decidim_scope_id"], name: "index_decidim_budgets_budgets_on_decidim_scope_id" + end + + create_table "decidim_budgets_line_items", id: :serial, force: :cascade do |t| + t.integer "decidim_order_id" + t.integer "decidim_project_id" + t.index ["decidim_order_id", "decidim_project_id"], name: "decidim_budgets_line_items_order_project_unique", unique: true + t.index ["decidim_order_id"], name: "index_decidim_budgets_line_items_on_decidim_order_id" + t.index ["decidim_project_id"], name: "index_decidim_budgets_line_items_on_decidim_project_id" + end + + create_table "decidim_budgets_orders", id: :serial, force: :cascade do |t| + t.integer "decidim_user_id" + t.datetime "checked_out_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "decidim_budgets_budget_id" + t.index ["decidim_budgets_budget_id"], name: "index_decidim_budgets_orders_on_decidim_budgets_budget_id" + t.index ["decidim_user_id"], name: "index_decidim_budgets_orders_on_decidim_user_id" + end + + create_table "decidim_budgets_projects", id: :serial, force: :cascade do |t| + t.jsonb "title" + t.jsonb "description" + t.bigint "budget_amount", null: false + t.integer "decidim_scope_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "reference" + t.bigint "decidim_budgets_budget_id" + t.date "selected_at" + t.integer "comments_count", default: 0, null: false + t.integer "follows_count", default: 0, null: false + t.text "address" + t.float "latitude" + t.float "longitude" + t.index ["decidim_budgets_budget_id"], name: "index_decidim_budgets_projects_on_decidim_budgets_budget_id" + t.index ["decidim_scope_id"], name: "index_decidim_budgets_projects_on_decidim_scope_id" + end + + create_table "decidim_categories", id: :serial, force: :cascade do |t| + t.jsonb "name", null: false + t.jsonb "description" + t.integer "parent_id" + t.integer "decidim_participatory_space_id" + t.string "decidim_participatory_space_type" + t.integer "weight", default: 0, null: false + t.index ["decidim_participatory_space_id", "decidim_participatory_space_type"], name: "index_decidim_categories_on_decidim_participatory_space" + t.index ["parent_id"], name: "index_decidim_categories_on_parent_id" + end + + create_table "decidim_categorizations", force: :cascade do |t| + t.bigint "decidim_category_id", null: false + t.string "categorizable_type", null: false + t.bigint "categorizable_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["categorizable_type", "categorizable_id"], name: "decidim_categorizations_categorizable_id_and_type" + t.index ["decidim_category_id"], name: "index_decidim_categorizations_on_decidim_category_id" + end + + create_table "decidim_coauthorships", force: :cascade do |t| + t.bigint "decidim_author_id", null: false + t.bigint "decidim_user_group_id" + t.string "coauthorable_type" + t.bigint "coauthorable_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "decidim_author_type", null: false + t.index ["coauthorable_type", "coauthorable_id"], name: "index_coauthorable_on_coauthorship" + t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_coauthorships_on_decidim_author" + t.index ["decidim_user_group_id"], name: "index_user_group_on_coauthorsihp" + end + + create_table "decidim_comments_comment_votes", id: :serial, force: :cascade do |t| + t.integer "weight", null: false + t.integer "decidim_comment_id", null: false + t.integer "decidim_author_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "decidim_author_type", null: false + t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_comments_comment_votes_on_decidim_author" + t.index ["decidim_author_id"], name: "decidim_comments_comment_vote_author" + t.index ["decidim_comment_id", "decidim_author_id"], name: "decidim_comments_comment_vote_comment_author_unique", unique: true + t.index ["decidim_comment_id"], name: "decidim_comments_comment_vote_comment" + end + + create_table "decidim_comments_comments", id: :serial, force: :cascade do |t| + t.string "decidim_commentable_type", null: false + t.integer "decidim_commentable_id", null: false + t.integer "decidim_author_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "depth", default: 0, null: false + t.integer "alignment", default: 0, null: false + t.integer "decidim_user_group_id" + t.string "decidim_root_commentable_type", null: false + t.integer "decidim_root_commentable_id", null: false + t.string "decidim_author_type", null: false + t.jsonb "body" + t.integer "comments_count", default: 0, null: false + t.string "decidim_participatory_space_type" + t.integer "decidim_participatory_space_id" + t.datetime "deleted_at" + t.integer "up_votes_count", default: 0, null: false + t.integer "down_votes_count", default: 0, null: false + t.index ["created_at"], name: "index_decidim_comments_comments_on_created_at" + t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_comments_comments_on_decidim_author" + t.index ["decidim_author_id"], name: "decidim_comments_comment_author" + t.index ["decidim_commentable_type", "decidim_commentable_id"], name: "decidim_comments_comment_commentable" + t.index ["decidim_participatory_space_id", "decidim_participatory_space_type"], name: "index_decidim_comments_on_decidim_participatory_space" + t.index ["decidim_root_commentable_type", "decidim_root_commentable_id"], name: "decidim_comments_comment_root_commentable" + t.index ["decidim_user_group_id"], name: "index_decidim_comments_comments_on_decidim_user_group_id" + end + + create_table "decidim_components", id: :serial, force: :cascade do |t| + t.string "manifest_name" + t.jsonb "name" + t.integer "participatory_space_id", null: false + t.jsonb "settings", default: {} + t.integer "weight", default: 0 + t.jsonb "permissions" + t.datetime "published_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "participatory_space_type", null: false + t.index ["participatory_space_id", "participatory_space_type"], name: "index_decidim_components_on_decidim_participatory_space" + end + + create_table "decidim_content_block_attachments", force: :cascade do |t| + t.string "name" + t.bigint "decidim_content_block_id", null: false + t.index ["decidim_content_block_id"], name: "decidim_content_block_attachments_on_content_block" + end + + create_table "decidim_content_blocks", force: :cascade do |t| + t.integer "decidim_organization_id", null: false + t.string "manifest_name", null: false + t.string "scope_name", null: false + t.jsonb "settings" + t.datetime "published_at" + t.integer "weight" + t.jsonb "images", default: {} + t.integer "scoped_resource_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_organization_id", "scope_name", "scoped_resource_id", "manifest_name"], name: "idx_decidim_content_blocks_org_id_scope_scope_id_manifest" + t.index ["decidim_organization_id"], name: "index_decidim_content_blocks_on_decidim_organization_id" + t.index ["manifest_name"], name: "index_decidim_content_blocks_on_manifest_name" + t.index ["published_at"], name: "index_decidim_content_blocks_on_published_at" + t.index ["scope_name"], name: "index_decidim_content_blocks_on_scope_name" + end + + create_table "decidim_contextual_help_sections", force: :cascade do |t| + t.string "section_id", null: false + t.bigint "organization_id", null: false + t.jsonb "content", null: false + t.index ["organization_id"], name: "index_decidim_contextual_help_sections_on_organization_id" + t.index ["section_id"], name: "index_decidim_contextual_help_sections_on_section_id" + end + + create_table "decidim_debates_debates", id: :serial, force: :cascade do |t| + t.jsonb "title" + t.jsonb "description" + t.jsonb "instructions" + t.datetime "start_time" + t.datetime "end_time" + t.string "image" + t.integer "decidim_component_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "information_updates" + t.integer "decidim_author_id", null: false + t.string "reference" + t.integer "decidim_user_group_id" + t.string "decidim_author_type", null: false + t.datetime "closed_at" + t.jsonb "conclusions" + t.integer "endorsements_count", default: 0, null: false + t.integer "comments_count", default: 0, null: false + t.datetime "last_comment_at" + t.integer "last_comment_by_id" + t.string "last_comment_by_type" + t.bigint "decidim_scope_id" + t.integer "follows_count", default: 0, null: false + t.boolean "comments_enabled", default: true + t.index ["closed_at"], name: "index_decidim_debates_debates_on_closed_at" + t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_debates_debates_on_decidim_author" + t.index ["decidim_component_id"], name: "index_decidim_debates_debates_on_decidim_component_id" + t.index ["decidim_scope_id"], name: "index_decidim_debates_debates_on_decidim_scope_id" + t.index ["decidim_user_group_id"], name: "index_decidim_debates_debates_on_decidim_user_group_id" + t.index ["endorsements_count"], name: "idx_decidim_debates_debates_on_endorsemnts_count" + end + + create_table "decidim_editor_images", force: :cascade do |t| + t.bigint "decidim_author_id", null: false + t.bigint "decidim_organization_id", null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_author_id"], name: "decidim_editor_images_author" + t.index ["decidim_organization_id"], name: "decidim_editor_images_constraint_organization" + end + + create_table "decidim_endorsements", force: :cascade do |t| + t.string "resource_type" + t.bigint "resource_id" + t.string "decidim_author_type" + t.bigint "decidim_author_id" + t.integer "decidim_user_group_id", default: 0 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_author_type", "decidim_author_id"], name: "idx_endorsements_authors" + t.index ["decidim_user_group_id"], name: "index_decidim_endorsements_on_decidim_user_group_id" + t.index ["resource_type", "resource_id", "decidim_author_type", "decidim_author_id", "decidim_user_group_id"], name: "idx_endorsements_rsrcs_and_authors", unique: true + t.index ["resource_type", "resource_id"], name: "index_decidim_endorsements_on_resource_type_and_resource_id" + end + + create_table "decidim_follows", force: :cascade do |t| + t.bigint "decidim_user_id", null: false + t.string "decidim_followable_type" + t.bigint "decidim_followable_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_followable_id", "decidim_followable_type"], name: "index_follows_followable_id_and_type" + t.index ["decidim_user_id", "decidim_followable_id", "decidim_followable_type"], name: "index_uniq_on_follows_user_and_followable", unique: true + t.index ["decidim_user_id"], name: "index_decidim_follows_on_decidim_user_id" + end + + create_table "decidim_forms_answer_choices", force: :cascade do |t| + t.bigint "decidim_answer_id" + t.bigint "decidim_answer_option_id" + t.integer "position" + t.jsonb "body" + t.text "custom_body" + t.integer "decidim_question_matrix_row_id" + t.index ["decidim_answer_id"], name: "index_decidim_forms_answer_choices_answer_id" + t.index ["decidim_answer_option_id"], name: "index_decidim_forms_answer_choices_answer_option_id" + end + + create_table "decidim_forms_answer_options", force: :cascade do |t| + t.bigint "decidim_question_id" + t.jsonb "body" + t.boolean "free_text" + t.index ["decidim_question_id"], name: "index_decidim_forms_answer_options_question_id" + end + + create_table "decidim_forms_answers", id: :serial, force: :cascade do |t| + t.text "body" + t.integer "decidim_user_id" + t.integer "decidim_questionnaire_id" + t.integer "decidim_question_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "session_token", default: "", null: false + t.string "ip_hash" + t.index ["decidim_question_id"], name: "index_decidim_forms_answers_question_id" + t.index ["decidim_questionnaire_id"], name: "index_decidim_forms_answers_on_decidim_questionnaire_id" + t.index ["decidim_user_id"], name: "index_decidim_forms_answers_on_decidim_user_id" + t.index ["ip_hash"], name: "index_decidim_forms_answers_on_ip_hash" + t.index ["session_token"], name: "index_decidim_forms_answers_on_session_token" + end + + create_table "decidim_forms_display_conditions", force: :cascade do |t| + t.bigint "decidim_question_id", null: false + t.bigint "decidim_condition_question_id", null: false + t.bigint "decidim_answer_option_id" + t.integer "condition_type", default: 0, null: false + t.jsonb "condition_value" + t.boolean "mandatory", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_answer_option_id"], name: "decidim_forms_display_condition_answer_option" + t.index ["decidim_condition_question_id"], name: "decidim_forms_display_condition_condition_question" + t.index ["decidim_question_id"], name: "decidim_forms_display_condition_question" + end + + create_table "decidim_forms_question_matrix_rows", force: :cascade do |t| + t.bigint "decidim_question_id" + t.integer "position" + t.jsonb "body" + t.index ["decidim_question_id"], name: "index_decidim_forms_question_matrix_questionnaire_id" + t.index ["position"], name: "index_decidim_forms_question_matrix_rows_on_position" + end + + create_table "decidim_forms_questionnaires", id: :serial, force: :cascade do |t| + t.jsonb "title" + t.jsonb "description" + t.jsonb "tos" + t.string "questionnaire_for_type" + t.integer "questionnaire_for_id" + t.datetime "published_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "salt" + t.index ["questionnaire_for_type", "questionnaire_for_id"], name: "index_decidim_forms_questionnaires_questionnaire_for" + end + + create_table "decidim_forms_questions", id: :serial, force: :cascade do |t| + t.integer "decidim_questionnaire_id" + t.integer "position" + t.string "question_type" + t.boolean "mandatory" + t.jsonb "body" + t.jsonb "description" + t.integer "max_choices" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "max_characters", default: 0 + t.index ["decidim_questionnaire_id"], name: "index_decidim_forms_questions_on_decidim_questionnaire_id" + t.index ["position"], name: "index_decidim_forms_questions_on_position" + end + + create_table "decidim_gamification_badge_scores", force: :cascade do |t| + t.bigint "user_id", null: false + t.string "badge_name", null: false + t.integer "value", default: 0, null: false + t.index ["user_id"], name: "index_decidim_gamification_badge_scores_on_user_id" + end + + create_table "decidim_hashtags", force: :cascade do |t| + t.bigint "decidim_organization_id" + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_organization_id"], name: "index_decidim_hashtags_on_decidim_organization_id" + t.index ["name"], name: "index_decidim_hashtags_on_name" + end + + create_table "decidim_identities", id: :serial, force: :cascade do |t| + t.string "provider", null: false + t.string "uid", null: false + t.integer "decidim_user_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "decidim_organization_id" + t.index ["decidim_organization_id"], name: "index_decidim_identities_on_decidim_organization_id" + t.index ["decidim_user_id"], name: "index_decidim_identities_on_decidim_user_id" + t.index ["provider", "uid", "decidim_organization_id"], name: "decidim_identities_provider_uid_organization_unique", unique: true + end + + create_table "decidim_impersonation_logs", force: :cascade do |t| + t.bigint "decidim_admin_id" + t.bigint "decidim_user_id" + t.datetime "started_at" + t.datetime "ended_at" + t.datetime "expired_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "reason" + t.index ["decidim_admin_id"], name: "index_decidim_impersonation_logs_on_decidim_admin_id" + t.index ["decidim_user_id"], name: "index_decidim_impersonation_logs_on_decidim_user_id" + end + + create_table "decidim_meetings_agenda_items", force: :cascade do |t| + t.bigint "decidim_agenda_id" + t.integer "position" + t.bigint "parent_id" + t.integer "duration" + t.jsonb "title" + t.jsonb "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_agenda_id"], name: "index_decidim_meetings_agenda_items_on_decidim_agenda_id" + t.index ["parent_id"], name: "index_decidim_meetings_agenda_items_on_parent_id" + end + + create_table "decidim_meetings_agendas", force: :cascade do |t| + t.jsonb "title" + t.bigint "decidim_meeting_id", null: false + t.boolean "visible" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_meeting_id"], name: "index_decidim_meetings_agendas_on_decidim_meeting_id" + end + + create_table "decidim_meetings_answer_choices", force: :cascade do |t| + t.bigint "decidim_answer_id" + t.bigint "decidim_answer_option_id" + t.integer "position" + t.jsonb "body" + t.text "custom_body" + t.index ["decidim_answer_id"], name: "index_decidim_meetings_answer_choices_answer_id" + t.index ["decidim_answer_option_id"], name: "index_decidim_meetings_answer_choices_answer_option_id" + end + + create_table "decidim_meetings_answer_options", force: :cascade do |t| + t.bigint "decidim_question_id" + t.jsonb "body" + t.index ["decidim_question_id"], name: "index_decidim_meetings_answer_options_question_id" + end + + create_table "decidim_meetings_answers", force: :cascade do |t| + t.bigint "decidim_user_id" + t.bigint "decidim_questionnaire_id" + t.bigint "decidim_question_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_question_id"], name: "index_decidim_meetings_answers_question_id" + t.index ["decidim_questionnaire_id"], name: "index_decidim_meetings_answers_on_decidim_questionnaire_id" + t.index ["decidim_user_id"], name: "index_decidim_meetings_answers_on_decidim_user_id" + end + + create_table "decidim_meetings_invites", force: :cascade do |t| + t.bigint "decidim_user_id", null: false + t.bigint "decidim_meeting_id", null: false + t.datetime "sent_at" + t.datetime "accepted_at" + t.datetime "rejected_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_meeting_id"], name: "index_decidim_meetings_invites_on_decidim_meeting_id" + t.index ["decidim_user_id"], name: "index_decidim_meetings_invites_on_decidim_user_id" + end + + create_table "decidim_meetings_meetings", id: :serial, force: :cascade do |t| + t.jsonb "title" + t.jsonb "description" + t.datetime "start_time" + t.datetime "end_time" + t.text "address" + t.jsonb "location" + t.jsonb "location_hints" + t.integer "decidim_component_id" + t.integer "decidim_author_id" + t.integer "decidim_scope_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "closing_report" + t.integer "attendees_count" + t.integer "contributions_count" + t.text "attending_organizations" + t.time "closed_at" + t.float "latitude" + t.float "longitude" + t.string "reference" + t.boolean "registrations_enabled", default: false, null: false + t.integer "available_slots", default: 0, null: false + t.jsonb "registration_terms" + t.integer "reserved_slots", default: 0, null: false + t.boolean "private_meeting", default: false + t.boolean "transparent", default: true + t.boolean "registration_form_enabled", default: false + t.string "decidim_author_type" + t.integer "decidim_user_group_id" + t.integer "comments_count", default: 0, null: false + t.string "online_meeting_url" + t.string "registration_url" + t.string "salt" + t.boolean "customize_registration_email", default: false + t.jsonb "registration_email_custom_content" + t.integer "follows_count", default: 0, null: false + t.datetime "published_at" + t.string "video_url" + t.string "audio_url" + t.boolean "closing_visible" + t.boolean "comments_enabled", default: true + t.datetime "comments_start_time" + t.datetime "comments_end_time" + t.string "state" + t.integer "iframe_access_level", default: 0 + t.integer "iframe_embed_type", default: 0 + t.integer "type_of_meeting", default: 0, null: false + t.integer "registration_type", default: 0, null: false + t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_meetings_meetings_on_author" + t.index ["decidim_author_id"], name: "index_decidim_meetings_meetings_on_decidim_author_id" + t.index ["decidim_component_id"], name: "index_decidim_meetings_meetings_on_decidim_component_id" + t.index ["decidim_scope_id"], name: "index_decidim_meetings_meetings_on_decidim_scope_id" + end + + create_table "decidim_meetings_polls", force: :cascade do |t| + t.bigint "decidim_meeting_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_meeting_id"], name: "index_decidim_meetings_polls_on_decidim_meeting_id" + end + + create_table "decidim_meetings_questionnaires", force: :cascade do |t| + t.string "questionnaire_for_type" + t.bigint "questionnaire_for_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["questionnaire_for_type", "questionnaire_for_id"], name: "index_decidim_meetings_questionnaires_questionnaire_for" + end + + create_table "decidim_meetings_questions", force: :cascade do |t| + t.bigint "decidim_questionnaire_id" + t.integer "position" + t.string "question_type" + t.jsonb "body" + t.integer "max_choices" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.integer "status", default: 0 + t.index ["decidim_questionnaire_id"], name: "index_decidim_meetings_questions_on_decidim_questionnaire_id" + t.index ["position"], name: "index_decidim_meetings_questions_on_position" + end + + create_table "decidim_meetings_registrations", force: :cascade do |t| + t.bigint "decidim_user_id", null: false + t.bigint "decidim_meeting_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "code" + t.datetime "validated_at" + t.bigint "decidim_user_group_id" + t.boolean "public_participation", default: false + t.index ["decidim_meeting_id"], name: "index_decidim_meetings_registrations_on_decidim_meeting_id" + t.index ["decidim_user_group_id"], name: "index_decidim_meetings_registrations_on_decidim_user_group_id" + t.index ["decidim_user_id", "decidim_meeting_id"], name: "decidim_meetings_registrations_user_meeting_unique", unique: true + t.index ["decidim_user_id"], name: "index_decidim_meetings_registrations_on_decidim_user_id" + end + + create_table "decidim_meetings_services", force: :cascade do |t| + t.jsonb "title" + t.jsonb "description" + t.bigint "decidim_meeting_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_meeting_id"], name: "index_decidim_meetings_services_on_decidim_meeting_id" + end + + create_table "decidim_messaging_conversations", force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "decidim_messaging_messages", force: :cascade do |t| + t.bigint "decidim_conversation_id", null: false + t.bigint "decidim_sender_id", null: false + t.text "body", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_conversation_id"], name: "index_decidim_messaging_messages_on_decidim_conversation_id" + t.index ["decidim_sender_id"], name: "index_decidim_messaging_messages_on_decidim_sender_id" + end + + create_table "decidim_messaging_participations", force: :cascade do |t| + t.bigint "decidim_conversation_id", null: false + t.bigint "decidim_participant_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_conversation_id"], name: "index_conversation_participations_on_conversation_id" + t.index ["decidim_participant_id"], name: "index_conversation_participations_on_participant_id" + end + + create_table "decidim_messaging_receipts", force: :cascade do |t| + t.bigint "decidim_message_id", null: false + t.bigint "decidim_recipient_id", null: false + t.datetime "read_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_message_id"], name: "index_decidim_messaging_receipts_on_decidim_message_id" + t.index ["decidim_recipient_id"], name: "index_decidim_messaging_receipts_on_decidim_recipient_id" + end + + create_table "decidim_metrics", force: :cascade do |t| + t.date "day", null: false + t.string "metric_type", null: false + t.integer "cumulative", null: false + t.integer "quantity", null: false + t.bigint "decidim_organization_id", null: false + t.string "participatory_space_type" + t.bigint "participatory_space_id" + t.string "related_object_type" + t.bigint "related_object_id" + t.bigint "decidim_category_id" + t.index ["day", "metric_type", "decidim_organization_id", "participatory_space_type", "participatory_space_id", "related_object_type", "related_object_id", "decidim_category_id"], name: "idx_metric_by_day_type_org_space_object_category", unique: true + t.index ["day"], name: "index_decidim_metrics_on_day" + t.index ["decidim_category_id"], name: "index_decidim_metrics_on_decidim_category_id" + t.index ["decidim_organization_id"], name: "index_decidim_metrics_on_decidim_organization_id" + t.index ["metric_type"], name: "index_decidim_metrics_on_metric_type" + t.index ["participatory_space_type", "participatory_space_id"], name: "index_metric_on_participatory_space_id_and_type" + t.index ["related_object_type", "related_object_id"], name: "index_metric_on_related_object_id_and_type" + end + + create_table "decidim_moderations", id: :serial, force: :cascade do |t| + t.integer "decidim_participatory_space_id", null: false + t.string "decidim_reportable_type", null: false + t.integer "decidim_reportable_id", null: false + t.integer "report_count", default: 0, null: false + t.datetime "hidden_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "decidim_participatory_space_type", null: false + t.text "reported_content" + t.index ["decidim_participatory_space_id", "decidim_participatory_space_type"], name: "decidim_moderations_participatory_space" + t.index ["decidim_reportable_type", "decidim_reportable_id"], name: "decidim_moderations_reportable", unique: true + t.index ["hidden_at"], name: "decidim_moderations_hidden_at" + t.index ["report_count"], name: "decidim_moderations_report_count" + end + + create_table "decidim_newsletters", id: :serial, force: :cascade do |t| + t.jsonb "subject" + t.integer "organization_id" + t.integer "author_id" + t.integer "total_recipients" + t.integer "total_deliveries" + t.datetime "sent_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "extended_data", default: {} + t.index ["author_id"], name: "index_decidim_newsletters_on_author_id" + t.index ["organization_id"], name: "index_decidim_newsletters_on_organization_id" + end + + create_table "decidim_notifications", force: :cascade do |t| + t.bigint "decidim_user_id", null: false + t.string "decidim_resource_type", null: false + t.bigint "decidim_resource_id", null: false + t.string "event_name", null: false + t.string "event_class", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "extra" + t.index ["decidim_resource_id"], name: "index_decidim_notifications_on_decidim_resource_id" + t.index ["decidim_user_id"], name: "index_decidim_notifications_on_decidim_user_id" + end + + create_table "decidim_organizations", id: :serial, force: :cascade do |t| + t.string "name", null: false + t.string "host", null: false + t.string "default_locale", null: false + t.string "available_locales", default: [], array: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "description" + t.string "logo" + t.string "twitter_handler" + t.string "favicon" + t.string "instagram_handler" + t.string "facebook_handler" + t.string "youtube_handler" + t.string "github_handler" + t.string "official_img_footer" + t.string "official_url" + t.string "reference_prefix", null: false + t.string "secondary_hosts", default: [], array: true + t.string "available_authorizations", default: [], array: true + t.text "header_snippets" + t.jsonb "cta_button_text" + t.string "cta_button_path" + t.boolean "enable_omnipresent_banner", default: false, null: false + t.jsonb "omnipresent_banner_title" + t.jsonb "omnipresent_banner_short_description" + t.string "omnipresent_banner_url" + t.boolean "highlighted_content_banner_enabled", default: false, null: false + t.jsonb "highlighted_content_banner_title" + t.jsonb "highlighted_content_banner_short_description" + t.jsonb "highlighted_content_banner_action_title" + t.jsonb "highlighted_content_banner_action_subtitle" + t.string "highlighted_content_banner_action_url" + t.string "highlighted_content_banner_image" + t.datetime "tos_version" + t.boolean "badges_enabled", default: false, null: false + t.boolean "send_welcome_notification", default: false, null: false + t.jsonb "welcome_notification_subject" + t.jsonb "welcome_notification_body" + t.integer "users_registration_mode", default: 0, null: false + t.string "id_documents_methods", default: ["online"], array: true + t.jsonb "id_documents_explanation_text", default: {} + t.boolean "user_groups_enabled", default: false, null: false + t.jsonb "smtp_settings" + t.jsonb "colors", default: {} + t.boolean "force_users_to_authenticate_before_access_organization", default: false + t.jsonb "omniauth_settings" + t.boolean "rich_text_editor_in_public_views", default: false + t.jsonb "admin_terms_of_service_body" + t.string "time_zone", limit: 255, default: "UTC" + t.boolean "enable_machine_translations", default: false + t.integer "comments_max_length", default: 1000 + t.jsonb "file_upload_settings" + t.string "machine_translation_display_priority", default: "original", null: false + t.string "external_domain_whitelist", default: [], array: true + t.boolean "enable_participatory_space_filters", default: true + t.jsonb "content_security_policy", default: {} + t.index ["host"], name: "index_decidim_organizations_on_host", unique: true + t.index ["name"], name: "index_decidim_organizations_on_name", unique: true + end + + create_table "decidim_pages_pages", id: :serial, force: :cascade do |t| + t.jsonb "body" + t.integer "decidim_component_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_component_id"], name: "index_decidim_pages_pages_on_decidim_component_id" + end + + create_table "decidim_participatory_process_groups", id: :serial, force: :cascade do |t| + t.jsonb "title", null: false + t.jsonb "description", null: false + t.string "hero_image" + t.integer "decidim_organization_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "hashtag" + t.string "group_url" + t.jsonb "developer_group" + t.jsonb "local_area" + t.jsonb "meta_scope" + t.jsonb "target" + t.jsonb "participatory_scope" + t.jsonb "participatory_structure" + t.boolean "promoted", default: false + t.index ["decidim_organization_id"], name: "decidim_participatory_process_group_organization" + end + + create_table "decidim_participatory_process_steps", id: :serial, force: :cascade do |t| + t.jsonb "title", null: false + t.jsonb "description" + t.datetime "start_date" + t.datetime "end_date" + t.integer "decidim_participatory_process_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "active", default: false + t.integer "position" + t.jsonb "cta_text", default: {} + t.string "cta_path" + t.index ["decidim_participatory_process_id", "active"], name: "unique_index_to_avoid_duplicate_active_steps", unique: true, where: "(active = true)" + t.index ["decidim_participatory_process_id", "position"], name: "index_unique_position_for_process", unique: true + t.index ["decidim_participatory_process_id"], name: "index_decidim_processes_steps__on_decidim_process_id" + t.index ["position"], name: "index_order_by_position_for_steps" + end + + create_table "decidim_participatory_process_types", force: :cascade do |t| + t.jsonb "title", null: false + t.bigint "decidim_organization_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_organization_id"], name: "index_decidim_process_types_on_decidim_organization_id" + end + + create_table "decidim_participatory_process_user_roles", id: :serial, force: :cascade do |t| + t.integer "decidim_user_id" + t.integer "decidim_participatory_process_id" + t.string "role" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_participatory_process_id", "decidim_user_id", "role"], name: "index_unique_user_and_process_role", unique: true + t.index ["decidim_user_id"], name: "idx_proces_user_role_on_user_id" + end + + create_table "decidim_participatory_processes", id: :serial, force: :cascade do |t| + t.string "slug", null: false + t.string "hashtag" + t.integer "decidim_organization_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "title", null: false + t.jsonb "subtitle", null: false + t.jsonb "short_description", null: false + t.jsonb "description", null: false + t.string "hero_image" + t.string "banner_image" + t.boolean "promoted", default: false + t.datetime "published_at" + t.jsonb "developer_group" + t.date "end_date" + t.jsonb "meta_scope" + t.jsonb "local_area" + t.jsonb "target" + t.jsonb "participatory_scope" + t.jsonb "participatory_structure" + t.integer "decidim_scope_id" + t.integer "decidim_participatory_process_group_id" + t.boolean "show_statistics", default: true + t.jsonb "announcement" + t.boolean "scopes_enabled", default: true, null: false + t.date "start_date" + t.boolean "private_space", default: false + t.string "reference" + t.bigint "decidim_area_id" + t.bigint "decidim_scope_type_id" + t.boolean "show_metrics", default: true + t.integer "weight", default: 1, null: false + t.integer "follows_count", default: 0, null: false + t.bigint "decidim_participatory_process_type_id" + t.index ["decidim_area_id"], name: "index_decidim_participatory_processes_on_decidim_area_id" + t.index ["decidim_organization_id", "slug"], name: "index_unique_process_slug_and_organization", unique: true + t.index ["decidim_organization_id"], name: "index_decidim_processes_on_decidim_organization_id" + t.index ["decidim_participatory_process_group_id"], name: "idx_process_on_process_group_id" + t.index ["decidim_participatory_process_type_id"], name: "index_decidim_processes_on_decidim_process_type_id" + t.index ["decidim_scope_id"], name: "idx_process_on_scope_id" + t.index ["decidim_scope_type_id"], name: "index_decidim_participatory_processes_on_decidim_scope_type_id" + end + + create_table "decidim_participatory_space_links", id: :serial, force: :cascade do |t| + t.string "from_type", null: false + t.integer "from_id", null: false + t.string "to_type", null: false + t.integer "to_id", null: false + t.string "name", null: false + t.jsonb "data" + t.index ["from_type", "from_id"], name: "index_participatory_space_links_on_from" + t.index ["name"], name: "index_participatory_space_links_name" + t.index ["to_type", "to_id"], name: "index_participatory_space_links_on_to" + end + + create_table "decidim_participatory_space_private_users", force: :cascade do |t| + t.bigint "decidim_user_id" + t.integer "privatable_to_id" + t.string "privatable_to_type" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_user_id"], name: "index_decidim_spaces_users_on_private_user_id" + t.index ["privatable_to_type", "privatable_to_id"], name: "space_privatable_to_privatable_id" + end + + create_table "decidim_proposals_collaborative_draft_collaborator_requests", force: :cascade do |t| + t.bigint "decidim_proposals_collaborative_draft_id", null: false + t.bigint "decidim_user_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_proposals_collaborative_draft_id"], name: "index_collab_requests_on_decidim_proposals_collab_draft_id" + t.index ["decidim_user_id"], name: "index_collab_requests_on_decidim_user_id" + end + + create_table "decidim_proposals_collaborative_drafts", force: :cascade do |t| + t.text "title", null: false + t.text "body", null: false + t.integer "decidim_component_id", null: false + t.integer "decidim_scope_id" + t.string "reference" + t.text "address" + t.float "latitude" + t.float "longitude" + t.datetime "published_at" + t.integer "authors_count", default: 0, null: false + t.integer "versions_count", default: 0, null: false + t.integer "contributions_count", default: 0, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "coauthorships_count", default: 0, null: false + t.integer "comments_count", default: 0, null: false + t.integer "follows_count", default: 0, null: false + t.integer "state", default: 0, null: false + t.index ["body"], name: "decidim_proposals_collaborative_draft_body_search" + t.index ["decidim_component_id"], name: "decidim_proposals_collaborative_drafts_on_decidim_component_id" + t.index ["decidim_scope_id"], name: "decidim_proposals_collaborative_drafts_on_decidim_scope_id" + t.index ["title"], name: "decidim_proposals_collaborative_drafts_title_search" + t.index ["updated_at"], name: "decidim_proposals_collaborative_drafts_on_updated_at" + end + + create_table "decidim_proposals_participatory_texts", force: :cascade do |t| + t.jsonb "title" + t.jsonb "description" + t.bigint "decidim_component_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_component_id"], name: "idx_participatory_texts_on_decidim_component_id" + end + + create_table "decidim_proposals_proposal_notes", force: :cascade do |t| + t.bigint "decidim_proposal_id", null: false + t.bigint "decidim_author_id", null: false + t.text "body", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["created_at"], name: "index_decidim_proposals_proposal_notes_on_created_at" + t.index ["decidim_author_id"], name: "decidim_proposals_proposal_note_author" + t.index ["decidim_proposal_id"], name: "decidim_proposals_proposal_note_proposal" + end + + create_table "decidim_proposals_proposal_votes", id: :serial, force: :cascade do |t| + t.integer "decidim_proposal_id", null: false + t.integer "decidim_author_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "temporary", default: false, null: false + t.index ["decidim_author_id"], name: "decidim_proposals_proposal_vote_author" + t.index ["decidim_proposal_id", "decidim_author_id"], name: "decidim_proposals_proposal_vote_proposal_author_unique", unique: true + t.index ["decidim_proposal_id"], name: "decidim_proposals_proposal_vote_proposal" + end + + create_table "decidim_proposals_proposals", id: :serial, force: :cascade do |t| + t.integer "decidim_component_id", null: false + t.integer "decidim_scope_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "proposal_votes_count", default: 0, null: false + t.datetime "answered_at" + t.jsonb "answer" + t.string "reference" + t.text "address" + t.float "latitude" + t.float "longitude" + t.datetime "published_at" + t.integer "proposal_notes_count", default: 0, null: false + t.integer "coauthorships_count", default: 0, null: false + t.string "participatory_text_level" + t.integer "position" + t.boolean "created_in_meeting", default: false + t.integer "endorsements_count", default: 0, null: false + t.decimal "cost" + t.jsonb "cost_report" + t.jsonb "execution_period" + t.datetime "state_published_at" + t.jsonb "title" + t.jsonb "body" + t.integer "comments_count", default: 0, null: false + t.integer "follows_count", default: 0, null: false + t.integer "state", default: 0, null: false + t.integer "valuation_assignments_count", default: 0 + t.index "md5((body)::text)", name: "decidim_proposals_proposal_body_search" + t.index "md5((title)::text)", name: "decidim_proposals_proposal_title_search" + t.index ["created_at"], name: "index_decidim_proposals_proposals_on_created_at" + t.index ["decidim_component_id"], name: "index_decidim_proposals_proposals_on_decidim_component_id" + t.index ["decidim_scope_id"], name: "index_decidim_proposals_proposals_on_decidim_scope_id" + t.index ["proposal_votes_count"], name: "index_decidim_proposals_proposals_on_proposal_votes_count" + end + + create_table "decidim_proposals_valuation_assignments", force: :cascade do |t| + t.bigint "decidim_proposal_id", null: false + t.string "valuator_role_type", null: false + t.bigint "valuator_role_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_proposal_id"], name: "decidim_proposals_valuation_assignment_proposal" + t.index ["valuator_role_type", "valuator_role_id"], name: "decidim_proposals_valuation_assignment_valuator_role" + end + + create_table "decidim_reminder_deliveries", force: :cascade do |t| + t.bigint "decidim_reminder_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_reminder_id"], name: "index_decidim_reminder_deliveries_on_decidim_reminder_id" + end + + create_table "decidim_reminder_records", force: :cascade do |t| + t.string "string", default: "active" + t.bigint "decidim_reminder_id" + t.string "remindable_type", null: false + t.bigint "remindable_id", null: false + t.integer "state", default: 0, null: false + t.index ["decidim_reminder_id"], name: "index_decidim_reminder_records_on_decidim_reminder_id" + t.index ["remindable_type", "remindable_id"], name: "index_decidim_reminder_records_remindable" + t.index ["string"], name: "index_decidim_reminder_records_on_string" + end + + create_table "decidim_reminders", force: :cascade do |t| + t.bigint "decidim_user_id", null: false + t.bigint "decidim_component_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_component_id"], name: "index_decidim_reminders_on_decidim_component_id" + t.index ["decidim_user_id"], name: "index_decidim_reminders_on_decidim_user_id" + end + + create_table "decidim_reports", id: :serial, force: :cascade do |t| + t.integer "decidim_moderation_id", null: false + t.integer "decidim_user_id", null: false + t.string "reason", null: false + t.text "details" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "locale" + t.index ["decidim_moderation_id", "decidim_user_id"], name: "decidim_reports_moderation_user_unique", unique: true + t.index ["decidim_moderation_id"], name: "decidim_reports_moderation" + t.index ["decidim_user_id"], name: "decidim_reports_user" + end + + create_table "decidim_resource_links", id: :serial, force: :cascade do |t| + t.string "from_type", null: false + t.integer "from_id", null: false + t.string "to_type", null: false + t.integer "to_id", null: false + t.string "name", null: false + t.jsonb "data" + t.index ["from_type", "from_id"], name: "index_decidim_resource_links_on_from_type_and_from_id" + t.index ["name"], name: "index_decidim_resource_links_on_name" + t.index ["to_type", "to_id"], name: "index_decidim_resource_links_on_to_type_and_to_id" + end + + create_table "decidim_resource_permissions", force: :cascade do |t| + t.string "resource_type" + t.bigint "resource_id" + t.jsonb "permissions", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["resource_type", "resource_id"], name: "index_decidim_resource_permissions_on_r_type_and_r_id", unique: true + end + + create_table "decidim_scope_types", id: :serial, force: :cascade do |t| + t.integer "decidim_organization_id" + t.jsonb "name", null: false + t.jsonb "plural", null: false + t.index ["decidim_organization_id"], name: "index_decidim_scope_types_on_decidim_organization_id" + end + + create_table "decidim_scopes", id: :serial, force: :cascade do |t| + t.integer "decidim_organization_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "name", null: false + t.integer "scope_type_id" + t.integer "parent_id" + t.string "code", null: false + t.integer "part_of", default: [], null: false, array: true + t.index ["decidim_organization_id", "code"], name: "index_decidim_scopes_on_decidim_organization_id_and_code", unique: true + t.index ["decidim_organization_id"], name: "index_decidim_scopes_on_decidim_organization_id" + t.index ["parent_id"], name: "index_decidim_scopes_on_parent_id" + t.index ["part_of"], name: "index_decidim_scopes_on_part_of", using: :gin + t.index ["scope_type_id"], name: "index_decidim_scopes_on_scope_type_id" + end + + create_table "decidim_searchable_resources", force: :cascade do |t| + t.text "content_a" + t.text "content_b" + t.text "content_c" + t.text "content_d" + t.string "locale", null: false + t.datetime "datetime" + t.bigint "decidim_scope_id" + t.string "decidim_participatory_space_type" + t.bigint "decidim_participatory_space_id" + t.bigint "decidim_organization_id" + t.string "resource_type" + t.bigint "resource_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_organization_id"], name: "index_decidim_searchable_resources_on_decidim_organization_id" + t.index ["decidim_participatory_space_type", "decidim_participatory_space_id"], name: "index_decidim_searchable_resource_on_pspace_type_and_pspace_id" + t.index ["decidim_scope_id"], name: "index_decidim_searchable_resources_on_decidim_scope_id" + t.index ["resource_type", "resource_id"], name: "index_decidim_searchable_rsrcs_on_s_type_and_s_id" + end + + create_table "decidim_share_tokens", force: :cascade do |t| + t.bigint "decidim_organization_id", null: false + t.bigint "decidim_user_id", null: false + t.string "token_for_type", null: false + t.bigint "token_for_id", null: false + t.string "token", null: false + t.integer "times_used", default: 0 + t.datetime "created_at" + t.datetime "last_used_at" + t.datetime "expires_at" + t.index ["decidim_organization_id"], name: "index_decidim_share_tokens_on_decidim_organization_id" + t.index ["decidim_user_id"], name: "index_decidim_share_tokens_on_decidim_user_id" + t.index ["token_for_type", "token_for_id"], name: "decidim_share_tokens_token_for" + end + + create_table "decidim_short_links", force: :cascade do |t| + t.bigint "decidim_organization_id", null: false + t.string "target_type", null: false + t.bigint "target_id", null: false + t.string "identifier", limit: 10, null: false + t.string "mounted_engine_name" + t.string "route_name" + t.jsonb "params" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_organization_id", "identifier"], name: "idx_decidim_short_links_organization_id_identifier", unique: true + t.index ["decidim_organization_id"], name: "index_decidim_short_links_on_decidim_organization_id" + t.index ["mounted_engine_name"], name: "index_decidim_short_links_on_mounted_engine_name" + t.index ["route_name"], name: "index_decidim_short_links_on_route_name" + t.index ["target_type", "target_id"], name: "index_decidim_short_links_on_target" + end + + create_table "decidim_sortitions_sortitions", force: :cascade do |t| + t.bigint "decidim_component_id" + t.integer "decidim_proposals_component_id" + t.integer "dice", null: false + t.integer "target_items", null: false + t.datetime "request_timestamp", null: false + t.jsonb "selected_proposals" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.jsonb "witnesses" + t.jsonb "additional_info" + t.bigint "decidim_author_id", null: false + t.string "reference" + t.jsonb "title" + t.jsonb "cancel_reason" + t.datetime "cancelled_on" + t.integer "cancelled_by_user_id" + t.jsonb "candidate_proposals" + t.string "decidim_author_type", null: false + t.integer "comments_count", default: 0, null: false + t.index ["cancelled_by_user_id"], name: "index_decidim_sortitions_sortitions_on_cancelled_by_user_id" + t.index ["decidim_author_id", "decidim_author_type"], name: "index_decidim_sortitions_sortitions_on_decidim_author" + t.index ["decidim_author_id"], name: "index_decidim_sortitions_sortitions_on_decidim_author_id" + t.index ["decidim_component_id"], name: "index_sortitions__on_feature" + t.index ["decidim_proposals_component_id"], name: "index_sortitions__on_proposals_feature" + end + + create_table "decidim_static_page_topics", force: :cascade do |t| + t.jsonb "title", null: false + t.jsonb "description", null: false + t.bigint "organization_id", null: false + t.integer "weight" + t.boolean "show_in_footer", default: false, null: false + t.index ["organization_id"], name: "index_decidim_static_page_topics_on_organization_id" + end + + create_table "decidim_static_pages", id: :serial, force: :cascade do |t| + t.jsonb "title", null: false + t.string "slug", null: false + t.jsonb "content", null: false + t.integer "decidim_organization_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "weight" + t.boolean "show_in_footer", default: false, null: false + t.bigint "topic_id" + t.boolean "allow_public_access", default: false, null: false + t.index ["decidim_organization_id"], name: "index_decidim_static_pages_on_decidim_organization_id" + t.index ["topic_id"], name: "index_decidim_static_pages_on_topic_id" + end + + create_table "decidim_surveys_surveys", id: :serial, force: :cascade do |t| + t.integer "decidim_component_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_component_id"], name: "index_decidim_surveys_surveys_on_decidim_component_id" + end + + create_table "decidim_system_admins", id: :serial, force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "failed_attempts", default: 0, null: false + t.string "unlock_token" + t.datetime "locked_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["email"], name: "index_decidim_system_admins_on_email", unique: true + t.index ["reset_password_token"], name: "index_decidim_system_admins_on_reset_password_token", unique: true + end + + create_table "decidim_user_blocks", force: :cascade do |t| + t.bigint "decidim_user_id" + t.integer "blocking_user_id" + t.text "justification" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_user_id"], name: "index_decidim_user_blocks_on_decidim_user_id" + end + + create_table "decidim_user_group_memberships", id: :serial, force: :cascade do |t| + t.integer "decidim_user_id", null: false + t.integer "decidim_user_group_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "role", default: "requested", null: false + t.index ["decidim_user_group_id", "decidim_user_id"], name: "index_user_group_memberships_group_id_user_id" + t.index ["decidim_user_group_id"], name: "index_decidim_user_group_memberships_on_decidim_user_group_id" + t.index ["decidim_user_id", "decidim_user_group_id"], name: "decidim_user_group_memberships_unique_user_and_group_ids", unique: true + t.index ["decidim_user_id"], name: "index_decidim_user_group_memberships_on_decidim_user_id" + t.index ["role", "decidim_user_group_id"], name: "decidim_group_membership_one_creator_per_group", unique: true, where: "((role)::text = 'creator'::text)" + end + + create_table "decidim_user_moderations", force: :cascade do |t| + t.bigint "decidim_user_id" + t.integer "report_count", default: 0, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_user_id"], name: "index_decidim_user_moderations_on_decidim_user_id" + end + + create_table "decidim_user_reports", force: :cascade do |t| + t.integer "user_moderation_id" + t.integer "user_id", null: false + t.string "reason" + t.text "details" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "decidim_users", id: :serial, force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", default: 0, null: false + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "invitation_token" + t.datetime "invitation_created_at" + t.datetime "invitation_sent_at" + t.datetime "invitation_accepted_at" + t.integer "invitation_limit" + t.string "invited_by_type" + t.integer "invited_by_id" + t.integer "invitations_count", default: 0 + t.integer "decidim_organization_id" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.string "unconfirmed_email" + t.string "name", null: false + t.string "locale" + t.string "avatar" + t.text "delete_reason" + t.datetime "deleted_at" + t.boolean "admin", default: false, null: false + t.boolean "managed", default: false, null: false + t.string "roles", default: [], array: true + t.string "nickname", limit: 20, default: "", null: false + t.string "personal_url" + t.text "about" + t.datetime "accepted_tos_version" + t.string "newsletter_token", default: "" + t.datetime "newsletter_notifications_at" + t.string "type", null: false + t.jsonb "extended_data", default: {} + t.integer "following_count", default: 0, null: false + t.integer "followers_count", default: 0, null: false + t.string "notification_types", default: "all", null: false + t.integer "failed_attempts", default: 0, null: false + t.string "unlock_token" + t.datetime "locked_at" + t.string "session_token" + t.string "direct_message_types", default: "all", null: false + t.boolean "blocked", default: false, null: false + t.datetime "blocked_at" + t.integer "block_id" + t.boolean "email_on_moderations", default: true + t.integer "follows_count", default: 0, null: false + t.jsonb "notification_settings", default: {} + t.string "notifications_sending_frequency", default: "daily" + t.datetime "digest_sent_at" + t.datetime "password_updated_at" + t.string "previous_passwords", default: [], array: true + t.datetime "officialized_at" + t.jsonb "officialized_as" + t.datetime "admin_terms_accepted_at" + t.index ["confirmation_token"], name: "index_decidim_users_on_confirmation_token", unique: true + t.index ["decidim_organization_id"], name: "index_decidim_users_on_decidim_organization_id" + t.index ["email", "decidim_organization_id"], name: "index_decidim_users_on_email_and_decidim_organization_id", unique: true, where: "((deleted_at IS NULL) AND (managed = false) AND ((type)::text = 'Decidim::User'::text))" + t.index ["id", "type"], name: "index_decidim_users_on_id_and_type" + t.index ["invitation_token"], name: "index_decidim_users_on_invitation_token", unique: true + t.index ["invitations_count"], name: "index_decidim_users_on_invitations_count" + t.index ["invited_by_id", "invited_by_type"], name: "index_decidim_users_on_invited_by_id_and_invited_by_type" + t.index ["invited_by_id"], name: "index_decidim_users_on_invited_by_id" + t.index ["nickname", "decidim_organization_id"], name: "index_decidim_users_on_nickame_and_decidim_organization_id", unique: true, where: "((deleted_at IS NULL) AND (managed = false))" + t.index ["notifications_sending_frequency"], name: "index_decidim_users_on_notifications_sending_frequency" + t.index ["officialized_at"], name: "index_decidim_users_on_officialized_at" + t.index ["reset_password_token"], name: "index_decidim_users_on_reset_password_token", unique: true + t.index ["unlock_token"], name: "index_decidim_users_on_unlock_token", unique: true + end + + create_table "decidim_verifications_conflicts", force: :cascade do |t| + t.bigint "current_user_id" + t.bigint "managed_user_id" + t.integer "times", default: 0 + t.string "unique_id" + t.boolean "solved", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["current_user_id"], name: "authorization_current_user" + t.index ["managed_user_id"], name: "authorization_managed_user" + end + + create_table "decidim_verifications_csv_data", force: :cascade do |t| + t.string "email" + t.bigint "decidim_organization_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["decidim_organization_id"], name: "index_verifications_csv_census_to_organization" + end + + create_table "oauth_access_grants", force: :cascade do |t| + t.integer "resource_owner_id", null: false + t.bigint "application_id", null: false + t.string "token", null: false + t.integer "expires_in", null: false + t.text "redirect_uri", null: false + t.datetime "created_at", null: false + t.datetime "revoked_at" + t.string "scopes" + t.index ["application_id"], name: "index_oauth_access_grants_on_application_id" + t.index ["resource_owner_id"], name: "index_oauth_access_grants_on_resource_owner_id" + t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true + end + + create_table "oauth_access_tokens", force: :cascade do |t| + t.integer "resource_owner_id" + t.bigint "application_id" + t.string "token", null: false + t.string "refresh_token" + t.integer "expires_in" + t.datetime "revoked_at" + t.datetime "created_at", null: false + t.string "scopes" + t.string "previous_refresh_token", default: "", null: false + t.index ["application_id"], name: "index_oauth_access_tokens_on_application_id" + t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true + t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" + t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true + end + + create_table "oauth_applications", force: :cascade do |t| + t.string "name", null: false + t.string "organization_name", null: false + t.string "organization_url", null: false + t.string "organization_logo" + t.string "uid", null: false + t.string "secret", null: false + t.text "redirect_uri", null: false + t.string "scopes", default: "", null: false + t.bigint "decidim_organization_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "type" + t.boolean "confidential", default: true, null: false + t.index ["decidim_organization_id"], name: "index_oauth_applications_on_decidim_organization_id" + t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true + end + + create_table "versions", force: :cascade do |t| + t.string "item_type", null: false + t.integer "item_id", null: false + t.string "event", null: false + t.string "whodunnit" + t.jsonb "object" + t.datetime "created_at" + t.text "object_changes" + t.index ["item_id", "item_type"], name: "index_versions_on_item_id_and_item_type" + t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" + end + + add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" + add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" + add_foreign_key "decidim_area_types", "decidim_organizations" + add_foreign_key "decidim_areas", "decidim_area_types", column: "area_type_id" + add_foreign_key "decidim_areas", "decidim_organizations" + add_foreign_key "decidim_assemblies", "decidim_assemblies_types" + add_foreign_key "decidim_assemblies_settings", "decidim_organizations" + add_foreign_key "decidim_attachments", "decidim_attachment_collections", column: "attachment_collection_id", name: "fk_decidim_attachments_attachment_collection_id", on_delete: :nullify + add_foreign_key "decidim_authorization_transfer_records", "decidim_authorization_transfers", column: "transfer_id" + add_foreign_key "decidim_authorization_transfers", "decidim_authorizations", column: "authorization_id" + add_foreign_key "decidim_authorization_transfers", "decidim_users", column: "source_user_id" + add_foreign_key "decidim_authorization_transfers", "decidim_users", column: "user_id" + add_foreign_key "decidim_authorizations", "decidim_users" + add_foreign_key "decidim_budgets_budgets", "decidim_scopes" + add_foreign_key "decidim_budgets_orders", "decidim_budgets_budgets" + add_foreign_key "decidim_budgets_projects", "decidim_budgets_budgets" + add_foreign_key "decidim_categorizations", "decidim_categories" + add_foreign_key "decidim_debates_debates", "decidim_scopes" + add_foreign_key "decidim_editor_images", "decidim_organizations" + add_foreign_key "decidim_editor_images", "decidim_users", column: "decidim_author_id" + add_foreign_key "decidim_identities", "decidim_organizations" + add_foreign_key "decidim_newsletters", "decidim_users", column: "author_id" + add_foreign_key "decidim_participatory_process_steps", "decidim_participatory_processes" + add_foreign_key "decidim_participatory_process_types", "decidim_organizations" + add_foreign_key "decidim_participatory_processes", "decidim_organizations" + add_foreign_key "decidim_participatory_processes", "decidim_participatory_process_types" + add_foreign_key "decidim_participatory_processes", "decidim_scope_types" + add_foreign_key "decidim_reminder_deliveries", "decidim_reminders" + add_foreign_key "decidim_reminder_records", "decidim_reminders" + add_foreign_key "decidim_reminders", "decidim_components" + add_foreign_key "decidim_reminders", "decidim_users" + add_foreign_key "decidim_scope_types", "decidim_organizations" + add_foreign_key "decidim_scopes", "decidim_organizations" + add_foreign_key "decidim_scopes", "decidim_scope_types", column: "scope_type_id" + add_foreign_key "decidim_scopes", "decidim_scopes", column: "parent_id" + add_foreign_key "decidim_static_pages", "decidim_organizations" + add_foreign_key "decidim_user_blocks", "decidim_users" + add_foreign_key "decidim_user_blocks", "decidim_users", column: "blocking_user_id" + add_foreign_key "decidim_user_moderations", "decidim_users" + add_foreign_key "decidim_user_reports", "decidim_user_moderations", column: "user_moderation_id" + add_foreign_key "decidim_user_reports", "decidim_users", column: "user_id" + add_foreign_key "decidim_users", "decidim_organizations" + add_foreign_key "decidim_verifications_conflicts", "decidim_users", column: "current_user_id" + add_foreign_key "decidim_verifications_conflicts", "decidim_users", column: "managed_user_id" + add_foreign_key "decidim_verifications_csv_data", "decidim_organizations" + add_foreign_key "oauth_access_grants", "decidim_users", column: "resource_owner_id" + add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id" + add_foreign_key "oauth_access_tokens", "decidim_users", column: "resource_owner_id" + add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id" + add_foreign_key "oauth_applications", "decidim_organizations" +end diff --git a/db/seeds.rb b/db/seeds.rb index aba720a..d821068 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). # diff --git a/package.json b/package.json index a35e0a4..2efbd57 100644 --- a/package.json +++ b/package.json @@ -17,5 +17,17 @@ }, "browserslist": [ "extends @decidim/browserslist-config" - ] -} \ No newline at end of file + ], + "scripts": { + "lint": "eslint -c .eslintrc.json --ext .js app/packs/src", + "lint-fix": "eslint -c .eslintrc.json --ext .js app/packs/src --fix", + "stylelint": "stylelint app/packs/stylesheets/**/*.scss", + "stylelint-fix": "stylelint app/packs/stylesheets/**/*.scss --fix" + }, + "stylelint": { + "extends": "@decidim/stylelint-config", + "rules": { + "block-opening-brace-space-before": "always" + } + } +} diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index d19212a..c05709a 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase diff --git a/test/channels/application_cable/connection_test.rb b/test/channels/application_cable/connection_test.rb index 800405f..cc8337f 100644 --- a/test/channels/application_cable/connection_test.rb +++ b/test/channels/application_cable/connection_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "test_helper" class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase diff --git a/test/test_helper.rb b/test/test_helper.rb index 47b598d..8e820b2 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,4 +1,6 @@ -ENV['RAILS_ENV'] ||= 'test' +# frozen_string_literal: true + +ENV["RAILS_ENV"] ||= "test" require_relative "../config/environment" require "rails/test_help"