From 0fde2573d86f8729074489727daf23b99aa2b1d5 Mon Sep 17 00:00:00 2001 From: Damian Legawiec Date: Thu, 12 Sep 2024 17:00:10 +0200 Subject: [PATCH] switch to sqlite3, added docker image --- Dockerfile | 45 +++++------ Gemfile | 8 +- Gemfile.lock | 14 ++-- README.md | 24 ++++++ bin/docker-entrypoint | 2 +- bin/setup | 3 - config/database.yml | 79 +++--------------- db/schema.rb | 181 +++++++++++++++++++++--------------------- 8 files changed, 156 insertions(+), 200 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2c1e8b4c..c4da2fcf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,41 @@ # syntax = docker/dockerfile:1 -# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile +# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand: +# docker build -t my-app . +# docker run -d -p 80:80 -p 443:443 --name my-app -e RAILS_MASTER_KEY= my-app + +# Make sure RUBY_VERSION matches the Ruby version in .ruby-version ARG RUBY_VERSION=3.3.0 -FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base +FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base # Rails app lives here WORKDIR /rails -# Set production environment -ENV RAILS_ENV="production" \ - BUNDLE_DEPLOYMENT="1" \ - BUNDLE_PATH="/usr/local/bundle" \ - BUNDLE_WITHOUT="development" +# Install base packages +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives +ENV RAILS_ENV="development" \ + BUNDLE_DEPLOYMENT="1" \ + BUNDLE_PATH="/usr/local/bundle" # Throw-away build stage to reduce size of final image -FROM base as build +FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config + apt-get install --no-install-recommends -y build-essential git pkg-config && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems COPY Gemfile Gemfile.lock ./ RUN bundle install && \ - rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ - bundle exec bootsnap precompile --gemfile + rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git # Copy application code COPY . . -# Precompile bootsnap code for faster boot times -RUN bundle exec bootsnap precompile app/ lib/ - # Precompiling assets for production without requiring secret RAILS_MASTER_KEY RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile @@ -40,23 +43,19 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base -# Install packages needed for deployment -RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libvips postgresql-client && \ - rm -rf /var/lib/apt/lists /var/cache/apt/archives - # Copy built artifacts: gems, application -COPY --from=build /usr/local/bundle /usr/local/bundle +COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" COPY --from=build /rails /rails # Run and own only the runtime files as a non-root user for security -RUN useradd rails --create-home --shell /bin/bash && \ +RUN groupadd --system --gid 1000 rails && \ + useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \ chown -R rails:rails db log storage tmp -USER rails:rails +USER 1000:1000 # Entrypoint prepares the database. ENTRYPOINT ["/rails/bin/docker-entrypoint"] # Start the server by default, this can be overwritten at runtime EXPOSE 3000 -CMD ["./bin/rails", "server"] +CMD ["./bin/rails", "server", "-b", "0.0.0.0"] diff --git a/Gemfile b/Gemfile index e342daa4..ac557dab 100644 --- a/Gemfile +++ b/Gemfile @@ -7,10 +7,10 @@ gem "rails", "~> 7.1.4" # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] gem "sprockets-rails" -gem "mini_racer" # fixes Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) in Docker env +gem "mini_racer", platforms: %i[ ruby jruby ] # fixes Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) in Docker env -# Use pg as the database for Active Record -gem "pg", "~> 1.5" +# Use sqlite3 as the database for Active Record +gem "sqlite3", ">= 1.4" # Use the Puma web server [https://github.com/puma/puma] gem "puma", ">= 5.0" @@ -28,7 +28,7 @@ gem "stimulus-rails" gem "jbuilder" # Use Redis adapter to run Action Cable in production -gem "redis", ">= 4.0.1", group: :production +# gem "redis", ">= 4.0.1", group: :production # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] # gem "kredis" diff --git a/Gemfile.lock b/Gemfile.lock index 78e86b28..174a6be8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -292,7 +292,6 @@ GEM orm_adapter (0.5.0) paranoia (3.0.0) activerecord (>= 6, < 8.1) - pg (1.5.7) popper_js (1.16.1) psych (5.1.2) stringio @@ -348,10 +347,6 @@ GEM i18n rdoc (6.7.0) psych (>= 4.0.0) - redis (5.3.0) - redis-client (>= 0.22.0) - redis-client (0.22.2) - connection_pool regexp_parser (2.9.2) reline (0.5.10) io-console (~> 0.5) @@ -507,6 +502,12 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) + sqlite3 (2.0.4-aarch64-linux-gnu) + sqlite3 (2.0.4-arm-linux-gnu) + sqlite3 (2.0.4-arm64-darwin) + sqlite3 (2.0.4-x86-linux-gnu) + sqlite3 (2.0.4-x86_64-darwin) + sqlite3 (2.0.4-x86_64-linux-gnu) state_machines (0.6.0) state_machines-activemodel (0.9.0) activemodel (>= 6.0) @@ -567,10 +568,8 @@ DEPENDENCIES jbuilder mini_racer mission_control-jobs - pg (~> 1.5) puma (>= 5.0) rails (~> 7.1.4) - redis (>= 4.0.1) sassc! selenium-webdriver solid_cache @@ -584,6 +583,7 @@ DEPENDENCIES spree_i18n spree_sample sprockets-rails + sqlite3 (>= 1.4) stimulus-rails turbo-rails tzinfo-data diff --git a/README.md b/README.md index dd1e962e..5a9d7c3b 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,30 @@ If you want to use sample data (products, categories), you can load it using the bin/rake spree_sample:load ``` +#### Full docker setup + +If you're having trouble with Ruby/etc setup and just want to get everything up and running, you can use the following command to start the docker containers. + +```bash +docker pull vendoconnect/spree_starter +docker run -p 3000:3000 vendoconnect/spree_starter +``` + +This will start the docker containers and automatically start the rails server. + +To sign in into the admin dashboard go to `https://localhost:3000/admin` and use the following credentials: + +```bash +Email: spree@example.com +Password: spree123 +``` + +### Switching to PostgreSQL + +```bash +bin/rails db:system:change --to=postgresql +``` + ### Switching to MySQL By default, Spree Starter uses PostgreSQL. If you want to switch to MySQL, you can do so by running the following command: diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint index 67ef4931..3176d2c0 100755 --- a/bin/docker-entrypoint +++ b/bin/docker-entrypoint @@ -2,7 +2,7 @@ # If running the rails server then create or migrate existing database if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then - ./bin/rails db:prepare + AUTO_ACCEPT=1 ./bin/rails db:prepare fi exec "${@}" diff --git a/bin/setup b/bin/setup index 5ab72a0d..fbd9aba0 100755 --- a/bin/setup +++ b/bin/setup @@ -13,9 +13,6 @@ 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 "== Setup PostgreSQL and Redis ==" - system! "docker-compose up -d" - puts "== Installing dependencies ==" system! "gem install bundler --conservative" system("bundle check") || system!("bundle install") diff --git a/config/database.yml b/config/database.yml index 1fb13b7e..796466ba 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,86 +1,25 @@ -# PostgreSQL. Versions 9.3 and up are supported. +# SQLite. Versions 3.8.0 and up are supported. +# gem install sqlite3 # -# Install the pg driver: -# gem install pg -# On macOS with Homebrew: -# gem install pg -- --with-pg-config=/usr/local/bin/pg_config -# On Windows: -# gem install pg -# Choose the win32 build. -# Install PostgreSQL and put its /bin directory on your path. -# -# Configure Using Gemfile -# gem "pg" +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem "sqlite3" # default: &default - adapter: postgresql - encoding: unicode - # For details on connection pooling, see Rails configuration guide - # https://guides.rubyonrails.org/configuring.html#database-pooling + adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + timeout: 5000 development: <<: *default - database: spree_starter_development - host: <%= ENV.fetch("DB_HOST", "localhost") %> - username: <%= ENV.fetch("DB_USERNAME", "postgres") %> - - # The specified database role being used to connect to PostgreSQL. - # To create additional roles in PostgreSQL see `$ createuser --help`. - # When left blank, PostgreSQL will use the default role. This is - # the same name as the operating system user running Rails. - #username: spree_starter - - # The password associated with the PostgreSQL role (username). - #password: - - # Connect on a TCP socket. Omitted by default since the client uses a - # domain socket that doesn't need configuration. Windows does not have - # domain sockets, so uncomment these lines. - #host: localhost - - # The TCP port the server listens on. Defaults to 5432. - # If your server runs on a different port number, change accordingly. - #port: 5432 - - # Schema search path. The server defaults to $user,public - #schema_search_path: myapp,sharedapp,public - - # Minimum log levels, in increasing order: - # debug5, debug4, debug3, debug2, debug1, - # log, notice, warning, error, fatal, and panic - # Defaults to warning. - #min_messages: notice + database: storage/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default - database: spree_starter_test - host: <%= ENV.fetch("DB_HOST", "localhost") %> - username: <%= ENV.fetch("DB_USERNAME", "postgres") %> + database: storage/test.sqlite3 -# As with config/credentials.yml, you never want to store sensitive information, -# like your database password, in your source code. If your source code is -# ever seen by anyone, they now have access to your database. -# -# Instead, provide the password or a full connection URL as an environment -# variable when you boot the app. For example: -# -# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" -# -# If the connection URL is provided in the special DATABASE_URL environment -# variable, Rails will automatically merge its configuration values on top of -# the values provided in this file. Alternatively, you can specify a connection -# URL environment variable explicitly: -# -# production: -# url: <%= ENV["MY_APP_DATABASE_URL"] %> -# -# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database -# for a full overview on how database connection configuration can be specified. -# production: <<: *default - url: <%= ENV["DATABASE_URL"] %> + database: storage/production.sqlite3 diff --git a/db/schema.rb b/db/schema.rb index 1f3861cf..af61819c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,9 +11,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema[7.1].define(version: 2024_09_06_121215) do - # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" - create_table "action_mailbox_inbound_emails", force: :cascade do |t| t.integer "status", default: 0, null: false t.string "message_id", null: false @@ -78,18 +75,18 @@ end create_table "solid_cache_entries", force: :cascade do |t| - t.binary "key", null: false - t.binary "value", null: false + t.binary "key", limit: 1024, null: false + t.binary "value", limit: 536870912, null: false t.datetime "created_at", null: false - t.bigint "key_hash", null: false - t.integer "byte_size", null: false + t.integer "key_hash", limit: 8, null: false + t.integer "byte_size", limit: 4, null: false t.index ["byte_size"], name: "index_solid_cache_entries_on_byte_size" t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size" t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true end create_table "solid_queue_blocked_executions", force: :cascade do |t| - t.bigint "job_id", null: false + t.integer "job_id", null: false t.string "queue_name", null: false t.integer "priority", default: 0, null: false t.string "concurrency_key", null: false @@ -101,7 +98,7 @@ end create_table "solid_queue_claimed_executions", force: :cascade do |t| - t.bigint "job_id", null: false + t.integer "job_id", null: false t.bigint "process_id" t.datetime "created_at", null: false t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true @@ -109,7 +106,7 @@ end create_table "solid_queue_failed_executions", force: :cascade do |t| - t.bigint "job_id", null: false + t.integer "job_id", null: false t.text "error" t.datetime "created_at", null: false t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true @@ -152,7 +149,7 @@ end create_table "solid_queue_ready_executions", force: :cascade do |t| - t.bigint "job_id", null: false + t.integer "job_id", null: false t.string "queue_name", null: false t.integer "priority", default: 0, null: false t.datetime "created_at", null: false @@ -162,7 +159,7 @@ end create_table "solid_queue_recurring_executions", force: :cascade do |t| - t.bigint "job_id", null: false + t.integer "job_id", null: false t.string "task_key", null: false t.datetime "run_at", null: false t.datetime "created_at", null: false @@ -171,7 +168,7 @@ end create_table "solid_queue_scheduled_executions", force: :cascade do |t| - t.bigint "job_id", null: false + t.integer "job_id", null: false t.string "queue_name", null: false t.integer "priority", default: 0, null: false t.datetime "scheduled_at", null: false @@ -209,8 +206,8 @@ t.bigint "user_id" t.datetime "deleted_at", precision: nil t.string "label" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["country_id"], name: "index_spree_addresses_on_country_id" t.index ["deleted_at"], name: "index_spree_addresses_on_deleted_at" t.index ["firstname"], name: "index_addresses_on_firstname" @@ -253,8 +250,8 @@ t.text "alt" t.datetime "created_at", precision: nil t.datetime "updated_at", precision: nil - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["position"], name: "index_spree_assets_on_position" t.index ["viewable_id"], name: "index_assets_on_viewable_id" t.index ["viewable_type", "type"], name: "index_assets_on_viewable_type_and_type" @@ -274,8 +271,8 @@ end create_table "spree_checks", force: :cascade do |t| - t.bigint "payment_method_id" - t.bigint "user_id" + t.integer "payment_method_id" + t.integer "user_id" t.string "account_holder_name" t.string "account_holder_type" t.string "routing_number" @@ -363,8 +360,8 @@ t.bigint "payment_method_id" t.boolean "default", default: false, null: false t.datetime "deleted_at", precision: nil - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["address_id"], name: "index_spree_credit_cards_on_address_id" t.index ["deleted_at"], name: "index_spree_credit_cards_on_deleted_at" t.index ["payment_method_id"], name: "index_spree_credit_cards_on_payment_method_id" @@ -377,15 +374,15 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "store_id" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["number"], name: "index_spree_customer_returns_on_number", unique: true t.index ["stock_location_id"], name: "index_spree_customer_returns_on_stock_location_id" t.index ["store_id"], name: "index_spree_customer_returns_on_store_id" end create_table "spree_data_feeds", force: :cascade do |t| - t.bigint "store_id" + t.integer "store_id" t.string "name" t.string "type" t.string "slug" @@ -397,8 +394,8 @@ end create_table "spree_digital_links", force: :cascade do |t| - t.bigint "digital_id" - t.bigint "line_item_id" + t.integer "digital_id" + t.integer "line_item_id" t.string "token" t.integer "access_counter" t.datetime "created_at", precision: nil, null: false @@ -409,7 +406,7 @@ end create_table "spree_digitals", force: :cascade do |t| - t.bigint "variant_id" + t.integer "variant_id" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false t.index ["variant_id"], name: "index_spree_digitals_on_variant_id" @@ -465,8 +462,8 @@ t.decimal "pre_tax_amount", precision: 12, scale: 4, default: "0.0", null: false t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["order_id"], name: "index_spree_line_items_on_order_id" t.index ["tax_category_id"], name: "index_spree_line_items_on_tax_category_id" t.index ["variant_id"], name: "index_spree_line_items_on_variant_id" @@ -520,8 +517,8 @@ end create_table "spree_oauth_access_grants", force: :cascade do |t| - t.bigint "resource_owner_id", null: false - t.bigint "application_id", null: false + t.bigint "resource_owner_id" + t.bigint "application_id" t.string "token", null: false t.integer "expires_in", null: false t.text "redirect_uri", null: false @@ -577,7 +574,7 @@ create_table "spree_option_type_translations", force: :cascade do |t| t.string "presentation" t.string "locale", null: false - t.bigint "spree_option_type_id", null: false + t.integer "spree_option_type_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["locale"], name: "index_spree_option_type_translations_on_locale" @@ -591,8 +588,8 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.boolean "filterable", default: true, null: false - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["filterable"], name: "index_spree_option_types_on_filterable" t.index ["name"], name: "index_spree_option_types_on_name" t.index ["position"], name: "index_spree_option_types_on_position" @@ -601,7 +598,7 @@ create_table "spree_option_value_translations", force: :cascade do |t| t.string "presentation" t.string "locale", null: false - t.bigint "spree_option_value_id", null: false + t.integer "spree_option_value_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["locale"], name: "index_spree_option_value_translations_on_locale" @@ -625,8 +622,8 @@ t.bigint "option_type_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["name"], name: "index_spree_option_values_on_name" t.index ["option_type_id"], name: "index_spree_option_values_on_option_type_id" t.index ["position"], name: "index_spree_option_values_on_position" @@ -680,8 +677,8 @@ t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false t.boolean "store_owner_notification_delivered" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.text "internal_note" t.index ["approver_id"], name: "index_spree_orders_on_approver_id" t.index ["bill_address_id"], name: "index_spree_orders_on_bill_address_id" @@ -717,9 +714,9 @@ t.boolean "auto_capture" t.text "preferences" t.integer "position", default: 0 - t.jsonb "public_metadata" - t.jsonb "private_metadata" - t.jsonb "settings" + t.json "public_metadata" + t.json "private_metadata" + t.json "settings" t.index ["id", "type"], name: "index_spree_payment_methods_on_id_and_type" t.index ["id"], name: "index_spree_payment_methods_on_id" end @@ -735,10 +732,10 @@ create_table "spree_payment_sources", force: :cascade do |t| t.string "gateway_payment_profile_id" t.string "type" - t.bigint "payment_method_id" - t.bigint "user_id" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.integer "payment_method_id" + t.integer "user_id" + t.json "public_metadata" + t.json "private_metadata" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false t.index ["payment_method_id"], name: "index_spree_payment_sources_on_payment_method_id" @@ -761,8 +758,8 @@ t.string "number" t.string "cvv_response_code" t.string "cvv_response_message" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.string "intent_client_key" t.index ["number"], name: "index_spree_payments_on_number", unique: true t.index ["order_id"], name: "index_spree_payments_on_order_id" @@ -830,7 +827,7 @@ create_table "spree_product_property_translations", force: :cascade do |t| t.string "value" t.string "locale", null: false - t.bigint "spree_product_property_id", null: false + t.integer "spree_product_property_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["locale"], name: "index_spree_product_property_translations_on_locale" @@ -841,7 +838,7 @@ t.string "name" t.text "description" t.string "locale", null: false - t.bigint "spree_product_id", null: false + t.integer "spree_product_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.text "meta_description" @@ -870,8 +867,8 @@ t.boolean "promotionable", default: true t.string "meta_title" t.datetime "discontinue_on", precision: nil - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.string "status", default: "draft", null: false t.datetime "make_active_at", precision: nil t.index ["available_on"], name: "index_spree_products_on_available_on" @@ -983,8 +980,8 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "promotion_category_id" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["advertise"], name: "index_spree_promotions_on_advertise" t.index ["code"], name: "index_spree_promotions_on_code" t.index ["expires_at"], name: "index_spree_promotions_on_expires_at" @@ -1011,8 +1008,8 @@ t.datetime "updated_at", null: false t.boolean "filterable", default: false, null: false t.string "filter_param" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["filter_param"], name: "index_spree_properties_on_filter_param" t.index ["filterable"], name: "index_spree_properties_on_filterable" t.index ["name"], name: "index_spree_properties_on_name" @@ -1031,7 +1028,7 @@ create_table "spree_property_translations", force: :cascade do |t| t.string "presentation" t.string "locale", null: false - t.bigint "spree_property_id", null: false + t.integer "spree_property_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["locale"], name: "index_spree_property_translations_on_locale" @@ -1052,8 +1049,8 @@ t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" end create_table "spree_refund_reasons", force: :cascade do |t| @@ -1073,8 +1070,8 @@ t.datetime "updated_at", null: false t.bigint "refund_reason_id" t.bigint "reimbursement_id" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.bigint "refunder_id" t.index ["payment_id"], name: "index_spree_refunds_on_payment_id" t.index ["refund_reason_id"], name: "index_refunds_on_refund_reason_id" @@ -1201,8 +1198,8 @@ t.decimal "pre_tax_amount", precision: 12, scale: 4, default: "0.0", null: false t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["address_id"], name: "index_spree_shipments_on_address_id" t.index ["number"], name: "index_spree_shipments_on_number", unique: true t.index ["order_id"], name: "index_spree_shipments_on_order_id" @@ -1245,8 +1242,8 @@ t.string "admin_name" t.bigint "tax_category_id" t.string "code" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["deleted_at"], name: "index_spree_shipping_methods_on_deleted_at" t.index ["tax_category_id"], name: "index_spree_shipping_methods_on_tax_category_id" end @@ -1295,14 +1292,14 @@ t.datetime "updated_at", null: false t.boolean "backorderable", default: false t.datetime "deleted_at", precision: nil - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["backorderable"], name: "index_spree_stock_items_on_backorderable" t.index ["deleted_at"], name: "index_spree_stock_items_on_deleted_at" t.index ["stock_location_id", "variant_id", "deleted_at"], name: "stock_item_by_loc_var_id_deleted_at", unique: true t.index ["stock_location_id", "variant_id"], name: "stock_item_by_loc_and_var_id" t.index ["stock_location_id"], name: "index_spree_stock_items_on_stock_location_id" - t.index ["variant_id", "stock_location_id"], name: "index_spree_stock_items_unique_without_deleted_at", unique: true, where: "(deleted_at IS NULL)" + t.index ["variant_id", "stock_location_id"], name: "index_spree_stock_items_unique_without_deleted_at", unique: true, where: "deleted_at IS NULL" t.index ["variant_id"], name: "index_spree_stock_items_on_variant_id" end @@ -1352,8 +1349,8 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "number" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["destination_location_id"], name: "index_spree_stock_transfers_on_destination_location_id" t.index ["number"], name: "index_spree_stock_transfers_on_number", unique: true t.index ["source_location_id"], name: "index_spree_stock_transfers_on_source_location_id" @@ -1404,8 +1401,8 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "store_id" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["deleted_at"], name: "index_spree_store_credits_on_deleted_at" t.index ["originator_id", "originator_type"], name: "spree_store_credits_originator" t.index ["store_id"], name: "index_spree_store_credits_on_store_id" @@ -1427,7 +1424,7 @@ t.string "contact_phone" t.string "new_order_notifications_email" t.string "locale", null: false - t.bigint "spree_store_id", null: false + t.integer "spree_store_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.datetime "deleted_at", precision: nil @@ -1463,7 +1460,7 @@ t.string "seo_robots" t.string "supported_locales" t.datetime "deleted_at", precision: nil - t.jsonb "settings" + t.json "settings" t.index ["code"], name: "index_spree_stores_on_code", unique: true t.index ["default"], name: "index_spree_stores_on_default" t.index ["deleted_at"], name: "index_spree_stores_on_deleted_at" @@ -1492,8 +1489,8 @@ t.string "name" t.boolean "show_rate_in_label", default: true t.datetime "deleted_at", precision: nil - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["deleted_at"], name: "index_spree_tax_rates_on_deleted_at" t.index ["included_in_price"], name: "index_spree_tax_rates_on_included_in_price" t.index ["show_rate_in_label"], name: "index_spree_tax_rates_on_show_rate_in_label" @@ -1505,7 +1502,7 @@ t.string "name" t.text "description" t.string "locale", null: false - t.bigint "spree_taxon_id", null: false + t.integer "spree_taxon_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "meta_title" @@ -1524,8 +1521,8 @@ t.datetime "updated_at", null: false t.integer "position", default: 0 t.bigint "store_id" - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.index ["name", "store_id"], name: "index_spree_taxonomies_on_name_and_store_id", unique: true t.index ["position"], name: "index_spree_taxonomies_on_position" t.index ["store_id"], name: "index_spree_taxonomies_on_store_id" @@ -1534,7 +1531,7 @@ create_table "spree_taxonomy_translations", force: :cascade do |t| t.string "name" t.string "locale", null: false - t.bigint "spree_taxonomy_id", null: false + t.integer "spree_taxonomy_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["locale"], name: "index_spree_taxonomy_translations_on_locale" @@ -1557,8 +1554,8 @@ t.string "meta_keywords" t.integer "depth" t.boolean "hide_from_nav", default: false - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.string "pretty_name" t.index ["lft"], name: "index_spree_taxons_on_lft" t.index ["name", "parent_id", "taxonomy_id"], name: "index_spree_taxons_on_name_and_parent_id_and_taxonomy_id", unique: true @@ -1605,8 +1602,8 @@ t.datetime "reset_password_sent_at", precision: nil t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.string "first_name" t.string "last_name" t.string "selected_locale" @@ -1640,8 +1637,8 @@ t.datetime "updated_at", precision: nil, null: false t.datetime "discontinue_on", precision: nil t.datetime "created_at", precision: nil, null: false - t.jsonb "public_metadata" - t.jsonb "private_metadata" + t.json "public_metadata" + t.json "private_metadata" t.string "barcode" t.string "weight_unit" t.string "dimensions_unit" @@ -1661,7 +1658,7 @@ t.string "name", null: false t.string "request_errors" t.string "response_code" - t.bigint "subscriber_id", null: false + t.integer "subscriber_id", null: false t.boolean "success" t.string "url", null: false t.datetime "created_at", precision: nil, null: false @@ -1674,7 +1671,7 @@ create_table "spree_webhooks_subscribers", force: :cascade do |t| t.string "url", null: false t.boolean "active", default: false - t.jsonb "subscriptions" + t.json "subscriptions" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false t.string "secret_key", null: false @@ -1682,8 +1679,8 @@ end create_table "spree_wished_items", force: :cascade do |t| - t.bigint "variant_id" - t.bigint "wishlist_id" + t.integer "variant_id" + t.integer "wishlist_id" t.integer "quantity", default: 1, null: false t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false @@ -1693,8 +1690,8 @@ end create_table "spree_wishlists", force: :cascade do |t| - t.bigint "user_id" - t.bigint "store_id" + t.integer "user_id" + t.integer "store_id" t.string "name" t.string "token", null: false t.boolean "is_private", default: true, null: false