Matthias Orgler

Joined

720 Experience
6 Lessons Completed
0 Questions Solved

Activity

Ha, never mind. I had an older version of the schema on heroku, which made it incompatible with the schema on hatchbox.

I had to first deploy the latest version (including the latest migrations) to heroku before capturing the DB backup. After that I had no problems importing the data into hatchbox.

Hier is the full dump btw. It contains a bunch of errors, even though I completely dropped and re-created the empty DB.

pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 3091; 1259 9316695 INDEX unique_schema_migrations ndxchfocnrvjdp
pg_restore: error: could not execute query: ERROR:  index "unique_schema_migrations" does not exist
Command was: DROP INDEX "public"."unique_schema_migrations";
pg_restore: from TOC entry 3108; 2606 9316673 CONSTRAINT users users_pkey ndxchfocnrvjdp
pg_restore: error: could not execute query: ERROR:  cannot drop constraint users_pkey on table public.users because other objects depend on it
DETAIL:  constraint fk_rails_330c32d8d9 on table public.oauth_access_grants depends on index public.users_pkey
constraint fk_rails_ee63f25419 on table public.oauth_access_tokens depends on index public.users_pkey
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
Command was: ALTER TABLE ONLY "public"."users" DROP CONSTRAINT "users_pkey";
pg_restore: from TOC entry 214; 1259 9316599 TABLE users ndxchfocnrvjdp
pg_restore: error: could not execute query: ERROR:  cannot drop table public.users because other objects depend on it
DETAIL:  constraint fk_rails_330c32d8d9 on table public.oauth_access_grants depends on table public.users
constraint fk_rails_ee63f25419 on table public.oauth_access_tokens depends on table public.users
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
Command was: DROP TABLE "public"."users";
pg_restore: from TOC entry 6; 2615 9316488 SCHEMA public ndxchfocnrvjdp
pg_restore: error: could not execute query: ERROR:  cannot drop schema public because other objects depend on it
DETAIL:  table public.flipper_features depends on schema public
table public.flipper_gates depends on schema public
table public.gig_payments depends on schema public
table public.oauth_access_grants depends on schema public
table public.oauth_access_tokens depends on schema public
table public.oauth_applications depends on schema public
table public.users depends on schema public
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
Command was: DROP SCHEMA "public";
pg_restore: error: could not execute query: ERROR:  schema "public" already exists
Command was: CREATE SCHEMA public;


pg_restore: from TOC entry 214; 1259 9316599 TABLE users ndxchfocnrvjdp
pg_restore: error: could not execute query: ERROR:  relation "users" already exists
Command was: CREATE TABLE "public"."users" (
    "id" integer NOT NULL,
    "email" character varying(255) DEFAULT ''::character varying NOT NULL,
    "encrypted_password" character varying DEFAULT ''::character varying NOT NULL,
    "reset_password_token" character varying(255),
    "reset_password_sent_at" timestamp without time zone,
    "remember_created_at" timestamp without time zone,
    "sign_in_count" integer DEFAULT 0 NOT NULL,
    "current_sign_in_at" timestamp without time zone,
    "last_sign_in_at" timestamp without time zone,
    "current_sign_in_ip" character varying(255),
    "last_sign_in_ip" character varying(255),
    "created_at" timestamp without time zone NOT NULL,
    "updated_at" timestamp without time zone NOT NULL,
    "name" character varying(255),
    "roles_mask" integer,
    "mobile" character varying(255),
    "invitation_token" character varying(255),
    "invitation_sent_at" timestamp without time zone,
    "invitation_accepted_at" timestamp without time zone,
    "invitation_limit" integer,
    "invited_by_id" integer,
    "invited_by_type" character varying(255),
    "invitation_created_at" timestamp without time zone,
    "provider" character varying DEFAULT 'email'::character varying NOT NULL,
    "uid" character varying DEFAULT ''::character varying NOT NULL,
    "oauth_token" character varying(255),
    "oauth_expires_at" timestamp without time zone,
    "image_uid" character varying(255),
    "is_backoffice_admin" boolean,
    "locale" character varying(255),
    "icalendar_token" character varying(255),
    "invited_to_band_id" integer,
    "last_ical_access_at" timestamp without time zone,
    "receive_create_notification_emails" boolean DEFAULT true,
    "receive_update_notification_emails" boolean DEFAULT true,
    "receive_attendance_state_change_emails" boolean DEFAULT true,
    "receive_attendance_initial_reaction_email" boolean DEFAULT false,
    "confirmation_token" character varying,
    "confirmed_at" timestamp without time zone,
    "confirmation_sent_at" timestamp without time zone,
    "unconfirmed_email" character varying,
    "tokens" "jsonb",
    "tos_agreement" boolean,
    "tos_accepted_at" timestamp without time zone,
    "default_band_id" integer
);


pg_restore: from TOC entry 3275; 0 9316599 TABLE DATA users ndxchfocnrvjdp
pg_restore: error: could not execute query: ERROR:  column "provider" of relation "users" does not exist
Command was: COPY "public"."users" ("id", "email", "encrypted_password", "reset_password_token", "reset_password_sent_at", "remember_created_at", "sign_in_count", "current_sign_in_at", "last_sign_in_at", "current_sign_in_ip", "last_sign_in_ip", "created_at", "updated_at", "name", "roles_mask", "mobile", "invitation_token", "invitation_sent_at", "invitation_accepted_at", "invitation_limit", "invited_by_id", "invited_by_type", "invitation_created_at", "provider", "uid", "oauth_token", "oauth_expires_at", "image_uid", "is_backoffice_admin", "locale", "icalendar_token", "invited_to_band_id", "last_ical_access_at", "receive_create_notification_emails", "receive_update_notification_emails", "receive_attendance_state_change_emails", "receive_attendance_initial_reaction_email", "confirmation_token", "confirmed_at", "confirmation_sent_at", "unconfirmed_email", "tokens", "tos_agreement", "tos_accepted_at", "default_band_id") FROM stdin;
pg_restore: from TOC entry 3108; 2606 9316673 CONSTRAINT users users_pkey ndxchfocnrvjdp
pg_restore: error: could not execute query: ERROR:  multiple primary keys for table "users" are not allowed
Command was: ALTER TABLE ONLY "public"."users"
    ADD CONSTRAINT "users_pkey" PRIMARY KEY ("id");


pg_restore: from TOC entry 3128; 2606 9316706 FK CONSTRAINT subscriptions fk_rails_933bdff476 ndxchfocnrvjdp
pg_restore: error: could not execute query: ERROR:  insert or update on table "subscriptions" violates foreign key constraint "fk_rails_933bdff476"
DETAIL:  Key (user_id)=(843) is not present in table "users".
Command was: ALTER TABLE ONLY "public"."subscriptions"
    ADD CONSTRAINT "fk_rails_933bdff476" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id");


pg_restore: warning: errors ignored on restore: 9

Posted in How to Migrate from Heroku to Hatchbox.io Discussion

I always get the error pg_restore: error: could not execute query: ERROR: cannot drop schema public because other objects depend on it. It happens even if I clear all data from my hatchbox DB (using db:schema:load). This "public" schema is nothing I set up, but it seems to be a default thing from PG in the "postgres" and "template1" databases (both were automatically created). How do I get around this error?

Posted in How to debounce ActiveJobs?

How can I debounce jobs in ActiveJob?

Why I need this:
Events in my Rails app can trigger the same job independently from multiple places. But I want this job to run only once – only running the last job scheduled. I want to cancel all earlier jobs to save resources. Here is an example:

Job 1: Re-render file x
Job 2: Re-render file x
Job 3: Re-render file x
=> cancel job 1+2, only execute job 3

What I found:
Found https://medium.com/amco/sidekiq-tricks-dont-do-the-same-work-twice-378d4ee4c2d8, which implements this for Sidekiq. But I can't figure out how to do it in ActiveJob directly.

Is there a way to debounce jobs in ActiveJob?

Posted in Webpacker error from Vue.js Trello Clone Series

Ok, my mistake was, that I used webpack version 4, which is not compatible with the latest release of the webpacker gem. Downgrading webpack to version 3 solved the problem – now assets are compiled.

Posted in Webpacker error from Vue.js Trello Clone Series

I get a similar error with my own Rails 5.2/VueJS application when deploying to heroku. The application runs fine without errors locally, so I don't think a typo in my JS code could be the reason. The manifest.json file is created fine, but other than that, my public/packs folder remains empty. Any hints as to in which file I made have a typo to cause this error?

Posted in Building a Trello Clone with VueJS and Rails

Same error for me. Any solutions?
Thanks! Now I finally know where these weird occasional database connection errors came from on heroku ;). I had a fixed value for pool size in my database.yml, while using multiple threads in my puma config.
logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.