Skip to content

Instantly share code, notes, and snippets.

@ramontayag
Created March 7, 2017 02:28
Show Gist options
  • Save ramontayag/2efaba810f1ccfd0815ff5b0bd201ec9 to your computer and use it in GitHub Desktop.
Save ramontayag/2efaba810f1ccfd0815ff5b0bd201ec9 to your computer and use it in GitHub Desktop.
postgres=# \d+ operations
Table "public.operations"
Column | Type | Modifiers | Storage | Stats target | Description
-----------------+-----------------------------+---------------------------------------------------------+----------+--------------+-------------
id | integer | not null default nextval('operations_id_seq'::regclass) | plain | |
external_id | character varying | not null | extended | |
ledger_sequence | integer | not null | plain | |
body | jsonb | not null default '"{}"'::jsonb | extended | |
created_at | timestamp without time zone | not null | plain | |
updated_at | timestamp without time zone | not null | plain | |
Indexes:
"operations_pkey" PRIMARY KEY, btree (id)
"index_operations_on_external_id" UNIQUE, btree (external_id)
Referenced by:
TABLE "reports" CONSTRAINT "fk_rails_07d9ddd11f" FOREIGN KEY (operation_id) REFERENCES operations(id)
postgres=# select * from operations where body ->> 'id' = '12884905987';
id | external_id | ledger_sequence | body | created_at | updated_at
----+-------------+-----------------+------+------------+------------
(0 rows)
postgres=# select * from operations;
id | external_id | ledger_sequence | body
----+-------------+-----------------+-----------------------------------------------------------------------------------------------------------------------------------------------
1 | 12884905985 | 3 | "{\"id\":\"12884905985\",\"paging_token\":\"12884905985\", ...removed for brevity
2 | 12884905986 | 3 | "{\"id\":\"12884905986\",\"paging_token\":\"12884905986\", ...removed for brevity
3 | 12884905987 | 3 | "{\"id\":\"12884905987\",\"paging_token\":\"12884905987\", ...removed for brevity
(3 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment