Skip to content

Instantly share code, notes, and snippets.

@slavpetroff
Created January 24, 2018 18:54
Show Gist options
  • Save slavpetroff/3137dd15cb307f04de9eef5e667db530 to your computer and use it in GitHub Desktop.
Save slavpetroff/3137dd15cb307f04de9eef5e667db530 to your computer and use it in GitHub Desktop.
SELECT "api_user"."id", "api_user"."password", "api_user"."last_login", "api_user"."is_superuser", "api_user"."polymorphic_ctype_id", "api_user"."nickname", "api_user"."first_name", "api_user"."last_name", "api_user"."birth_date", "api_user"."phone_no", "api_user"."email", "api_user"."language", "api_user"."city", "api_user"."region", "api_user"."country", "api_user"."identification_number", "api_user"."profile_image_url", "api_user"."push_enabled", "api_user"."timezone", "api_user"."is_staff", "api_user"."pin_code", "api_user"."created_at", "api_user"."updated_at", "api_user"."attributes", "api_child"."user_ptr_id", "api_child"."setup_completed", "api_child"."currency_id", "api_child"."assignment_approved_counter", "api_child"."assignment_auto_approve_enabled", "api_currency"."id", "api_currency"."iso_4217_name", "api_currency"."name", "payments_trustlyaccount"."user_id", "payments_trustlyaccount"."account_id", "payments_trustlyaccount"."descriptor", "payments_trustlyaccount"."clearing_house", "payments_trustlyaccount"."last_digits", "payments_trustlyaccount"."bank", "payments_trustlyaccount"."verified", "payments_trustlyaccount"."direct_debit_mandate", "payments_trustlyaccount"."created_at", "payments_trustlyaccount"."updated_at", "api_authtoken"."token", "api_authtoken"."timestamp", "api_authtoken"."user_id", "api_score"."id", "api_score"."user_id", "api_score"."score", "api_score"."updated_at", "api_allowance"."id", "api_allowance"."allowance_type", "api_allowance"."parent_id", "api_allowance"."child_id", "api_allowance"."amount", "api_allowance"."frequency", "api_allowance"."day", "api_allowance"."last_payout_period", "api_allowance"."last_refill_period", "api_allowance"."enable_auto_transfer", "api_allowance"."created_at", "api_allowance"."updated_at", "stats_goalranking"."id", "stats_goalranking"."child_id", "stats_goalranking"."total_amount", "stats_goalranking"."total_goals", "stats_goalranking"."rank", "stats_goalranking"."percentage", "stats_childstatistics"."id", "stats_childstatistics"."child_id", "stats_childstatistics"."all_time_approved_assignments", "stats_childstatistics"."all_time_total_assignments", "stats_childstatistics"."all_time_potential_reward", "stats_childstatistics"."all_time_assignment_completion_ratio", "stats_childstatistics"."all_time_received_reward", "stats_childstatistics"."active_assignments", "stats_childstatistics"."weekly_approved_assignments", "stats_childstatistics"."weekly_total_assignments", "stats_childstatistics"."weekly_potential_reward", "stats_childstatistics"."weekly_assignment_completion_ratio","stats_childstatistics"."weekly_received_reward", "stats_childstatistics"."yearly_assignment_completion_ratio", "stats_childstatistics"."monthly_approved_assignments", "stats_childstatistics"."monthly_total_assignments", "stats_childstatistics"."monthly_potential_reward", "stats_childstatistics"."monthly_assignment_completion_ratio", "stats_childstatistics"."monthly_received_reward", "stats_childstatistics"."total_allowance", "stats_childstatistics"."total_reward", "stats_childstatistics"."total_savings", "stats_childstatistics"."total_interest", "stats_childstatistics"."total_transactions", "stats_childstatistics"."yearly_savings_withdrawals", "stats_childstatistics"."highest_goal", "stats_childstatistics"."highest_completed_goal", "stats_childstatistics"."total_goals", "stats_childstatistics"."total_completed_goals", "stats_childstatistics"."assignment_reward_to_savings", "stats_childstatistics"."assignment_reward_to_transactional", "stats_childstatistics"."interest", "stats_childstatistics"."previous_period_savings", "stats_childstatistics"."previous_period_transactional", "stats_childstatistics"."transactional_to_savings", "stats_childstatistics"."savings_to_transactional", "stats_childstatistics"."auto_saved", "stats_childstatistics"."savings_balance", "stats_childstatistics"."transactional_balance", "stats_childstatistics"."transactional_withdrawals", "stats_childstatistics"."savings_withdrawals", "stats_childstatistics"."savings_insertions", "stats_childstatistics"."total_period_transactions", "stats_childstatistics"."total_change_transactional_balance", "stats_childstatistics"."total_change_savings_balance" FROM "api_child" INNER JOIN "api_user" ON ("api_child"."user_ptr_id" = "api_user"."id") INNER JOIN "api_currency" ON ("api_child"."currency_id" = "api_currency"."id") LEFT OUTER JOIN "payments_trustlyaccount" ON ("api_user"."id"= "payments_trustlyaccount"."user_id") LEFT OUTER JOIN "api_authtoken" ON ("api_user"."id" = "api_authtoken"."user_id") LEFT OUTER JOIN "api_score" ON ("api_user"."id" = "api_score"."user_id") LEFT OUTER JOIN "api_allowance" ON ("api_child"."user_ptr_id" = "api_allowance"."child_id") LEFT OUTER JOIN "stats_goalranking" ON ("api_child"."user_ptr_id" = "stats_goalranking"."child_id") LEFT OUTER JOIN "stats_childstatistics" ON ("api_child"."user_ptr_id" = "stats_childstatistics"."child_id") WHERE "api_child"."user_ptr_id" = 2
SELECT "api_account"."id", "api_account"."owner_id", "api_account"."account_type", "api_account"."balance", "api_account"."interest_rate", "api_account"."attributes", "api_account"."previous_balances", "api_account"."last_interest_payout_period", "api_account"."created_at", "api_account"."updated_at" FROM "api_account" WHERE "api_account"."owner_id" IN (2) ORDER BY "api_account"."created_at" DESC
SELECT "api_parentchildrelation"."id", "api_parentchildrelation"."child_id", "api_parentchildrelation"."parent_id", "api_parentchildrelation"."debt_account_id", "api_parentchildrelation"."allowance_amount", "api_user"."id", "api_user"."password", "api_user"."last_login", "api_user"."is_superuser", "api_user"."polymorphic_ctype_id", "api_user"."nickname", "api_user"."first_name", "api_user"."last_name", "api_user"."birth_date", "api_user"."phone_no", "api_user"."email", "api_user"."language", "api_user"."city", "api_user"."region", "api_user"."country", "api_user"."identification_number", "api_user"."profile_image_url", "api_user"."push_enabled", "api_user"."timezone", "api_user"."is_staff", "api_user"."pin_code", "api_user"."created_at", "api_user"."updated_at", "api_user"."attributes", "api_parent"."user_ptr_id", "api_parent"."default_currency_id", "api_currency"."id", "api_currency"."iso_4217_name", "api_currency"."name", "payments_trustlyaccount"."user_id", "payments_trustlyaccount"."account_id", "payments_trustlyaccount"."descriptor", "payments_trustlyaccount"."clearing_house", "payments_trustlyaccount"."last_digits", "payments_trustlyaccount"."bank", "payments_trustlyaccount"."verified", "payments_trustlyaccount"."direct_debit_mandate", "payments_trustlyaccount"."created_at", "payments_trustlyaccount"."updated_at", "api_score"."id", "api_score"."user_id", "api_score"."score", "api_score"."updated_at", "api_account"."id", "api_account"."owner_id", "api_account"."account_type", "api_account"."balance", "api_account"."interest_rate", "api_account"."attributes", "api_account"."previous_balances", "api_account"."last_interest_payout_period", "api_account"."created_at", "api_account"."updated_at" FROM "api_parentchildrelation" INNER JOIN "api_parent" ON ("api_parentchildrelation"."parent_id" = "api_parent"."user_ptr_id") INNER JOIN "api_user" ON ("api_parent"."user_ptr_id" = "api_user"."id") INNER JOIN "api_currency" ON ("api_parent"."default_currency_id" = "api_currency"."id") LEFT OUTER JOIN "payments_trustlyaccount" ON ("api_user"."id" = "payments_trustlyaccount"."user_id") LEFT OUTER JOIN "api_score" ON ("api_user"."id" = "api_score"."user_id") INNER JOIN "api_account" ON ("api_parentchildrelation"."debt_account_id" = "api_account"."id") WHERE "api_parentchildrelation"."child_id" IN (2)
UPDATE "api_user" SET "password" = '', "last_login" = '2018-01-24T18:54:05.009123+00:00'::timestamptz, "is_superuser" = false, "polymorphic_ctype_id" = 21, "nickname" = 'child-0', "first_name" = NULL, "last_name" = NULL, "birth_date" = '2006-03-21'::date, "phone_no" = '+46882444754', "email" = '[email protected]', "language" = 'sv', "city" = NULL, "region" = NULL, "country" = 'SE', "identification_number" = NULL, "profile_image_url" = NULL, "push_enabled" = true, "timezone" = 'UTC', "is_staff" = false, "pin_code" = NULL, "created_at" = '2018-01-24T18:54:00.874769+00:00'::timestamptz, "updated_at" = '2018-01-24T18:54:05.009283+00:00'::timestamptz, "attributes" = '{}' WHERE "api_user"."id" = 2
UPDATE "api_child" SET "setup_completed" = NULL, "currency_id" = 121, "assignment_approved_counter" = 0, "assignment_auto_approve_enabled" = false WHERE "api_child"."user_ptr_id" = 2
SELECT "stats_parentstatistics"."id", "stats_parentstatistics"."parent_id", "stats_parentstatistics"."yearly_savings_withdrawals" FROM "stats_parentstatistics" WHERE "stats_parentstatistics"."parent_id" = 42
SELECT "api_parentchildrelation"."id", "api_parentchildrelation"."child_id", "api_parentchildrelation"."parent_id", "api_parentchildrelation"."debt_account_id", "api_parentchildrelation"."allowance_amount" FROM "api_parentchildrelation" WHERE "api_parentchildrelation"."debt_account_id" = 78
SELECT "api_goal"."id", "api_goal"."title", "api_goal"."description", "api_goal"."starting_amount", "api_goal"."amount", "api_goal"."sponsored_amount", "api_goal"."milestone_boost_amount", "api_goal"."status", "api_goal"."photo_url", "api_goal"."category_id", "api_goal"."is_active", "api_goal"."is_purchased", "api_goal"."child_id", "api_goal"."template_id", "api_goal"."created_by_id", "api_goal"."created_at", "api_goal"."updated_by_id", "api_goal"."updated_at", "api_goal"."attributes", "api_goal"."completed_at", "api_goal"."display_order" FROM "api_goal" WHERE ("api_goal"."child_id" = 2 AND "api_goal"."status" = 1) ORDER BY "api_goal"."is_active" DESC, "api_goal"."created_at" DESC LIMIT 20
SELECT DISTINCT "api_task"."id", "api_task"."recurring_days", "api_task"."attributes", "api_task"."task_type", "api_task"."title", "api_task"."description", "api_task"."requires_photo", "api_task"."value", "api_task"."is_shared", "api_task"."is_enabled", "api_task"."is_auto_approved", "api_task"."category_id", "api_task"."template_id", "api_task"."created_by_id", "api_task"."previous_task_id", "api_task"."created_at", "api_task"."updated_at", "api_task"."expires_at" FROM "api_task" INNER JOIN "api_assignment" ON ("api_task"."id" = "api_assignment"."task_id") WHERE ("api_assignment"."child_id" = 2 AND "api_assignment"."is_active" = true) ORDER BY "api_task"."created_at" DESC LIMIT 20
SELECT "api_assignment"."id", "api_assignment"."task_id", "api_assignment"."child_id", "api_assignment"."status", "api_assignment"."photo_url","api_assignment"."attributes", "api_assignment"."is_active", "api_assignment"."started_at", "api_assignment"."completed_at", "api_assignment"."approved_at", "api_assignment"."approved_by_id", "api_assignment"."duration", "api_assignment"."created_at", "api_assignment"."updated_at" FROM "api_assignment" WHERE "api_assignment"."task_id" IN (2) ORDER BY "api_assignment"."created_at" DESC
SELECT "api_user"."id", "api_user"."password", "api_user"."last_login", "api_user"."is_superuser", "api_user"."polymorphic_ctype_id", "api_user"."nickname", "api_user"."first_name", "api_user"."last_name", "api_user"."birth_date", "api_user"."phone_no", "api_user"."email", "api_user"."language", "api_user"."city", "api_user"."region", "api_user"."country", "api_user"."identification_number", "api_user"."profile_image_url", "api_user"."push_enabled", "api_user"."timezone", "api_user"."is_staff", "api_user"."pin_code", "api_user"."created_at", "api_user"."updated_at", "api_user"."attributes", "api_child"."user_ptr_id", "api_child"."setup_completed", "api_child"."currency_id", "api_child"."assignment_approved_counter", "api_child"."assignment_auto_approve_enabled" FROM "api_child" INNER JOIN "api_user" ON ("api_child"."user_ptr_id" = "api_user"."id") WHERE "api_child"."user_ptr_id" IN (2) ORDER BY "api_user"."created_at" DESC
SELECT ("api_task_owners"."task_id") AS "_prefetch_related_val_task_id", "api_user"."id", "api_user"."password", "api_user"."last_login", "api_user"."is_superuser", "api_user"."polymorphic_ctype_id", "api_user"."nickname", "api_user"."first_name", "api_user"."last_name", "api_user"."birth_date", "api_user"."phone_no", "api_user"."email", "api_user"."language", "api_user"."city", "api_user"."region", "api_user"."country", "api_user"."identification_number", "api_user"."profile_image_url", "api_user"."push_enabled", "api_user"."timezone", "api_user"."is_staff", "api_user"."pin_code", "api_user"."created_at", "api_user"."updated_at", "api_user"."attributes", "api_parent"."user_ptr_id", "api_parent"."default_currency_id" FROM "api_parent" INNER JOIN "api_task_owners" ON ("api_parent"."user_ptr_id" = "api_task_owners"."parent_id") INNER JOIN "api_user" ON ("api_parent"."user_ptr_id" = "api_user"."id") WHERE "api_task_owners"."task_id" IN (2) ORDER BY "api_user"."created_at" DESC
SELECT "api_event"."id", "api_event"."user_id", "api_event"."title", "api_event"."text", "api_event"."content_type_id", "api_event"."object_id", "api_event"."action", "api_event"."performed_by_id", "api_event"."created_at", "api_event"."attributes", T3."id", T3."password", T3."last_login", T3."is_superuser", T3."polymorphic_ctype_id", T3."nickname", T3."first_name", T3."last_name", T3."birth_date", T3."phone_no", T3."email", T3."language", T3."city", T3."region", T3."country", T3."identification_number", T3."profile_image_url", T3."push_enabled", T3."timezone", T3."is_staff", T3."pin_code", T3."created_at", T3."updated_at", T3."attributes" FROM "api_event" LEFT OUTER JOIN "api_user" T3 ON ("api_event"."performed_by_id" = T3."id") WHERE "api_event"."user_id" = 2 ORDER BY "api_event"."created_at" DESC LIMIT 10
SELECT "api_goal"."id", "api_goal"."title", "api_goal"."description", "api_goal"."starting_amount", "api_goal"."amount", "api_goal"."sponsored_amount", "api_goal"."milestone_boost_amount", "api_goal"."status", "api_goal"."photo_url", "api_goal"."category_id", "api_goal"."is_active", "api_goal"."is_purchased", "api_goal"."child_id", "api_goal"."template_id", "api_goal"."created_by_id", "api_goal"."created_at", "api_goal"."updated_by_id", "api_goal"."updated_at", "api_goal"."attributes", "api_goal"."completed_at", "api_goal"."display_order" FROM "api_goal" WHERE "api_goal"."id" IN (3, 4) ORDER BY "api_goal"."is_active" DESC, "api_goal"."display_order" ASC, "api_goal"."created_at" DESC
SELECT "api_transaction"."id", "api_transaction"."transaction_type", "api_transaction"."group_id", "api_transaction"."category_id", "api_transaction"."state", "api_transaction"."source_account_id", "api_transaction"."target_account_id", "api_transaction"."child_id", "api_transaction"."token_id", "api_transaction"."amount", "api_transaction"."currency_id", "api_transaction"."related_allowance_id", "api_transaction"."related_assignment_id", "api_transaction"."created_by_id", "api_transaction"."created_at", "api_transaction"."updated_at", "api_transaction"."charged_at", "api_transaction"."attributes", "api_transaction"."retry_count", "api_user"."id", "api_user"."password", "api_user"."last_login", "api_user"."is_superuser", "api_user"."polymorphic_ctype_id", "api_user"."nickname", "api_user"."first_name", "api_user"."last_name", "api_user"."birth_date", "api_user"."phone_no", "api_user"."email", "api_user"."language", "api_user"."city", "api_user"."region", "api_user"."country", "api_user"."identification_number", "api_user"."profile_image_url", "api_user"."push_enabled", "api_user"."timezone", "api_user"."is_staff", "api_user"."pin_code", "api_user"."created_at", "api_user"."updated_at", "api_user"."attributes", "api_child"."user_ptr_id", "api_child"."setup_completed", "api_child"."currency_id", "api_child"."assignment_approved_counter", "api_child"."assignment_auto_approve_enabled", "payments_trustlyaccount"."user_id", "payments_trustlyaccount"."account_id", "payments_trustlyaccount"."descriptor", "payments_trustlyaccount"."clearing_house", "payments_trustlyaccount"."last_digits", "payments_trustlyaccount"."bank", "payments_trustlyaccount"."verified", "payments_trustlyaccount"."direct_debit_mandate", "payments_trustlyaccount"."created_at", "payments_trustlyaccount"."updated_at", "api_currency"."id", "api_currency"."iso_4217_name", "api_currency"."name", "api_allowance"."id", "api_allowance"."allowance_type", "api_allowance"."parent_id", "api_allowance"."child_id", "api_allowance"."amount", "api_allowance"."frequency", "api_allowance"."day", "api_allowance"."last_payout_period", "api_allowance"."last_refill_period", "api_allowance"."enable_auto_transfer", "api_allowance"."created_at", "api_allowance"."updated_at", "api_assignment"."id", "api_assignment"."task_id", "api_assignment"."child_id", "api_assignment"."status", "api_assignment"."photo_url", "api_assignment"."attributes", "api_assignment"."is_active", "api_assignment"."started_at", "api_assignment"."completed_at", "api_assignment"."approved_at", "api_assignment"."approved_by_id", "api_assignment"."duration", "api_assignment"."created_at", "api_assignment"."updated_at", "api_task"."id", "api_task"."recurring_days", "api_task"."attributes", "api_task"."task_type", "api_task"."title", "api_task"."description", "api_task"."requires_photo", "api_task"."value", "api_task"."is_shared", "api_task"."is_enabled", "api_task"."is_auto_approved", "api_task"."category_id", "api_task"."template_id", "api_task"."created_by_id", "api_task"."previous_task_id", "api_task"."created_at", "api_task"."updated_at", "api_task"."expires_at", T9."id", T9."password", T9."last_login", T9."is_superuser", T9."polymorphic_ctype_id", T9."nickname", T9."first_name", T9."last_name", T9."birth_date", T9."phone_no", T9."email", T9."language", T9."city", T9."region", T9."country", T9."identification_number", T9."profile_image_url", T9."push_enabled", T9."timezone", T9."is_staff", T9."pin_code", T9."created_at", T9."updated_at", T9."attributes", T10."user_id", T10."account_id", T10."descriptor", T10."clearing_house",T10."last_digits", T10."bank", T10."verified", T10."direct_debit_mandate", T10."created_at", T10."updated_at" FROM "api_transaction" LEFT OUTERJOIN "api_child" ON ("api_transaction"."child_id" = "api_child"."user_ptr_id") LEFT OUTER JOIN "api_user" ON ("api_child"."user_ptr_id" = "api_user"."id") LEFT OUTER JOIN "payments_trustlyaccount" ON ("api_user"."id" = "payments_trustlyaccount"."user_id") INNER JOIN "api_currency" ON ("api_transaction"."currency_id" = "api_currency"."id") LEFT OUTER JOIN "api_allowance" ON ("api_transaction"."related_allowance_id" = "api_allowance"."id") LEFT OUTER JOIN "api_assignment" ON ("api_transaction"."related_assignment_id" = "api_assignment"."id") LEFT OUTER JOIN "api_task" ON("api_assignment"."task_id" = "api_task"."id") LEFT OUTER JOIN "api_user" T9 ON ("api_transaction"."created_by_id" = T9."id") LEFT OUTER JOIN "payments_trustlyaccount" T10 ON (T9."id" = T10."user_id") WHERE "api_transaction"."id" IN (2) ORDER BY "api_transaction"."created_at" DESC
SELECT "api_wish"."id", "api_wish"."photo_url", "api_wish"."title", "api_wish"."description", "api_wish"."link", "api_wish"."store", "api_wish"."is_purchased", "api_wish"."display_order", "api_wish"."price", "api_wish"."child_id", "api_wish"."updated_by_id", "api_wish"."created_at", "api_wish"."updated_at" FROM "api_wish" WHERE "api_wish"."id" = 3
SELECT "api_wish"."id", "api_wish"."photo_url", "api_wish"."title", "api_wish"."description", "api_wish"."link", "api_wish"."store", "api_wish"."is_purchased", "api_wish"."display_order", "api_wish"."price", "api_wish"."child_id", "api_wish"."updated_by_id", "api_wish"."created_at", "api_wish"."updated_at" FROM "api_wish" WHERE "api_wish"."child_id" = 2 ORDER BY "api_wish"."display_order" ASC, "api_wish"."created_at" DESC LIMIT10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment