diff --git a/Gemfile b/Gemfile index 591d8b6..e16248a 100644 --- a/Gemfile +++ b/Gemfile @@ -41,3 +41,6 @@ group :development, :test do gem 'database_consistency' gem 'dotenv-rails' # Manage .env end + +gem "solid_queue", "~> 0.8.2" +gem "mission_control-jobs" diff --git a/Gemfile.lock b/Gemfile.lock index 0ff1f88..b1a6fc7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -120,6 +120,8 @@ GEM drb (2.2.1) erubi (1.13.0) erubis (2.7.0) + et-orbi (1.2.11) + tzinfo faker (3.4.1) i18n (>= 1.8.11, < 2) faraday (2.10.0) @@ -131,6 +133,9 @@ GEM activerecord (>= 6.0) fast_jsonapi (1.5) activesupport (>= 4.2) + fugit (1.11.1) + et-orbi (~> 1, >= 1.2.11) + raabro (~> 1.4) fx (0.8.0) activerecord (>= 6.0.0) railties (>= 6.0.0) @@ -178,6 +183,12 @@ GEM method_source (1.1.0) mini_mime (1.1.5) minitest (5.24.1) + mission_control-jobs (0.3.1) + importmap-rails + irb (~> 1.13) + rails (>= 7.1) + stimulus-rails + turbo-rails mutex_m (0.2.0) net-http (0.4.1) uri @@ -213,6 +224,7 @@ GEM stringio puma (6.4.2) nio4r (~> 2.0) + raabro (1.4.0) racc (1.8.0) rack (3.1.7) rack-session (2.0.0) @@ -285,6 +297,13 @@ GEM activerecord (>= 4.0.0) railties (>= 4.0.0) sexp_processor (4.17.2) + solid_queue (0.8.2) + activejob (>= 7.1) + activerecord (>= 7.1) + concurrent-ruby (>= 1.3.1) + fugit (~> 1.11.0) + railties (>= 7.1) + thor (~> 1.3.1) sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -292,6 +311,8 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) + stimulus-rails (1.3.4) + railties (>= 6.0.0) stringio (3.1.1) strong_migrations (2.0.0) activerecord (>= 6.1) @@ -300,6 +321,10 @@ GEM unicode-display_width (>= 1.1.1, < 3) thor (1.3.1) timeout (0.4.1) + turbo-rails (2.0.6) + actionpack (>= 6.0.0) + activejob (>= 6.0.0) + railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) @@ -339,6 +364,7 @@ DEPENDENCIES importmap-rails (~> 1.2) json jwt (~> 2.7) + mission_control-jobs pg (~> 1.5) pg_query (~> 5.1) pg_search (~> 2.3) @@ -352,6 +378,7 @@ DEPENDENCIES rails-pg-extras rails_best_practices scenic + solid_queue (~> 0.8.2) sprockets-rails (~> 3.4) strong_migrations whenever (~> 1.0) diff --git a/app/jobs/solid_queue_hello_world_job.rb b/app/jobs/solid_queue_hello_world_job.rb new file mode 100644 index 0000000..295858c --- /dev/null +++ b/app/jobs/solid_queue_hello_world_job.rb @@ -0,0 +1,7 @@ +class SolidQueueHelloWorldJob < ApplicationJob + queue_as :default + + def perform(*args) + Rails.logger.info "solid queue hello world" + end +end diff --git a/bin/jobs b/bin/jobs new file mode 100755 index 0000000..dcf59f3 --- /dev/null +++ b/bin/jobs @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby + +require_relative "../config/environment" +require "solid_queue/cli" + +SolidQueue::Cli.start(ARGV) diff --git a/config/environments/development.rb b/config/environments/development.rb index a9c3707..2f26960 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -64,4 +64,6 @@ # config.active_record.database_selector = { delay: 2.seconds } # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session + + config.active_job.queue_adapter = :solid_queue end diff --git a/config/routes.rb b/config/routes.rb index 8f4b158..58b60d6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,4 +14,7 @@ end post '/auth/login', to: 'authentication#login' + + # Mission Control + mount MissionControl::Jobs::Engine, at: "/jobs" end diff --git a/config/solid_queue.yml b/config/solid_queue.yml new file mode 100644 index 0000000..9eace59 --- /dev/null +++ b/config/solid_queue.yml @@ -0,0 +1,18 @@ +default: &default + dispatchers: + - polling_interval: 1 + batch_size: 500 + workers: + - queues: "*" + threads: 3 + processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %> + polling_interval: 0.1 + +development: + <<: *default + +test: + <<: *default + +production: + <<: *default diff --git a/db/queue_schema.rb b/db/queue_schema.rb new file mode 100644 index 0000000..4b49a12 --- /dev/null +++ b/db/queue_schema.rb @@ -0,0 +1,129 @@ +ActiveRecord::Schema[7.1].define(version: 2024_09_04_193154) do + create_table "solid_queue_blocked_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "queue_name", null: false + t.integer "priority", default: 0, null: false + t.string "concurrency_key", null: false + t.datetime "expires_at", null: false + t.datetime "created_at", null: false + t.index [ "concurrency_key", "priority", "job_id" ], name: "index_solid_queue_blocked_executions_for_release" + t.index [ "expires_at", "concurrency_key" ], name: "index_solid_queue_blocked_executions_for_maintenance" + t.index [ "job_id" ], name: "index_solid_queue_blocked_executions_on_job_id", unique: true + end + + create_table "solid_queue_claimed_executions", force: :cascade do |t| + t.bigint "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 + t.index [ "process_id", "job_id" ], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id" + end + + create_table "solid_queue_failed_executions", force: :cascade do |t| + t.bigint "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 + end + + create_table "solid_queue_jobs", force: :cascade do |t| + t.string "queue_name", null: false + t.string "class_name", null: false + t.text "arguments" + t.integer "priority", default: 0, null: false + t.string "active_job_id" + t.datetime "scheduled_at" + t.datetime "finished_at" + t.string "concurrency_key" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index [ "active_job_id" ], name: "index_solid_queue_jobs_on_active_job_id" + t.index [ "class_name" ], name: "index_solid_queue_jobs_on_class_name" + t.index [ "finished_at" ], name: "index_solid_queue_jobs_on_finished_at" + t.index [ "queue_name", "finished_at" ], name: "index_solid_queue_jobs_for_filtering" + t.index [ "scheduled_at", "finished_at" ], name: "index_solid_queue_jobs_for_alerting" + end + + create_table "solid_queue_pauses", force: :cascade do |t| + t.string "queue_name", null: false + t.datetime "created_at", null: false + t.index [ "queue_name" ], name: "index_solid_queue_pauses_on_queue_name", unique: true + end + + create_table "solid_queue_processes", force: :cascade do |t| + t.string "kind", null: false + t.datetime "last_heartbeat_at", null: false + t.bigint "supervisor_id" + t.integer "pid", null: false + t.string "hostname" + t.text "metadata" + t.datetime "created_at", null: false + t.string "name", null: false + t.index [ "last_heartbeat_at" ], name: "index_solid_queue_processes_on_last_heartbeat_at" + t.index [ "name", "supervisor_id" ], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true + t.index [ "supervisor_id" ], name: "index_solid_queue_processes_on_supervisor_id" + end + + create_table "solid_queue_ready_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "queue_name", null: false + t.integer "priority", default: 0, null: false + t.datetime "created_at", null: false + t.index [ "job_id" ], name: "index_solid_queue_ready_executions_on_job_id", unique: true + t.index [ "priority", "job_id" ], name: "index_solid_queue_poll_all" + t.index [ "queue_name", "priority", "job_id" ], name: "index_solid_queue_poll_by_queue" + end + + create_table "solid_queue_recurring_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "task_key", null: false + t.datetime "run_at", null: false + t.datetime "created_at", null: false + t.index [ "job_id" ], name: "index_solid_queue_recurring_executions_on_job_id", unique: true + t.index [ "task_key", "run_at" ], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true + end + + create_table "solid_queue_recurring_tasks", force: :cascade do |t| + t.string "key", null: false + t.string "schedule", null: false + t.string "command", limit: 2048 + t.string "class_name" + t.text "arguments" + t.string "queue_name" + t.integer "priority", default: 0 + t.boolean "static", default: true, null: false + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index [ "key" ], name: "index_solid_queue_recurring_tasks_on_key", unique: true + t.index [ "static" ], name: "index_solid_queue_recurring_tasks_on_static" + end + + create_table "solid_queue_scheduled_executions", force: :cascade do |t| + t.bigint "job_id", null: false + t.string "queue_name", null: false + t.integer "priority", default: 0, null: false + t.datetime "scheduled_at", null: false + t.datetime "created_at", null: false + t.index [ "job_id" ], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true + t.index [ "scheduled_at", "priority", "job_id" ], name: "index_solid_queue_dispatch_all" + end + + create_table "solid_queue_semaphores", force: :cascade do |t| + t.string "key", null: false + t.integer "value", default: 1, null: false + t.datetime "expires_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index [ "expires_at" ], name: "index_solid_queue_semaphores_on_expires_at" + t.index [ "key", "value" ], name: "index_solid_queue_semaphores_on_key_and_value" + t.index [ "key" ], name: "index_solid_queue_semaphores_on_key", unique: true + end + + add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade + add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade +end diff --git a/db/structure.sql b/db/structure.sql index 8da33d7..ce1748d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -11,30 +11,70 @@ SET row_security = off; ALTER TABLE IF EXISTS ONLY rideshare.trip_requests DROP CONSTRAINT IF EXISTS fk_rails_fa2679b626; ALTER TABLE IF EXISTS ONLY rideshare.trips DROP CONSTRAINT IF EXISTS fk_rails_e7560abc33; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_scheduled_executions DROP CONSTRAINT IF EXISTS fk_rails_c4316f352d; ALTER TABLE IF EXISTS ONLY rideshare.trip_requests DROP CONSTRAINT IF EXISTS fk_rails_c17a139554; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_claimed_executions DROP CONSTRAINT IF EXISTS fk_rails_9cfe4d4944; ALTER TABLE IF EXISTS ONLY rideshare.trip_positions DROP CONSTRAINT IF EXISTS fk_rails_9688ac8706; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_ready_executions DROP CONSTRAINT IF EXISTS fk_rails_81fcbd66af; ALTER TABLE IF EXISTS ONLY rideshare.vehicle_reservations DROP CONSTRAINT IF EXISTS fk_rails_7edc8e666a; ALTER TABLE IF EXISTS ONLY rideshare.trips DROP CONSTRAINT IF EXISTS fk_rails_6d92acb430; ALTER TABLE IF EXISTS ONLY rideshare.vehicle_reservations DROP CONSTRAINT IF EXISTS fk_rails_59996232fc; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_blocked_executions DROP CONSTRAINT IF EXISTS fk_rails_4cd34e2228; ALTER TABLE IF EXISTS ONLY rideshare.trip_requests DROP CONSTRAINT IF EXISTS fk_rails_3fdebbfaca; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_failed_executions DROP CONSTRAINT IF EXISTS fk_rails_39bbc7a631; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_recurring_executions DROP CONSTRAINT IF EXISTS fk_rails_318a5533ed; DROP INDEX IF EXISTS rideshare.index_vehicles_on_name; DROP INDEX IF EXISTS rideshare.index_vehicle_reservations_on_vehicle_id; -DROP INDEX IF EXISTS rideshare.index_users_on_last_name; -DROP INDEX IF EXISTS rideshare.index_users_on_email; -DROP INDEX IF EXISTS rideshare.index_trips_on_trip_request_id; -DROP INDEX IF EXISTS rideshare.index_trips_on_rating; -DROP INDEX IF EXISTS rideshare.index_trips_on_driver_id; -DROP INDEX IF EXISTS rideshare.index_trip_requests_on_start_location_id; -DROP INDEX IF EXISTS rideshare.index_trip_requests_on_rider_id; -DROP INDEX IF EXISTS rideshare.index_trip_requests_on_end_location_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_semaphores_on_key_and_value; +DROP INDEX IF EXISTS rideshare.index_solid_queue_semaphores_on_key; +DROP INDEX IF EXISTS rideshare.index_solid_queue_semaphores_on_expires_at; +DROP INDEX IF EXISTS rideshare.index_solid_queue_scheduled_executions_on_job_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_recurring_tasks_on_static; +DROP INDEX IF EXISTS rideshare.index_solid_queue_recurring_tasks_on_key; +DROP INDEX IF EXISTS rideshare.index_solid_queue_recurring_executions_on_task_key_and_run_at; +DROP INDEX IF EXISTS rideshare.index_solid_queue_recurring_executions_on_job_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_ready_executions_on_job_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_processes_on_supervisor_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_processes_on_name_and_supervisor_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_processes_on_last_heartbeat_at; +DROP INDEX IF EXISTS rideshare.index_solid_queue_poll_by_queue; +DROP INDEX IF EXISTS rideshare.index_solid_queue_poll_all; +DROP INDEX IF EXISTS rideshare.index_solid_queue_pauses_on_queue_name; +DROP INDEX IF EXISTS rideshare.index_solid_queue_jobs_on_finished_at; +DROP INDEX IF EXISTS rideshare.index_solid_queue_jobs_on_class_name; +DROP INDEX IF EXISTS rideshare.index_solid_queue_jobs_on_active_job_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_jobs_for_filtering; +DROP INDEX IF EXISTS rideshare.index_solid_queue_jobs_for_alerting; +DROP INDEX IF EXISTS rideshare.index_solid_queue_failed_executions_on_job_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_dispatch_all; +DROP INDEX IF EXISTS rideshare.index_solid_queue_claimed_executions_on_process_id_and_job_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_claimed_executions_on_job_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_blocked_executions_on_job_id; +DROP INDEX IF EXISTS rideshare.index_solid_queue_blocked_executions_for_release; +DROP INDEX IF EXISTS rideshare.index_solid_queue_blocked_executions_for_maintenance; DROP INDEX IF EXISTS rideshare.index_locations_on_address; DROP INDEX IF EXISTS rideshare.index_fast_search_results_on_driver_id; +DROP INDEX IF EXISTS rideshare.idx_users_sin_cov_partial; +DROP INDEX IF EXISTS rideshare.idx_trips_multi; +DROP INDEX IF EXISTS rideshare.idx_trips_driv_rat_completed_cov_part; +DROP INDEX IF EXISTS rideshare.idx_trip_requests_sin_partial; ALTER TABLE IF EXISTS ONLY rideshare.vehicles DROP CONSTRAINT IF EXISTS vehicles_pkey; ALTER TABLE IF EXISTS ONLY rideshare.vehicle_reservations DROP CONSTRAINT IF EXISTS vehicle_reservations_pkey; ALTER TABLE IF EXISTS ONLY rideshare.users DROP CONSTRAINT IF EXISTS users_pkey; ALTER TABLE IF EXISTS ONLY rideshare.trips DROP CONSTRAINT IF EXISTS trips_pkey; ALTER TABLE IF EXISTS ONLY rideshare.trip_requests DROP CONSTRAINT IF EXISTS trip_requests_pkey; ALTER TABLE IF EXISTS ONLY rideshare.trip_positions DROP CONSTRAINT IF EXISTS trip_positions_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_semaphores DROP CONSTRAINT IF EXISTS solid_queue_semaphores_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_scheduled_executions DROP CONSTRAINT IF EXISTS solid_queue_scheduled_executions_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_recurring_tasks DROP CONSTRAINT IF EXISTS solid_queue_recurring_tasks_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_recurring_executions DROP CONSTRAINT IF EXISTS solid_queue_recurring_executions_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_ready_executions DROP CONSTRAINT IF EXISTS solid_queue_ready_executions_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_processes DROP CONSTRAINT IF EXISTS solid_queue_processes_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_pauses DROP CONSTRAINT IF EXISTS solid_queue_pauses_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_jobs DROP CONSTRAINT IF EXISTS solid_queue_jobs_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_failed_executions DROP CONSTRAINT IF EXISTS solid_queue_failed_executions_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_claimed_executions DROP CONSTRAINT IF EXISTS solid_queue_claimed_executions_pkey; +ALTER TABLE IF EXISTS ONLY rideshare.solid_queue_blocked_executions DROP CONSTRAINT IF EXISTS solid_queue_blocked_executions_pkey; ALTER TABLE IF EXISTS ONLY rideshare.schema_migrations DROP CONSTRAINT IF EXISTS schema_migrations_pkey; ALTER TABLE IF EXISTS ONLY rideshare.vehicle_reservations DROP CONSTRAINT IF EXISTS non_overlapping_vehicle_registration; ALTER TABLE IF EXISTS ONLY rideshare.locations DROP CONSTRAINT IF EXISTS locations_pkey; @@ -46,6 +86,17 @@ ALTER TABLE IF EXISTS rideshare.users ALTER COLUMN id DROP DEFAULT; ALTER TABLE IF EXISTS rideshare.trips ALTER COLUMN id DROP DEFAULT; ALTER TABLE IF EXISTS rideshare.trip_requests ALTER COLUMN id DROP DEFAULT; ALTER TABLE IF EXISTS rideshare.trip_positions ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_semaphores ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_scheduled_executions ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_recurring_tasks ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_recurring_executions ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_ready_executions ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_processes ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_pauses ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_jobs ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_failed_executions ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_claimed_executions ALTER COLUMN id DROP DEFAULT; +ALTER TABLE IF EXISTS rideshare.solid_queue_blocked_executions ALTER COLUMN id DROP DEFAULT; ALTER TABLE IF EXISTS rideshare.locations ALTER COLUMN id DROP DEFAULT; DROP SEQUENCE IF EXISTS rideshare.vehicles_id_seq; DROP TABLE IF EXISTS rideshare.vehicles; @@ -57,6 +108,28 @@ DROP SEQUENCE IF EXISTS rideshare.trip_requests_id_seq; DROP TABLE IF EXISTS rideshare.trip_requests; DROP SEQUENCE IF EXISTS rideshare.trip_positions_id_seq; DROP TABLE IF EXISTS rideshare.trip_positions; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_semaphores_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_semaphores; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_scheduled_executions_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_scheduled_executions; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_recurring_tasks_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_recurring_tasks; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_recurring_executions_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_recurring_executions; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_ready_executions_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_ready_executions; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_processes_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_processes; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_pauses_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_pauses; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_jobs_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_jobs; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_failed_executions_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_failed_executions; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_claimed_executions_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_claimed_executions; +DROP SEQUENCE IF EXISTS rideshare.solid_queue_blocked_executions_id_seq; +DROP TABLE IF EXISTS rideshare.solid_queue_blocked_executions; DROP VIEW IF EXISTS rideshare.search_results; DROP TABLE IF EXISTS rideshare.schema_migrations; DROP SEQUENCE IF EXISTS rideshare.locations_id_seq; @@ -314,6 +387,375 @@ CREATE VIEW rideshare.search_results AS ORDER BY (count(t.rating)) DESC; +-- +-- Name: solid_queue_blocked_executions; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_blocked_executions ( + id bigint NOT NULL, + job_id integer NOT NULL, + queue_name character varying NOT NULL, + priority integer DEFAULT 0 NOT NULL, + concurrency_key character varying NOT NULL, + expires_at timestamp(6) without time zone NOT NULL, + created_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_blocked_executions_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_blocked_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_blocked_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_blocked_executions_id_seq OWNED BY rideshare.solid_queue_blocked_executions.id; + + +-- +-- Name: solid_queue_claimed_executions; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_claimed_executions ( + id bigint NOT NULL, + job_id integer NOT NULL, + process_id bigint, + created_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_claimed_executions_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_claimed_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_claimed_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_claimed_executions_id_seq OWNED BY rideshare.solid_queue_claimed_executions.id; + + +-- +-- Name: solid_queue_failed_executions; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_failed_executions ( + id bigint NOT NULL, + job_id integer NOT NULL, + error text, + created_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_failed_executions_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_failed_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_failed_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_failed_executions_id_seq OWNED BY rideshare.solid_queue_failed_executions.id; + + +-- +-- Name: solid_queue_jobs; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_jobs ( + id bigint NOT NULL, + queue_name character varying NOT NULL, + class_name character varying NOT NULL, + arguments text, + priority integer DEFAULT 0 NOT NULL, + active_job_id character varying, + scheduled_at timestamp(6) without time zone, + finished_at timestamp(6) without time zone, + concurrency_key character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_jobs_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_jobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_jobs_id_seq OWNED BY rideshare.solid_queue_jobs.id; + + +-- +-- Name: solid_queue_pauses; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_pauses ( + id bigint NOT NULL, + queue_name character varying NOT NULL, + created_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_pauses_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_pauses_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_pauses_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_pauses_id_seq OWNED BY rideshare.solid_queue_pauses.id; + + +-- +-- Name: solid_queue_processes; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_processes ( + id bigint NOT NULL, + kind character varying NOT NULL, + last_heartbeat_at timestamp(6) without time zone NOT NULL, + supervisor_id bigint, + pid integer NOT NULL, + hostname character varying, + metadata text, + created_at timestamp(6) without time zone NOT NULL, + name character varying NOT NULL +); + + +-- +-- Name: solid_queue_processes_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_processes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_processes_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_processes_id_seq OWNED BY rideshare.solid_queue_processes.id; + + +-- +-- Name: solid_queue_ready_executions; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_ready_executions ( + id bigint NOT NULL, + job_id integer NOT NULL, + queue_name character varying NOT NULL, + priority integer DEFAULT 0 NOT NULL, + created_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_ready_executions_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_ready_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_ready_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_ready_executions_id_seq OWNED BY rideshare.solid_queue_ready_executions.id; + + +-- +-- Name: solid_queue_recurring_executions; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_recurring_executions ( + id bigint NOT NULL, + job_id integer NOT NULL, + task_key character varying NOT NULL, + run_at timestamp(6) without time zone NOT NULL, + created_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_recurring_executions_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_recurring_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_recurring_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_recurring_executions_id_seq OWNED BY rideshare.solid_queue_recurring_executions.id; + + +-- +-- Name: solid_queue_recurring_tasks; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_recurring_tasks ( + id bigint NOT NULL, + key character varying NOT NULL, + schedule character varying NOT NULL, + command character varying(2048), + class_name character varying, + arguments text, + queue_name character varying, + priority integer DEFAULT 0, + static boolean DEFAULT true NOT NULL, + description text, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_recurring_tasks_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_recurring_tasks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_recurring_tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_recurring_tasks_id_seq OWNED BY rideshare.solid_queue_recurring_tasks.id; + + +-- +-- Name: solid_queue_scheduled_executions; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_scheduled_executions ( + id bigint NOT NULL, + job_id integer NOT NULL, + queue_name character varying NOT NULL, + priority integer DEFAULT 0 NOT NULL, + scheduled_at timestamp(6) without time zone NOT NULL, + created_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_scheduled_executions_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_scheduled_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_scheduled_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_scheduled_executions_id_seq OWNED BY rideshare.solid_queue_scheduled_executions.id; + + +-- +-- Name: solid_queue_semaphores; Type: TABLE; Schema: rideshare; Owner: - +-- + +CREATE TABLE rideshare.solid_queue_semaphores ( + id bigint NOT NULL, + key character varying NOT NULL, + value integer DEFAULT 1 NOT NULL, + expires_at timestamp(6) without time zone NOT NULL, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: solid_queue_semaphores_id_seq; Type: SEQUENCE; Schema: rideshare; Owner: - +-- + +CREATE SEQUENCE rideshare.solid_queue_semaphores_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: solid_queue_semaphores_id_seq; Type: SEQUENCE OWNED BY; Schema: rideshare; Owner: - +-- + +ALTER SEQUENCE rideshare.solid_queue_semaphores_id_seq OWNED BY rideshare.solid_queue_semaphores.id; + + -- -- Name: trip_positions; Type: TABLE; Schema: rideshare; Owner: - -- @@ -491,6 +933,83 @@ ALTER SEQUENCE rideshare.vehicles_id_seq OWNED BY rideshare.vehicles.id; ALTER TABLE ONLY rideshare.locations ALTER COLUMN id SET DEFAULT nextval('rideshare.locations_id_seq'::regclass); +-- +-- Name: solid_queue_blocked_executions id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_blocked_executions ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_blocked_executions_id_seq'::regclass); + + +-- +-- Name: solid_queue_claimed_executions id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_claimed_executions ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_claimed_executions_id_seq'::regclass); + + +-- +-- Name: solid_queue_failed_executions id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_failed_executions ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_failed_executions_id_seq'::regclass); + + +-- +-- Name: solid_queue_jobs id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_jobs ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_jobs_id_seq'::regclass); + + +-- +-- Name: solid_queue_pauses id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_pauses ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_pauses_id_seq'::regclass); + + +-- +-- Name: solid_queue_processes id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_processes ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_processes_id_seq'::regclass); + + +-- +-- Name: solid_queue_ready_executions id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_ready_executions ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_ready_executions_id_seq'::regclass); + + +-- +-- Name: solid_queue_recurring_executions id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_recurring_executions ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_recurring_executions_id_seq'::regclass); + + +-- +-- Name: solid_queue_recurring_tasks id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_recurring_tasks ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_recurring_tasks_id_seq'::regclass); + + +-- +-- Name: solid_queue_scheduled_executions id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_scheduled_executions ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_scheduled_executions_id_seq'::regclass); + + +-- +-- Name: solid_queue_semaphores id; Type: DEFAULT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_semaphores ALTER COLUMN id SET DEFAULT nextval('rideshare.solid_queue_semaphores_id_seq'::regclass); + + -- -- Name: trip_positions id; Type: DEFAULT; Schema: rideshare; Owner: - -- @@ -573,6 +1092,94 @@ ALTER TABLE ONLY rideshare.schema_migrations ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); +-- +-- Name: solid_queue_blocked_executions solid_queue_blocked_executions_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_blocked_executions + ADD CONSTRAINT solid_queue_blocked_executions_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_claimed_executions solid_queue_claimed_executions_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_claimed_executions + ADD CONSTRAINT solid_queue_claimed_executions_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_failed_executions solid_queue_failed_executions_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_failed_executions + ADD CONSTRAINT solid_queue_failed_executions_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_jobs solid_queue_jobs_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_jobs + ADD CONSTRAINT solid_queue_jobs_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_pauses solid_queue_pauses_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_pauses + ADD CONSTRAINT solid_queue_pauses_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_processes solid_queue_processes_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_processes + ADD CONSTRAINT solid_queue_processes_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_ready_executions solid_queue_ready_executions_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_ready_executions + ADD CONSTRAINT solid_queue_ready_executions_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_recurring_executions solid_queue_recurring_executions_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_recurring_executions + ADD CONSTRAINT solid_queue_recurring_executions_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_recurring_tasks solid_queue_recurring_tasks_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_recurring_tasks + ADD CONSTRAINT solid_queue_recurring_tasks_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_scheduled_executions solid_queue_scheduled_executions_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_scheduled_executions + ADD CONSTRAINT solid_queue_scheduled_executions_pkey PRIMARY KEY (id); + + +-- +-- Name: solid_queue_semaphores solid_queue_semaphores_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_semaphores + ADD CONSTRAINT solid_queue_semaphores_pkey PRIMARY KEY (id); + + -- -- Name: trip_positions trip_positions_pkey; Type: CONSTRAINT; Schema: rideshare; Owner: - -- @@ -621,6 +1228,34 @@ ALTER TABLE ONLY rideshare.vehicles ADD CONSTRAINT vehicles_pkey PRIMARY KEY (id); +-- +-- Name: idx_trip_requests_sin_partial; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX idx_trip_requests_sin_partial ON rideshare.trip_requests USING btree (id) WHERE (end_location_id = 2); + + +-- +-- Name: idx_trips_driv_rat_completed_cov_part; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX idx_trips_driv_rat_completed_cov_part ON rideshare.trips USING btree (driver_id) INCLUDE (rating) WHERE ((rating IS NOT NULL) AND (completed_at IS NOT NULL)); + + +-- +-- Name: idx_trips_multi; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX idx_trips_multi ON rideshare.trips USING btree (completed_at, trip_request_id, driver_id); + + +-- +-- Name: idx_users_sin_cov_partial; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX idx_users_sin_cov_partial ON rideshare.users USING btree (id) INCLUDE (first_name, last_name) WHERE ((type)::text = 'Driver'::text); + + -- -- Name: index_fast_search_results_on_driver_id; Type: INDEX; Schema: rideshare; Owner: - -- @@ -636,59 +1271,192 @@ CREATE UNIQUE INDEX index_locations_on_address ON rideshare.locations USING btre -- --- Name: index_trip_requests_on_end_location_id; Type: INDEX; Schema: rideshare; Owner: - +-- Name: index_solid_queue_blocked_executions_for_maintenance; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_blocked_executions_for_maintenance ON rideshare.solid_queue_blocked_executions USING btree (expires_at, concurrency_key); + + +-- +-- Name: index_solid_queue_blocked_executions_for_release; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_blocked_executions_for_release ON rideshare.solid_queue_blocked_executions USING btree (concurrency_key, priority, job_id); + + +-- +-- Name: index_solid_queue_blocked_executions_on_job_id; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE UNIQUE INDEX index_solid_queue_blocked_executions_on_job_id ON rideshare.solid_queue_blocked_executions USING btree (job_id); + + +-- +-- Name: index_solid_queue_claimed_executions_on_job_id; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE UNIQUE INDEX index_solid_queue_claimed_executions_on_job_id ON rideshare.solid_queue_claimed_executions USING btree (job_id); + + +-- +-- Name: index_solid_queue_claimed_executions_on_process_id_and_job_id; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_claimed_executions_on_process_id_and_job_id ON rideshare.solid_queue_claimed_executions USING btree (process_id, job_id); + + +-- +-- Name: index_solid_queue_dispatch_all; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_dispatch_all ON rideshare.solid_queue_scheduled_executions USING btree (scheduled_at, priority, job_id); + + +-- +-- Name: index_solid_queue_failed_executions_on_job_id; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE UNIQUE INDEX index_solid_queue_failed_executions_on_job_id ON rideshare.solid_queue_failed_executions USING btree (job_id); + + +-- +-- Name: index_solid_queue_jobs_for_alerting; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_jobs_for_alerting ON rideshare.solid_queue_jobs USING btree (scheduled_at, finished_at); + + +-- +-- Name: index_solid_queue_jobs_for_filtering; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_jobs_for_filtering ON rideshare.solid_queue_jobs USING btree (queue_name, finished_at); + + +-- +-- Name: index_solid_queue_jobs_on_active_job_id; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_jobs_on_active_job_id ON rideshare.solid_queue_jobs USING btree (active_job_id); + + +-- +-- Name: index_solid_queue_jobs_on_class_name; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_jobs_on_class_name ON rideshare.solid_queue_jobs USING btree (class_name); + + +-- +-- Name: index_solid_queue_jobs_on_finished_at; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_jobs_on_finished_at ON rideshare.solid_queue_jobs USING btree (finished_at); + + +-- +-- Name: index_solid_queue_pauses_on_queue_name; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE UNIQUE INDEX index_solid_queue_pauses_on_queue_name ON rideshare.solid_queue_pauses USING btree (queue_name); + + +-- +-- Name: index_solid_queue_poll_all; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_poll_all ON rideshare.solid_queue_ready_executions USING btree (priority, job_id); + + +-- +-- Name: index_solid_queue_poll_by_queue; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_poll_by_queue ON rideshare.solid_queue_ready_executions USING btree (queue_name, priority, job_id); + + +-- +-- Name: index_solid_queue_processes_on_last_heartbeat_at; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_processes_on_last_heartbeat_at ON rideshare.solid_queue_processes USING btree (last_heartbeat_at); + + +-- +-- Name: index_solid_queue_processes_on_name_and_supervisor_id; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE UNIQUE INDEX index_solid_queue_processes_on_name_and_supervisor_id ON rideshare.solid_queue_processes USING btree (name, supervisor_id); + + +-- +-- Name: index_solid_queue_processes_on_supervisor_id; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_processes_on_supervisor_id ON rideshare.solid_queue_processes USING btree (supervisor_id); + + +-- +-- Name: index_solid_queue_ready_executions_on_job_id; Type: INDEX; Schema: rideshare; Owner: - -- -CREATE INDEX index_trip_requests_on_end_location_id ON rideshare.trip_requests USING btree (end_location_id); +CREATE UNIQUE INDEX index_solid_queue_ready_executions_on_job_id ON rideshare.solid_queue_ready_executions USING btree (job_id); -- --- Name: index_trip_requests_on_rider_id; Type: INDEX; Schema: rideshare; Owner: - +-- Name: index_solid_queue_recurring_executions_on_job_id; Type: INDEX; Schema: rideshare; Owner: - -- -CREATE INDEX index_trip_requests_on_rider_id ON rideshare.trip_requests USING btree (rider_id); +CREATE UNIQUE INDEX index_solid_queue_recurring_executions_on_job_id ON rideshare.solid_queue_recurring_executions USING btree (job_id); -- --- Name: index_trip_requests_on_start_location_id; Type: INDEX; Schema: rideshare; Owner: - +-- Name: index_solid_queue_recurring_executions_on_task_key_and_run_at; Type: INDEX; Schema: rideshare; Owner: - -- -CREATE INDEX index_trip_requests_on_start_location_id ON rideshare.trip_requests USING btree (start_location_id); +CREATE UNIQUE INDEX index_solid_queue_recurring_executions_on_task_key_and_run_at ON rideshare.solid_queue_recurring_executions USING btree (task_key, run_at); -- --- Name: index_trips_on_driver_id; Type: INDEX; Schema: rideshare; Owner: - +-- Name: index_solid_queue_recurring_tasks_on_key; Type: INDEX; Schema: rideshare; Owner: - -- -CREATE INDEX index_trips_on_driver_id ON rideshare.trips USING btree (driver_id); +CREATE UNIQUE INDEX index_solid_queue_recurring_tasks_on_key ON rideshare.solid_queue_recurring_tasks USING btree (key); -- --- Name: index_trips_on_rating; Type: INDEX; Schema: rideshare; Owner: - +-- Name: index_solid_queue_recurring_tasks_on_static; Type: INDEX; Schema: rideshare; Owner: - -- -CREATE INDEX index_trips_on_rating ON rideshare.trips USING btree (rating); +CREATE INDEX index_solid_queue_recurring_tasks_on_static ON rideshare.solid_queue_recurring_tasks USING btree (static); -- --- Name: index_trips_on_trip_request_id; Type: INDEX; Schema: rideshare; Owner: - +-- Name: index_solid_queue_scheduled_executions_on_job_id; Type: INDEX; Schema: rideshare; Owner: - -- -CREATE INDEX index_trips_on_trip_request_id ON rideshare.trips USING btree (trip_request_id); +CREATE UNIQUE INDEX index_solid_queue_scheduled_executions_on_job_id ON rideshare.solid_queue_scheduled_executions USING btree (job_id); -- --- Name: index_users_on_email; Type: INDEX; Schema: rideshare; Owner: - +-- Name: index_solid_queue_semaphores_on_expires_at; Type: INDEX; Schema: rideshare; Owner: - -- -CREATE UNIQUE INDEX index_users_on_email ON rideshare.users USING btree (email); +CREATE INDEX index_solid_queue_semaphores_on_expires_at ON rideshare.solid_queue_semaphores USING btree (expires_at); -- --- Name: index_users_on_last_name; Type: INDEX; Schema: rideshare; Owner: - +-- Name: index_solid_queue_semaphores_on_key; Type: INDEX; Schema: rideshare; Owner: - -- -CREATE INDEX index_users_on_last_name ON rideshare.users USING btree (last_name); +CREATE UNIQUE INDEX index_solid_queue_semaphores_on_key ON rideshare.solid_queue_semaphores USING btree (key); + + +-- +-- Name: index_solid_queue_semaphores_on_key_and_value; Type: INDEX; Schema: rideshare; Owner: - +-- + +CREATE INDEX index_solid_queue_semaphores_on_key_and_value ON rideshare.solid_queue_semaphores USING btree (key, value); -- @@ -705,6 +1473,22 @@ CREATE INDEX index_vehicle_reservations_on_vehicle_id ON rideshare.vehicle_reser CREATE UNIQUE INDEX index_vehicles_on_name ON rideshare.vehicles USING btree (name); +-- +-- Name: solid_queue_recurring_executions fk_rails_318a5533ed; Type: FK CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_recurring_executions + ADD CONSTRAINT fk_rails_318a5533ed FOREIGN KEY (job_id) REFERENCES rideshare.solid_queue_jobs(id) ON DELETE CASCADE; + + +-- +-- Name: solid_queue_failed_executions fk_rails_39bbc7a631; Type: FK CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_failed_executions + ADD CONSTRAINT fk_rails_39bbc7a631 FOREIGN KEY (job_id) REFERENCES rideshare.solid_queue_jobs(id) ON DELETE CASCADE; + + -- -- Name: trip_requests fk_rails_3fdebbfaca; Type: FK CONSTRAINT; Schema: rideshare; Owner: - -- @@ -713,6 +1497,14 @@ ALTER TABLE ONLY rideshare.trip_requests ADD CONSTRAINT fk_rails_3fdebbfaca FOREIGN KEY (end_location_id) REFERENCES rideshare.locations(id); +-- +-- Name: solid_queue_blocked_executions fk_rails_4cd34e2228; Type: FK CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_blocked_executions + ADD CONSTRAINT fk_rails_4cd34e2228 FOREIGN KEY (job_id) REFERENCES rideshare.solid_queue_jobs(id) ON DELETE CASCADE; + + -- -- Name: vehicle_reservations fk_rails_59996232fc; Type: FK CONSTRAINT; Schema: rideshare; Owner: - -- @@ -737,6 +1529,14 @@ ALTER TABLE ONLY rideshare.vehicle_reservations ADD CONSTRAINT fk_rails_7edc8e666a FOREIGN KEY (vehicle_id) REFERENCES rideshare.vehicles(id); +-- +-- Name: solid_queue_ready_executions fk_rails_81fcbd66af; Type: FK CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_ready_executions + ADD CONSTRAINT fk_rails_81fcbd66af FOREIGN KEY (job_id) REFERENCES rideshare.solid_queue_jobs(id) ON DELETE CASCADE; + + -- -- Name: trip_positions fk_rails_9688ac8706; Type: FK CONSTRAINT; Schema: rideshare; Owner: - -- @@ -745,6 +1545,14 @@ ALTER TABLE ONLY rideshare.trip_positions ADD CONSTRAINT fk_rails_9688ac8706 FOREIGN KEY (trip_id) REFERENCES rideshare.trips(id); +-- +-- Name: solid_queue_claimed_executions fk_rails_9cfe4d4944; Type: FK CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_claimed_executions + ADD CONSTRAINT fk_rails_9cfe4d4944 FOREIGN KEY (job_id) REFERENCES rideshare.solid_queue_jobs(id) ON DELETE CASCADE; + + -- -- Name: trip_requests fk_rails_c17a139554; Type: FK CONSTRAINT; Schema: rideshare; Owner: - -- @@ -753,6 +1561,14 @@ ALTER TABLE ONLY rideshare.trip_requests ADD CONSTRAINT fk_rails_c17a139554 FOREIGN KEY (rider_id) REFERENCES rideshare.users(id); +-- +-- Name: solid_queue_scheduled_executions fk_rails_c4316f352d; Type: FK CONSTRAINT; Schema: rideshare; Owner: - +-- + +ALTER TABLE ONLY rideshare.solid_queue_scheduled_executions + ADD CONSTRAINT fk_rails_c4316f352d FOREIGN KEY (job_id) REFERENCES rideshare.solid_queue_jobs(id) ON DELETE CASCADE; + + -- -- Name: trips fk_rails_e7560abc33; Type: FK CONSTRAINT; Schema: rideshare; Owner: - -- @@ -776,6 +1592,8 @@ ALTER TABLE ONLY rideshare.trip_requests SET search_path TO rideshare; INSERT INTO "schema_migrations" (version) VALUES +('20240906033935'), +('20240905235053'), ('20231220043547'), ('20231218215836'), ('20231213045957'), diff --git a/erd.pdf b/erd.pdf index cceb3c0..2a54d7d 100644 Binary files a/erd.pdf and b/erd.pdf differ