Skip to content

Instantly share code, notes, and snippets.

@anulaibar
Last active October 11, 2018 18:50
Show Gist options
  • Save anulaibar/901920496365f5d30e6d4fe7c534f2c7 to your computer and use it in GitHub Desktop.
Save anulaibar/901920496365f5d30e6d4fe7c534f2c7 to your computer and use it in GitHub Desktop.
-- Avboka lägenheter
SELECT * FROM projects WHERE id = 7;
SELECT number, assigned_user_id, status FROM properties WHERE project_id = 7 ORDER BY id;
UPDATE properties SET assigned_user_id = null, status = 'AVAILABLE' WHERE project_id = 7;
-- Radera användare
SELECT id, queue_number, first_name, email FROM users WHERE project_id = 7;
DELETE FROM users WHERE project_id = 7;
UPDATE projects SET queue_counter = 0 WHERE id = 7;
-- Ställ in tider
SELECT * FROM projects WHERE id = 7;
UPDATE projects SET signup_open_at = '2018-10-11 09:00:00' WHERE id = 7;
UPDATE projects SET signup_close_at = '2018-10-11 12:00:00' WHERE id = 7;
@anulaibar
Copy link
Author

anulaibar commented Oct 11, 2018

DELETE FROM users WHERE project_id = 7;
ERROR:  update or delete on table "users" violates foreign key constraint "user_interests_user_id_fkey" on table "user_interests"
DETAIL:  Key (id)=(155) is still referenced from table "user_interests".

delete from user_interests where user_id in ( 155, 152, 153, 156, 151, 157, 154, 158);

@anulaibar
Copy link
Author

heroku ps:scale -a boka-objekt
heroku ps:scale web=2:standard-1x -a boka-objekt

@anulaibar
Copy link
Author

heroku ps:scale web=1:hobby -a boka-objekt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment