studentenportal / deploy

:ship: The studentenportal.ch deployment
https://studentenportal.ch
0 stars 0 forks source link

Datenmigration #18

Closed The-Compiler closed 4 years ago

The-Compiler commented 4 years ago

Ich werde hier mal dokumentieren, wie ich bei der Migration der Daten vorgehe. Bei einem ersten (quick & dirty)-Test gab's leider schon mal einige Probleme. Ich versuche das jetzt noch ein zweites Mal etwas geordneter.

Bisher gehe ich so vor:

Daten umziehen

Datenbank wiederherstellen

The-Compiler commented 4 years ago

Dump laden

Mittels psql -U studentenportal studentenportal < studentenportal.pgsql

Dabei gibt's einige Fehler ``` SET SET SET SET SET SET SET ERROR: relation "public.front_user_user_permissions" does not exist ERROR: relation "public.registration_registrationprofile" does not exist ERROR: relation "public.documents_documentrating" does not exist ERROR: relation "public.front_user_groups" does not exist ERROR: relation "public.lecturers_quotevote" does not exist ERROR: relation "public.lecturers_lecturerrating" does not exist ERROR: relation "public.django_admin_log" does not exist ERROR: relation "public.documents_document" does not exist ERROR: relation "public.easy_thumbnails_thumbnail" does not exist ERROR: relation "public.lecturers_quotevote" does not exist ERROR: relation "public.front_user_user_permissions" does not exist ERROR: relation "public.oauth2_refreshtoken" does not exist ERROR: relation "public.oauth2_refreshtoken" does not exist ERROR: relation "public.oauth2_refreshtoken" does not exist ERROR: relation "public.oauth2_grant" does not exist ERROR: relation "public.oauth2_grant" does not exist ERROR: relation "public.oauth2_client" does not exist ERROR: relation "public.oauth2_accesstoken" does not exist ERROR: relation "public.oauth2_accesstoken" does not exist ERROR: relation "public.documents_documentcategory_lecturers" does not exist ERROR: relation "public.front_user_groups" does not exist ERROR: relation "public.auth_group_permissions" does not exist ERROR: relation "public.documents_documentrating" does not exist ERROR: relation "public.documents_documentcategory_courses" does not exist ERROR: relation "public.documents_documentcategory_lecturers" does not exist ERROR: relation "public.documents_documentdownload" does not exist ERROR: relation "public.django_admin_log" does not exist ERROR: relation "public.documents_documentcategory_courses" does not exist ERROR: relation "public.auth_permission" does not exist ERROR: relation "public.documents_document" does not exist ERROR: relation "public.events_event" does not exist ERROR: relation "public.lecturers_quote" does not exist ERROR: relation "public.auth_user_user_permissions" does not exist ERROR: relation "public.auth_user_groups" does not exist ERROR: relation "public.auth_group_permissions" does not exist ERROR: index "oauth2_refreshtoken_user_id" does not exist ERROR: index "oauth2_refreshtoken_client_id" does not exist ERROR: index "oauth2_grant_user_id" does not exist ERROR: index "oauth2_grant_client_id" does not exist ERROR: index "oauth2_client_user_id" does not exist ERROR: index "oauth2_accesstoken_user_id" does not exist ERROR: index "oauth2_accesstoken_client_id" does not exist ERROR: index "lecturers_quotevote_user_id" does not exist ERROR: index "lecturers_quotevote_quote_id" does not exist ERROR: index "lecturers_quote_lecturer_id" does not exist ERROR: index "lecturers_quote_author_id" does not exist ERROR: index "lecturers_lecturerrating_user_id" does not exist ERROR: index "lecturers_lecturerrating_rating" does not exist ERROR: index "lecturers_lecturerrating_lecturer_id" does not exist ERROR: index "lecturers_lecturerrating_category_like" does not exist ERROR: index "lecturers_lecturerrating_category" does not exist ERROR: index "lecturers_course_abbreviation_like" does not exist ERROR: index "front_user_username_like" does not exist ERROR: index "front_user_user_permissions_user_id" does not exist ERROR: index "front_user_user_permissions_permission_id" does not exist ERROR: index "front_user_groups_user_id" does not exist ERROR: index "front_user_groups_group_id" does not exist ERROR: index "events_event_author_id" does not exist ERROR: index "easy_thumbnails_thumbnail_storage_hash" does not exist ERROR: index "easy_thumbnails_thumbnail_source_id" does not exist ERROR: index "easy_thumbnails_thumbnail_name" does not exist ERROR: index "easy_thumbnails_source_storage_hash" does not exist ERROR: index "easy_thumbnails_source_name" does not exist ERROR: index "documents_documentrating_user_id" does not exist ERROR: index "documents_documentrating_document_id" does not exist ERROR: index "documents_documentdownload_ip" does not exist ERROR: index "documents_documentdownload_document_id" does not exist ERROR: index "documents_documentcategory_name" does not exist ERROR: index "documents_documentcategory_lecturers_lecturer_id" does not exist ERROR: index "documents_documentcategory_lecturers_documentcategory_id" does not exist ERROR: index "documents_documentcategory_courses_documentcategory_id" does not exist ERROR: index "documents_documentcategory_courses_course_id" does not exist ERROR: index "documents_document_uploader_id" does not exist ERROR: index "documents_document_category_id" does not exist ERROR: index "django_session_expire_date" does not exist ERROR: index "django_admin_log_user_id" does not exist ERROR: index "django_admin_log_content_type_id" does not exist ERROR: index "auth_user_user_permissions_user_id" does not exist ERROR: index "auth_user_user_permissions_permission_id" does not exist ERROR: index "auth_user_groups_user_id" does not exist ERROR: index "auth_user_groups_group_id" does not exist ERROR: index "auth_permission_content_type_id" does not exist ERROR: index "auth_group_permissions_permission_id" does not exist ERROR: index "auth_group_permissions_group_id" does not exist ERROR: relation "public.south_migrationhistory" does not exist ERROR: relation "public.registration_registrationprofile" does not exist ERROR: relation "public.registration_registrationprofile" does not exist ERROR: relation "public.oauth2_refreshtoken" does not exist ERROR: relation "public.oauth2_refreshtoken" does not exist ERROR: relation "public.oauth2_grant" does not exist ERROR: relation "public.oauth2_client" does not exist ERROR: relation "public.oauth2_accesstoken" does not exist ERROR: relation "public.lecturers_quotevote" does not exist ERROR: relation "public.lecturers_quotevote" does not exist ERROR: relation "public.lecturers_quote" does not exist ERROR: relation "public.lecturers_lecturerrating" does not exist ERROR: relation "public.lecturers_lecturerrating" does not exist ERROR: relation "public.lecturers_lecturer" does not exist ERROR: relation "public.lecturers_lecturer" does not exist ERROR: relation "public.lecturers_course" does not exist ERROR: relation "public.lecturers_course" does not exist ERROR: relation "public.front_user" does not exist ERROR: relation "public.front_user_user_permissions" does not exist ERROR: relation "public.front_user_user_permissions" does not exist ERROR: relation "public.front_user" does not exist ERROR: relation "public.front_user_groups" does not exist ERROR: relation "public.front_user_groups" does not exist ERROR: relation "public.events_event" does not exist ERROR: relation "public.easy_thumbnails_thumbnail" does not exist ERROR: relation "public.easy_thumbnails_thumbnail" does not exist ERROR: relation "public.easy_thumbnails_source" does not exist ERROR: relation "public.easy_thumbnails_source" does not exist ERROR: relation "public.documents_documentrating" does not exist ERROR: relation "public.documents_documentrating" does not exist ERROR: relation "public.documents_documentdownload" does not exist ERROR: relation "public.documents_documentcategory" does not exist ERROR: relation "public.documents_documentcategory" does not exist ERROR: relation "public.documents_documentcategory_lecturers" does not exist ERROR: relation "public.documents_documentcategory_courses" does not exist ERROR: relation "public.documents_documentcategory_lecturers" does not exist ERROR: relation "public.documents_documentcategory_courses" does not exist ERROR: relation "public.documents_document" does not exist ERROR: relation "public.django_session" does not exist ERROR: relation "public.django_content_type" does not exist ERROR: relation "public.django_content_type" does not exist ERROR: relation "public.django_admin_log" does not exist ERROR: relation "public.auth_user_user_permissions" does not exist ERROR: relation "public.auth_user_user_permissions" does not exist ERROR: relation "public.auth_user_groups" does not exist ERROR: relation "public.auth_user_groups" does not exist ERROR: relation "public.auth_permission" does not exist ERROR: relation "public.auth_permission" does not exist ERROR: relation "public.auth_group" does not exist ERROR: relation "public.auth_group_permissions" does not exist ERROR: relation "public.auth_group_permissions" does not exist ERROR: relation "public.auth_group" does not exist ERROR: relation "public.south_migrationhistory" does not exist ERROR: relation "public.registration_registrationprofile" does not exist ERROR: relation "public.oauth2_refreshtoken" does not exist ERROR: relation "public.oauth2_grant" does not exist ERROR: relation "public.oauth2_client" does not exist ERROR: relation "public.oauth2_accesstoken" does not exist ERROR: relation "public.lecturers_quotevote" does not exist ERROR: relation "public.lecturers_quote" does not exist ERROR: relation "public.lecturers_lecturerrating" does not exist ERROR: relation "public.front_user_user_permissions" does not exist ERROR: relation "public.front_user_groups" does not exist ERROR: relation "public.front_user" does not exist ERROR: relation "public.events_event" does not exist ERROR: relation "public.easy_thumbnails_thumbnail" does not exist ERROR: relation "public.easy_thumbnails_source" does not exist ERROR: relation "public.documents_documentrating" does not exist ERROR: relation "public.documents_documentdownload" does not exist ERROR: relation "public.documents_documentcategory_lecturers" does not exist ERROR: relation "public.documents_documentcategory_courses" does not exist ERROR: relation "public.documents_documentcategory" does not exist ERROR: relation "public.documents_document" does not exist ERROR: relation "public.django_content_type" does not exist ERROR: relation "public.django_admin_log" does not exist ERROR: relation "public.auth_user_user_permissions" does not exist ERROR: relation "public.auth_user_groups" does not exist ERROR: relation "public.auth_permission" does not exist ERROR: relation "public.auth_group_permissions" does not exist ERROR: relation "public.auth_group" does not exist ERROR: sequence "south_migrationhistory_id_seq" does not exist ERROR: table "south_migrationhistory" does not exist ERROR: sequence "registration_registrationprofile_id_seq" does not exist ERROR: table "registration_registrationprofile" does not exist ERROR: sequence "oauth2_refreshtoken_id_seq" does not exist ERROR: table "oauth2_refreshtoken" does not exist ERROR: sequence "oauth2_grant_id_seq" does not exist ERROR: table "oauth2_grant" does not exist ERROR: sequence "oauth2_client_id_seq" does not exist ERROR: table "oauth2_client" does not exist ERROR: sequence "oauth2_accesstoken_id_seq" does not exist ERROR: table "oauth2_accesstoken" does not exist ERROR: sequence "lecturers_quotevote_id_seq" does not exist ERROR: table "lecturers_quotevote" does not exist ERROR: sequence "lecturers_quote_id_seq" does not exist ERROR: table "lecturers_quote" does not exist ERROR: sequence "lecturers_lecturerrating_id_seq" does not exist ERROR: table "lecturers_lecturerrating" does not exist ERROR: table "lecturers_lecturer" does not exist ERROR: table "lecturers_course" does not exist ERROR: sequence "front_user_user_permissions_id_seq" does not exist ERROR: table "front_user_user_permissions" does not exist ERROR: sequence "front_user_id_seq" does not exist ERROR: sequence "front_user_groups_id_seq" does not exist ERROR: table "front_user_groups" does not exist ERROR: table "front_user" does not exist ERROR: sequence "events_event_id_seq" does not exist ERROR: table "events_event" does not exist ERROR: sequence "easy_thumbnails_thumbnail_id_seq" does not exist ERROR: table "easy_thumbnails_thumbnail" does not exist ERROR: sequence "easy_thumbnails_source_id_seq" does not exist ERROR: table "easy_thumbnails_source" does not exist ERROR: sequence "documents_documentrating_id_seq" does not exist ERROR: table "documents_documentrating" does not exist ERROR: sequence "documents_documentdownload_id_seq" does not exist ERROR: table "documents_documentdownload" does not exist ERROR: sequence "documents_documentcategory_lecturers_id_seq" does not exist ERROR: table "documents_documentcategory_lecturers" does not exist ERROR: sequence "documents_documentcategory_id_seq" does not exist ERROR: sequence "documents_documentcategory_courses_id_seq" does not exist ERROR: table "documents_documentcategory_courses" does not exist ERROR: table "documents_documentcategory" does not exist ERROR: sequence "documents_document_id_seq" does not exist ERROR: table "documents_document" does not exist ERROR: table "django_session" does not exist ERROR: sequence "django_content_type_id_seq" does not exist ERROR: table "django_content_type" does not exist ERROR: sequence "django_admin_log_id_seq" does not exist ERROR: table "django_admin_log" does not exist ERROR: sequence "auth_user_user_permissions_id_seq" does not exist ERROR: table "auth_user_user_permissions" does not exist ERROR: sequence "auth_user_groups_id_seq" does not exist ERROR: table "auth_user_groups" does not exist ERROR: sequence "auth_permission_id_seq" does not exist ERROR: table "auth_permission" does not exist ERROR: sequence "auth_group_permissions_id_seq" does not exist ERROR: table "auth_group_permissions" does not exist ERROR: sequence "auth_group_id_seq" does not exist ERROR: table "auth_group" does not exist ERROR: extension "citext" does not exist DROP EXTENSION DROP SCHEMA CREATE SCHEMA ERROR: role "postgres" does not exist CREATE EXTENSION COMMENT CREATE EXTENSION COMMENT SET SET SET CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE TABLE ALTER TABLE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE CREATE TABLE ALTER TABLE CREATE SEQUENCE ALTER TABLE ALTER SEQUENCE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE COPY 0 setval -------- 1 (1 row) COPY 0 setval -------- 1 (1 row) COPY 96 setval -------- 105 (1 row) COPY 0 setval -------- 1 (1 row) COPY 0 setval -------- 1 (1 row) COPY 481 setval -------- 503 (1 row) COPY 35 setval -------- 38 (1 row) COPY 53194 COPY 1963 setval -------- 2191 (1 row) COPY 802 COPY 753 setval -------- 776 (1 row) setval -------- 1546 (1 row) COPY 732 setval -------- 775 (1 row) COPY 1532515 setval --------- 1535444 (1 row) COPY 1003 setval -------- 1025 (1 row) COPY 368 setval -------- 368 (1 row) COPY 680 setval -------- 680 (1 row) COPY 109 setval -------- 111 (1 row) COPY 4160 COPY 0 setval -------- 1 (1 row) setval -------- 4202 (1 row) COPY 0 setval -------- 1 (1 row) COPY 8 COPY 854 COPY 9028 setval -------- 9032 (1 row) COPY 1885 setval -------- 2422 (1 row) COPY 9522 setval -------- 10583 (1 row) COPY 0 setval -------- 1 (1 row) COPY 0 setval -------- 1 (1 row) COPY 0 setval -------- 1 (1 row) COPY 0 setval -------- 1 (1 row) COPY 4137 setval -------- 4165 (1 row) COPY 27 setval -------- 27 (1 row) ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE REVOKE ERROR: role "postgres" does not exist ERROR: role "postgres" does not exist GRANT ```

Ich glaube aber, dass diese ignoriert werden können. Die meisten davon sind wegen Statements, die Daten löschen, die aber gar nicht da sind. Die letzten paar sind wegen Permissions für einen postgres-User, den es im Docker-Container aber nicht mehr gibt.

Ich hab an dem Punkt einige Stichproben gemacht und die Daten sehen okay aus.

Das initiale Schema (psql -U studentenportal <<< '\d *' > schema-initial) sieht so aus:

``` Table "pg_catalog.pg_aggregate" Column | Type | Collation | Nullable | Default ------------------+----------+-----------+----------+--------- aggfnoid | regproc | | not null | aggkind | "char" | | not null | aggnumdirectargs | smallint | | not null | aggtransfn | regproc | | not null | aggfinalfn | regproc | | not null | aggcombinefn | regproc | | not null | aggserialfn | regproc | | not null | aggdeserialfn | regproc | | not null | aggmtransfn | regproc | | not null | aggminvtransfn | regproc | | not null | aggmfinalfn | regproc | | not null | aggfinalextra | boolean | | not null | aggmfinalextra | boolean | | not null | aggfinalmodify | "char" | | not null | aggmfinalmodify | "char" | | not null | aggsortop | oid | | not null | aggtranstype | oid | | not null | aggtransspace | integer | | not null | aggmtranstype | oid | | not null | aggmtransspace | integer | | not null | agginitval | text | C | | aggminitval | text | C | | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid) Index "pg_catalog.pg_aggregate_fnoid_index" Column | Type | Key? | Definition ----------+---------+------+------------ aggfnoid | regproc | yes | aggfnoid unique, btree, for table "pg_catalog.pg_aggregate" Table "pg_catalog.pg_am" Column | Type | Collation | Nullable | Default -----------+---------+-----------+----------+--------- oid | oid | | not null | amname | name | | not null | amhandler | regproc | | not null | amtype | "char" | | not null | Indexes: "pg_am_name_index" UNIQUE, btree (amname) "pg_am_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_am_name_index" Column | Type | Key? | Definition --------+---------+------+------------ amname | cstring | yes | amname unique, btree, for table "pg_catalog.pg_am" Index "pg_catalog.pg_am_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_am" Table "pg_catalog.pg_amop" Column | Type | Collation | Nullable | Default ----------------+----------+-----------+----------+--------- oid | oid | | not null | amopfamily | oid | | not null | amoplefttype | oid | | not null | amoprighttype | oid | | not null | amopstrategy | smallint | | not null | amoppurpose | "char" | | not null | amopopr | oid | | not null | amopmethod | oid | | not null | amopsortfamily | oid | | not null | Indexes: "pg_amop_fam_strat_index" UNIQUE, btree (amopfamily, amoplefttype, amoprighttype, amopstrategy) "pg_amop_oid_index" UNIQUE, btree (oid) "pg_amop_opr_fam_index" UNIQUE, btree (amopopr, amoppurpose, amopfamily) Index "pg_catalog.pg_amop_fam_strat_index" Column | Type | Key? | Definition ---------------+----------+------+--------------- amopfamily | oid | yes | amopfamily amoplefttype | oid | yes | amoplefttype amoprighttype | oid | yes | amoprighttype amopstrategy | smallint | yes | amopstrategy unique, btree, for table "pg_catalog.pg_amop" Index "pg_catalog.pg_amop_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_amop" Index "pg_catalog.pg_amop_opr_fam_index" Column | Type | Key? | Definition -------------+--------+------+------------- amopopr | oid | yes | amopopr amoppurpose | "char" | yes | amoppurpose amopfamily | oid | yes | amopfamily unique, btree, for table "pg_catalog.pg_amop" Table "pg_catalog.pg_amproc" Column | Type | Collation | Nullable | Default -----------------+----------+-----------+----------+--------- oid | oid | | not null | amprocfamily | oid | | not null | amproclefttype | oid | | not null | amprocrighttype | oid | | not null | amprocnum | smallint | | not null | amproc | regproc | | not null | Indexes: "pg_amproc_fam_proc_index" UNIQUE, btree (amprocfamily, amproclefttype, amprocrighttype, amprocnum) "pg_amproc_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_amproc_fam_proc_index" Column | Type | Key? | Definition -----------------+----------+------+----------------- amprocfamily | oid | yes | amprocfamily amproclefttype | oid | yes | amproclefttype amprocrighttype | oid | yes | amprocrighttype amprocnum | smallint | yes | amprocnum unique, btree, for table "pg_catalog.pg_amproc" Index "pg_catalog.pg_amproc_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_amproc" Table "pg_catalog.pg_attrdef" Column | Type | Collation | Nullable | Default ---------+--------------+-----------+----------+--------- oid | oid | | not null | adrelid | oid | | not null | adnum | smallint | | not null | adbin | pg_node_tree | C | not null | Indexes: "pg_attrdef_adrelid_adnum_index" UNIQUE, btree (adrelid, adnum) "pg_attrdef_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_attrdef_adrelid_adnum_index" Column | Type | Key? | Definition ---------+----------+------+------------ adrelid | oid | yes | adrelid adnum | smallint | yes | adnum unique, btree, for table "pg_catalog.pg_attrdef" Index "pg_catalog.pg_attrdef_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_attrdef" Table "pg_catalog.pg_attribute" Column | Type | Collation | Nullable | Default ---------------+-----------+-----------+----------+--------- attrelid | oid | | not null | attname | name | | not null | atttypid | oid | | not null | attstattarget | integer | | not null | attlen | smallint | | not null | attnum | smallint | | not null | attndims | integer | | not null | attcacheoff | integer | | not null | atttypmod | integer | | not null | attbyval | boolean | | not null | attstorage | "char" | | not null | attalign | "char" | | not null | attnotnull | boolean | | not null | atthasdef | boolean | | not null | atthasmissing | boolean | | not null | attidentity | "char" | | not null | attgenerated | "char" | | not null | attisdropped | boolean | | not null | attislocal | boolean | | not null | attinhcount | integer | | not null | attcollation | oid | | not null | attacl | aclitem[] | | | attoptions | text[] | C | | attfdwoptions | text[] | C | | attmissingval | anyarray | | | Indexes: "pg_attribute_relid_attnam_index" UNIQUE, btree (attrelid, attname) "pg_attribute_relid_attnum_index" UNIQUE, btree (attrelid, attnum) Index "pg_catalog.pg_attribute_relid_attnam_index" Column | Type | Key? | Definition ----------+---------+------+------------ attrelid | oid | yes | attrelid attname | cstring | yes | attname unique, btree, for table "pg_catalog.pg_attribute" Index "pg_catalog.pg_attribute_relid_attnum_index" Column | Type | Key? | Definition ----------+----------+------+------------ attrelid | oid | yes | attrelid attnum | smallint | yes | attnum unique, btree, for table "pg_catalog.pg_attribute" Table "pg_catalog.pg_auth_members" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- roleid | oid | | not null | member | oid | | not null | grantor | oid | | not null | admin_option | boolean | | not null | Indexes: "pg_auth_members_member_role_index" UNIQUE, btree (member, roleid), tablespace "pg_global" "pg_auth_members_role_member_index" UNIQUE, btree (roleid, member), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_auth_members_member_role_index" Column | Type | Key? | Definition --------+------+------+------------ member | oid | yes | member roleid | oid | yes | roleid unique, btree, for table "pg_catalog.pg_auth_members" Tablespace: "pg_global" Index "pg_catalog.pg_auth_members_role_member_index" Column | Type | Key? | Definition --------+------+------+------------ roleid | oid | yes | roleid member | oid | yes | member unique, btree, for table "pg_catalog.pg_auth_members" Tablespace: "pg_global" Table "pg_catalog.pg_authid" Column | Type | Collation | Nullable | Default ----------------+--------------------------+-----------+----------+--------- oid | oid | | not null | rolname | name | | not null | rolsuper | boolean | | not null | rolinherit | boolean | | not null | rolcreaterole | boolean | | not null | rolcreatedb | boolean | | not null | rolcanlogin | boolean | | not null | rolreplication | boolean | | not null | rolbypassrls | boolean | | not null | rolconnlimit | integer | | not null | rolpassword | text | C | | rolvaliduntil | timestamp with time zone | | | Indexes: "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global" "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_authid_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_authid" Tablespace: "pg_global" Index "pg_catalog.pg_authid_rolname_index" Column | Type | Key? | Definition ---------+---------+------+------------ rolname | cstring | yes | rolname unique, btree, for table "pg_catalog.pg_authid" Tablespace: "pg_global" View "pg_catalog.pg_available_extension_versions" Column | Type | Collation | Nullable | Default -------------+---------+-----------+----------+--------- name | name | | | version | text | | | installed | boolean | | | superuser | boolean | | | relocatable | boolean | | | schema | name | | | requires | name[] | | | comment | text | | | View "pg_catalog.pg_available_extensions" Column | Type | Collation | Nullable | Default -------------------+------+-----------+----------+--------- name | name | | | default_version | text | | | installed_version | text | C | | comment | text | | | Table "pg_catalog.pg_cast" Column | Type | Collation | Nullable | Default -------------+--------+-----------+----------+--------- oid | oid | | not null | castsource | oid | | not null | casttarget | oid | | not null | castfunc | oid | | not null | castcontext | "char" | | not null | castmethod | "char" | | not null | Indexes: "pg_cast_oid_index" UNIQUE, btree (oid) "pg_cast_source_target_index" UNIQUE, btree (castsource, casttarget) Index "pg_catalog.pg_cast_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_cast" Index "pg_catalog.pg_cast_source_target_index" Column | Type | Key? | Definition ------------+------+------+------------ castsource | oid | yes | castsource casttarget | oid | yes | casttarget unique, btree, for table "pg_catalog.pg_cast" Table "pg_catalog.pg_class" Column | Type | Collation | Nullable | Default ---------------------+--------------+-----------+----------+--------- oid | oid | | not null | relname | name | | not null | relnamespace | oid | | not null | reltype | oid | | not null | reloftype | oid | | not null | relowner | oid | | not null | relam | oid | | not null | relfilenode | oid | | not null | reltablespace | oid | | not null | relpages | integer | | not null | reltuples | real | | not null | relallvisible | integer | | not null | reltoastrelid | oid | | not null | relhasindex | boolean | | not null | relisshared | boolean | | not null | relpersistence | "char" | | not null | relkind | "char" | | not null | relnatts | smallint | | not null | relchecks | smallint | | not null | relhasrules | boolean | | not null | relhastriggers | boolean | | not null | relhassubclass | boolean | | not null | relrowsecurity | boolean | | not null | relforcerowsecurity | boolean | | not null | relispopulated | boolean | | not null | relreplident | "char" | | not null | relispartition | boolean | | not null | relrewrite | oid | | not null | relfrozenxid | xid | | not null | relminmxid | xid | | not null | relacl | aclitem[] | | | reloptions | text[] | C | | relpartbound | pg_node_tree | C | | Indexes: "pg_class_oid_index" UNIQUE, btree (oid) "pg_class_relname_nsp_index" UNIQUE, btree (relname, relnamespace) "pg_class_tblspc_relfilenode_index" btree (reltablespace, relfilenode) Index "pg_catalog.pg_class_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_class" Index "pg_catalog.pg_class_relname_nsp_index" Column | Type | Key? | Definition --------------+---------+------+-------------- relname | cstring | yes | relname relnamespace | oid | yes | relnamespace unique, btree, for table "pg_catalog.pg_class" Index "pg_catalog.pg_class_tblspc_relfilenode_index" Column | Type | Key? | Definition ---------------+------+------+--------------- reltablespace | oid | yes | reltablespace relfilenode | oid | yes | relfilenode btree, for table "pg_catalog.pg_class" Table "pg_catalog.pg_collation" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- oid | oid | | not null | collname | name | | not null | collnamespace | oid | | not null | collowner | oid | | not null | collprovider | "char" | | not null | collisdeterministic | boolean | | not null | collencoding | integer | | not null | collcollate | name | | not null | collctype | name | | not null | collversion | text | C | | Indexes: "pg_collation_name_enc_nsp_index" UNIQUE, btree (collname, collencoding, collnamespace) "pg_collation_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_collation_name_enc_nsp_index" Column | Type | Key? | Definition ---------------+---------+------+--------------- collname | cstring | yes | collname collencoding | integer | yes | collencoding collnamespace | oid | yes | collnamespace unique, btree, for table "pg_catalog.pg_collation" Index "pg_catalog.pg_collation_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_collation" View "pg_catalog.pg_config" Column | Type | Collation | Nullable | Default ---------+------+-----------+----------+--------- name | text | | | setting | text | | | Table "pg_catalog.pg_constraint" Column | Type | Collation | Nullable | Default ---------------+--------------+-----------+----------+--------- oid | oid | | not null | conname | name | | not null | connamespace | oid | | not null | contype | "char" | | not null | condeferrable | boolean | | not null | condeferred | boolean | | not null | convalidated | boolean | | not null | conrelid | oid | | not null | contypid | oid | | not null | conindid | oid | | not null | conparentid | oid | | not null | confrelid | oid | | not null | confupdtype | "char" | | not null | confdeltype | "char" | | not null | confmatchtype | "char" | | not null | conislocal | boolean | | not null | coninhcount | integer | | not null | connoinherit | boolean | | not null | conkey | smallint[] | | | confkey | smallint[] | | | conpfeqop | oid[] | | | conppeqop | oid[] | | | conffeqop | oid[] | | | conexclop | oid[] | | | conbin | pg_node_tree | C | | Indexes: "pg_constraint_conrelid_contypid_conname_index" UNIQUE, btree (conrelid, contypid, conname) "pg_constraint_oid_index" UNIQUE, btree (oid) "pg_constraint_conname_nsp_index" btree (conname, connamespace) "pg_constraint_conparentid_index" btree (conparentid) "pg_constraint_contypid_index" btree (contypid) Index "pg_catalog.pg_constraint_conname_nsp_index" Column | Type | Key? | Definition --------------+---------+------+-------------- conname | cstring | yes | conname connamespace | oid | yes | connamespace btree, for table "pg_catalog.pg_constraint" Index "pg_catalog.pg_constraint_conparentid_index" Column | Type | Key? | Definition -------------+------+------+------------- conparentid | oid | yes | conparentid btree, for table "pg_catalog.pg_constraint" Index "pg_catalog.pg_constraint_conrelid_contypid_conname_index" Column | Type | Key? | Definition ----------+---------+------+------------ conrelid | oid | yes | conrelid contypid | oid | yes | contypid conname | cstring | yes | conname unique, btree, for table "pg_catalog.pg_constraint" Index "pg_catalog.pg_constraint_contypid_index" Column | Type | Key? | Definition ----------+------+------+------------ contypid | oid | yes | contypid btree, for table "pg_catalog.pg_constraint" Index "pg_catalog.pg_constraint_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_constraint" Table "pg_catalog.pg_conversion" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- oid | oid | | not null | conname | name | | not null | connamespace | oid | | not null | conowner | oid | | not null | conforencoding | integer | | not null | contoencoding | integer | | not null | conproc | regproc | | not null | condefault | boolean | | not null | Indexes: "pg_conversion_default_index" UNIQUE, btree (connamespace, conforencoding, contoencoding, oid) "pg_conversion_name_nsp_index" UNIQUE, btree (conname, connamespace) "pg_conversion_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_conversion_default_index" Column | Type | Key? | Definition ----------------+---------+------+---------------- connamespace | oid | yes | connamespace conforencoding | integer | yes | conforencoding contoencoding | integer | yes | contoencoding oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_conversion" Index "pg_catalog.pg_conversion_name_nsp_index" Column | Type | Key? | Definition --------------+---------+------+-------------- conname | cstring | yes | conname connamespace | oid | yes | connamespace unique, btree, for table "pg_catalog.pg_conversion" Index "pg_catalog.pg_conversion_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_conversion" View "pg_catalog.pg_cursors" Column | Type | Collation | Nullable | Default ---------------+--------------------------+-----------+----------+--------- name | text | | | statement | text | | | is_holdable | boolean | | | is_binary | boolean | | | is_scrollable | boolean | | | creation_time | timestamp with time zone | | | Table "pg_catalog.pg_database" Column | Type | Collation | Nullable | Default ---------------+-----------+-----------+----------+--------- oid | oid | | not null | datname | name | | not null | datdba | oid | | not null | encoding | integer | | not null | datcollate | name | | not null | datctype | name | | not null | datistemplate | boolean | | not null | datallowconn | boolean | | not null | datconnlimit | integer | | not null | datlastsysoid | oid | | not null | datfrozenxid | xid | | not null | datminmxid | xid | | not null | dattablespace | oid | | not null | datacl | aclitem[] | | | Indexes: "pg_database_datname_index" UNIQUE, btree (datname), tablespace "pg_global" "pg_database_oid_index" UNIQUE, btree (oid), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_database_datname_index" Column | Type | Key? | Definition ---------+---------+------+------------ datname | cstring | yes | datname unique, btree, for table "pg_catalog.pg_database" Tablespace: "pg_global" Index "pg_catalog.pg_database_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_database" Tablespace: "pg_global" Table "pg_catalog.pg_db_role_setting" Column | Type | Collation | Nullable | Default -------------+--------+-----------+----------+--------- setdatabase | oid | | not null | setrole | oid | | not null | setconfig | text[] | C | | Indexes: "pg_db_role_setting_databaseid_rol_index" UNIQUE, btree (setdatabase, setrole), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_db_role_setting_databaseid_rol_index" Column | Type | Key? | Definition -------------+------+------+------------- setdatabase | oid | yes | setdatabase setrole | oid | yes | setrole unique, btree, for table "pg_catalog.pg_db_role_setting" Tablespace: "pg_global" Table "pg_catalog.pg_default_acl" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- oid | oid | | not null | defaclrole | oid | | not null | defaclnamespace | oid | | not null | defaclobjtype | "char" | | not null | defaclacl | aclitem[] | | not null | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype) Index "pg_catalog.pg_default_acl_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_default_acl" Index "pg_catalog.pg_default_acl_role_nsp_obj_index" Column | Type | Key? | Definition -----------------+--------+------+----------------- defaclrole | oid | yes | defaclrole defaclnamespace | oid | yes | defaclnamespace defaclobjtype | "char" | yes | defaclobjtype unique, btree, for table "pg_catalog.pg_default_acl" Table "pg_catalog.pg_depend" Column | Type | Collation | Nullable | Default -------------+---------+-----------+----------+--------- classid | oid | | not null | objid | oid | | not null | objsubid | integer | | not null | refclassid | oid | | not null | refobjid | oid | | not null | refobjsubid | integer | | not null | deptype | "char" | | not null | Indexes: "pg_depend_depender_index" btree (classid, objid, objsubid) "pg_depend_reference_index" btree (refclassid, refobjid, refobjsubid) Index "pg_catalog.pg_depend_depender_index" Column | Type | Key? | Definition ----------+---------+------+------------ classid | oid | yes | classid objid | oid | yes | objid objsubid | integer | yes | objsubid btree, for table "pg_catalog.pg_depend" Index "pg_catalog.pg_depend_reference_index" Column | Type | Key? | Definition -------------+---------+------+------------- refclassid | oid | yes | refclassid refobjid | oid | yes | refobjid refobjsubid | integer | yes | refobjsubid btree, for table "pg_catalog.pg_depend" Table "pg_catalog.pg_description" Column | Type | Collation | Nullable | Default -------------+---------+-----------+----------+--------- objoid | oid | | not null | classoid | oid | | not null | objsubid | integer | | not null | description | text | C | not null | Indexes: "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid) Index "pg_catalog.pg_description_o_c_o_index" Column | Type | Key? | Definition ----------+---------+------+------------ objoid | oid | yes | objoid classoid | oid | yes | classoid objsubid | integer | yes | objsubid unique, btree, for table "pg_catalog.pg_description" Table "pg_catalog.pg_enum" Column | Type | Collation | Nullable | Default ---------------+------+-----------+----------+--------- oid | oid | | not null | enumtypid | oid | | not null | enumsortorder | real | | not null | enumlabel | name | | not null | Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder) Index "pg_catalog.pg_enum_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_enum" Index "pg_catalog.pg_enum_typid_label_index" Column | Type | Key? | Definition -----------+---------+------+------------ enumtypid | oid | yes | enumtypid enumlabel | cstring | yes | enumlabel unique, btree, for table "pg_catalog.pg_enum" Index "pg_catalog.pg_enum_typid_sortorder_index" Column | Type | Key? | Definition ---------------+------+------+--------------- enumtypid | oid | yes | enumtypid enumsortorder | real | yes | enumsortorder unique, btree, for table "pg_catalog.pg_enum" Table "pg_catalog.pg_event_trigger" Column | Type | Collation | Nullable | Default ------------+--------+-----------+----------+--------- oid | oid | | not null | evtname | name | | not null | evtevent | name | | not null | evtowner | oid | | not null | evtfoid | oid | | not null | evtenabled | "char" | | not null | evttags | text[] | C | | Indexes: "pg_event_trigger_evtname_index" UNIQUE, btree (evtname) "pg_event_trigger_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_event_trigger_evtname_index" Column | Type | Key? | Definition ---------+---------+------+------------ evtname | cstring | yes | evtname unique, btree, for table "pg_catalog.pg_event_trigger" Index "pg_catalog.pg_event_trigger_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_event_trigger" Table "pg_catalog.pg_extension" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- oid | oid | | not null | extname | name | | not null | extowner | oid | | not null | extnamespace | oid | | not null | extrelocatable | boolean | | not null | extversion | text | C | not null | extconfig | oid[] | | | extcondition | text[] | C | | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_extension_name_index" Column | Type | Key? | Definition ---------+---------+------+------------ extname | cstring | yes | extname unique, btree, for table "pg_catalog.pg_extension" Index "pg_catalog.pg_extension_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_extension" View "pg_catalog.pg_file_settings" Column | Type | Collation | Nullable | Default ------------+---------+-----------+----------+--------- sourcefile | text | | | sourceline | integer | | | seqno | integer | | | name | text | | | setting | text | | | applied | boolean | | | error | text | | | Table "pg_catalog.pg_foreign_data_wrapper" Column | Type | Collation | Nullable | Default --------------+-----------+-----------+----------+--------- oid | oid | | not null | fdwname | name | | not null | fdwowner | oid | | not null | fdwhandler | oid | | not null | fdwvalidator | oid | | not null | fdwacl | aclitem[] | | | fdwoptions | text[] | C | | Indexes: "pg_foreign_data_wrapper_name_index" UNIQUE, btree (fdwname) "pg_foreign_data_wrapper_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_foreign_data_wrapper_name_index" Column | Type | Key? | Definition ---------+---------+------+------------ fdwname | cstring | yes | fdwname unique, btree, for table "pg_catalog.pg_foreign_data_wrapper" Index "pg_catalog.pg_foreign_data_wrapper_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_foreign_data_wrapper" Table "pg_catalog.pg_foreign_server" Column | Type | Collation | Nullable | Default ------------+-----------+-----------+----------+--------- oid | oid | | not null | srvname | name | | not null | srvowner | oid | | not null | srvfdw | oid | | not null | srvtype | text | C | | srvversion | text | C | | srvacl | aclitem[] | | | srvoptions | text[] | C | | Indexes: "pg_foreign_server_name_index" UNIQUE, btree (srvname) "pg_foreign_server_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_foreign_server_name_index" Column | Type | Key? | Definition ---------+---------+------+------------ srvname | cstring | yes | srvname unique, btree, for table "pg_catalog.pg_foreign_server" Index "pg_catalog.pg_foreign_server_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_foreign_server" Table "pg_catalog.pg_foreign_table" Column | Type | Collation | Nullable | Default -----------+--------+-----------+----------+--------- ftrelid | oid | | not null | ftserver | oid | | not null | ftoptions | text[] | C | | Indexes: "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid) Index "pg_catalog.pg_foreign_table_relid_index" Column | Type | Key? | Definition ---------+------+------+------------ ftrelid | oid | yes | ftrelid unique, btree, for table "pg_catalog.pg_foreign_table" View "pg_catalog.pg_group" Column | Type | Collation | Nullable | Default ----------+-------+-----------+----------+--------- groname | name | | | grosysid | oid | | | grolist | oid[] | | | View "pg_catalog.pg_hba_file_rules" Column | Type | Collation | Nullable | Default -------------+---------+-----------+----------+--------- line_number | integer | | | type | text | | | database | text[] | | | user_name | text[] | | | address | text | | | netmask | text | | | auth_method | text | | | options | text[] | | | error | text | | | Table "pg_catalog.pg_index" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- indexrelid | oid | | not null | indrelid | oid | | not null | indnatts | smallint | | not null | indnkeyatts | smallint | | not null | indisunique | boolean | | not null | indisprimary | boolean | | not null | indisexclusion | boolean | | not null | indimmediate | boolean | | not null | indisclustered | boolean | | not null | indisvalid | boolean | | not null | indcheckxmin | boolean | | not null | indisready | boolean | | not null | indislive | boolean | | not null | indisreplident | boolean | | not null | indkey | int2vector | | not null | indcollation | oidvector | | not null | indclass | oidvector | | not null | indoption | int2vector | | not null | indexprs | pg_node_tree | C | | indpred | pg_node_tree | C | | Indexes: "pg_index_indexrelid_index" UNIQUE, btree (indexrelid) "pg_index_indrelid_index" btree (indrelid) Index "pg_catalog.pg_index_indexrelid_index" Column | Type | Key? | Definition ------------+------+------+------------ indexrelid | oid | yes | indexrelid unique, btree, for table "pg_catalog.pg_index" Index "pg_catalog.pg_index_indrelid_index" Column | Type | Key? | Definition ----------+------+------+------------ indrelid | oid | yes | indrelid btree, for table "pg_catalog.pg_index" View "pg_catalog.pg_indexes" Column | Type | Collation | Nullable | Default ------------+------+-----------+----------+--------- schemaname | name | | | tablename | name | | | indexname | name | | | tablespace | name | | | indexdef | text | | | Table "pg_catalog.pg_inherits" Column | Type | Collation | Nullable | Default -----------+---------+-----------+----------+--------- inhrelid | oid | | not null | inhparent | oid | | not null | inhseqno | integer | | not null | Indexes: "pg_inherits_relid_seqno_index" UNIQUE, btree (inhrelid, inhseqno) "pg_inherits_parent_index" btree (inhparent) Index "pg_catalog.pg_inherits_parent_index" Column | Type | Key? | Definition -----------+------+------+------------ inhparent | oid | yes | inhparent btree, for table "pg_catalog.pg_inherits" Index "pg_catalog.pg_inherits_relid_seqno_index" Column | Type | Key? | Definition ----------+---------+------+------------ inhrelid | oid | yes | inhrelid inhseqno | integer | yes | inhseqno unique, btree, for table "pg_catalog.pg_inherits" Table "pg_catalog.pg_init_privs" Column | Type | Collation | Nullable | Default -----------+-----------+-----------+----------+--------- objoid | oid | | not null | classoid | oid | | not null | objsubid | integer | | not null | privtype | "char" | | not null | initprivs | aclitem[] | | not null | Indexes: "pg_init_privs_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid) Index "pg_catalog.pg_init_privs_o_c_o_index" Column | Type | Key? | Definition ----------+---------+------+------------ objoid | oid | yes | objoid classoid | oid | yes | classoid objsubid | integer | yes | objsubid unique, btree, for table "pg_catalog.pg_init_privs" Table "pg_catalog.pg_language" Column | Type | Collation | Nullable | Default ---------------+-----------+-----------+----------+--------- oid | oid | | not null | lanname | name | | not null | lanowner | oid | | not null | lanispl | boolean | | not null | lanpltrusted | boolean | | not null | lanplcallfoid | oid | | not null | laninline | oid | | not null | lanvalidator | oid | | not null | lanacl | aclitem[] | | | Indexes: "pg_language_name_index" UNIQUE, btree (lanname) "pg_language_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_language_name_index" Column | Type | Key? | Definition ---------+---------+------+------------ lanname | cstring | yes | lanname unique, btree, for table "pg_catalog.pg_language" Index "pg_catalog.pg_language_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_language" Table "pg_catalog.pg_largeobject" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- loid | oid | | not null | pageno | integer | | not null | data | bytea | | not null | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno) Index "pg_catalog.pg_largeobject_loid_pn_index" Column | Type | Key? | Definition --------+---------+------+------------ loid | oid | yes | loid pageno | integer | yes | pageno unique, btree, for table "pg_catalog.pg_largeobject" Table "pg_catalog.pg_largeobject_metadata" Column | Type | Collation | Nullable | Default ----------+-----------+-----------+----------+--------- oid | oid | | not null | lomowner | oid | | not null | lomacl | aclitem[] | | | Indexes: "pg_largeobject_metadata_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_largeobject_metadata_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_largeobject_metadata" View "pg_catalog.pg_locks" Column | Type | Collation | Nullable | Default --------------------+----------+-----------+----------+--------- locktype | text | | | database | oid | | | relation | oid | | | page | integer | | | tuple | smallint | | | virtualxid | text | | | transactionid | xid | | | classid | oid | | | objid | oid | | | objsubid | smallint | | | virtualtransaction | text | | | pid | integer | | | mode | text | | | granted | boolean | | | fastpath | boolean | | | View "pg_catalog.pg_matviews" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- schemaname | name | | | matviewname | name | | | matviewowner | name | | | tablespace | name | | | hasindexes | boolean | | | ispopulated | boolean | | | definition | text | | | Table "pg_catalog.pg_namespace" Column | Type | Collation | Nullable | Default ----------+-----------+-----------+----------+--------- oid | oid | | not null | nspname | name | | not null | nspowner | oid | | not null | nspacl | aclitem[] | | | Indexes: "pg_namespace_nspname_index" UNIQUE, btree (nspname) "pg_namespace_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_namespace_nspname_index" Column | Type | Key? | Definition ---------+---------+------+------------ nspname | cstring | yes | nspname unique, btree, for table "pg_catalog.pg_namespace" Index "pg_catalog.pg_namespace_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_namespace" Table "pg_catalog.pg_opclass" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | opcmethod | oid | | not null | opcname | name | | not null | opcnamespace | oid | | not null | opcowner | oid | | not null | opcfamily | oid | | not null | opcintype | oid | | not null | opcdefault | boolean | | not null | opckeytype | oid | | not null | Indexes: "pg_opclass_am_name_nsp_index" UNIQUE, btree (opcmethod, opcname, opcnamespace) "pg_opclass_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_opclass_am_name_nsp_index" Column | Type | Key? | Definition --------------+---------+------+-------------- opcmethod | oid | yes | opcmethod opcname | cstring | yes | opcname opcnamespace | oid | yes | opcnamespace unique, btree, for table "pg_catalog.pg_opclass" Index "pg_catalog.pg_opclass_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_opclass" Table "pg_catalog.pg_operator" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | oprname | name | | not null | oprnamespace | oid | | not null | oprowner | oid | | not null | oprkind | "char" | | not null | oprcanmerge | boolean | | not null | oprcanhash | boolean | | not null | oprleft | oid | | not null | oprright | oid | | not null | oprresult | oid | | not null | oprcom | oid | | not null | oprnegate | oid | | not null | oprcode | regproc | | not null | oprrest | regproc | | not null | oprjoin | regproc | | not null | Indexes: "pg_operator_oid_index" UNIQUE, btree (oid) "pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace) Index "pg_catalog.pg_operator_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_operator" Index "pg_catalog.pg_operator_oprname_l_r_n_index" Column | Type | Key? | Definition --------------+---------+------+-------------- oprname | cstring | yes | oprname oprleft | oid | yes | oprleft oprright | oid | yes | oprright oprnamespace | oid | yes | oprnamespace unique, btree, for table "pg_catalog.pg_operator" Table "pg_catalog.pg_opfamily" Column | Type | Collation | Nullable | Default --------------+------+-----------+----------+--------- oid | oid | | not null | opfmethod | oid | | not null | opfname | name | | not null | opfnamespace | oid | | not null | opfowner | oid | | not null | Indexes: "pg_opfamily_am_name_nsp_index" UNIQUE, btree (opfmethod, opfname, opfnamespace) "pg_opfamily_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_opfamily_am_name_nsp_index" Column | Type | Key? | Definition --------------+---------+------+-------------- opfmethod | oid | yes | opfmethod opfname | cstring | yes | opfname opfnamespace | oid | yes | opfnamespace unique, btree, for table "pg_catalog.pg_opfamily" Index "pg_catalog.pg_opfamily_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_opfamily" Table "pg_catalog.pg_partitioned_table" Column | Type | Collation | Nullable | Default ---------------+--------------+-----------+----------+--------- partrelid | oid | | not null | partstrat | "char" | | not null | partnatts | smallint | | not null | partdefid | oid | | not null | partattrs | int2vector | | not null | partclass | oidvector | | not null | partcollation | oidvector | | not null | partexprs | pg_node_tree | C | | Indexes: "pg_partitioned_table_partrelid_index" UNIQUE, btree (partrelid) Index "pg_catalog.pg_partitioned_table_partrelid_index" Column | Type | Key? | Definition -----------+------+------+------------ partrelid | oid | yes | partrelid unique, btree, for table "pg_catalog.pg_partitioned_table" Table "pg_catalog.pg_pltemplate" Column | Type | Collation | Nullable | Default ---------------+-----------+-----------+----------+--------- tmplname | name | | not null | tmpltrusted | boolean | | not null | tmpldbacreate | boolean | | not null | tmplhandler | text | C | not null | tmplinline | text | C | | tmplvalidator | text | C | | tmpllibrary | text | C | not null | tmplacl | aclitem[] | | | Indexes: "pg_pltemplate_name_index" UNIQUE, btree (tmplname), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_pltemplate_name_index" Column | Type | Key? | Definition ----------+---------+------+------------ tmplname | cstring | yes | tmplname unique, btree, for table "pg_catalog.pg_pltemplate" Tablespace: "pg_global" View "pg_catalog.pg_policies" Column | Type | Collation | Nullable | Default ------------+--------+-----------+----------+--------- schemaname | name | | | tablename | name | | | policyname | name | | | permissive | text | | | roles | name[] | | | cmd | text | | | qual | text | C | | with_check | text | C | | Table "pg_catalog.pg_policy" Column | Type | Collation | Nullable | Default ---------------+--------------+-----------+----------+--------- oid | oid | | not null | polname | name | | not null | polrelid | oid | | not null | polcmd | "char" | | not null | polpermissive | boolean | | not null | polroles | oid[] | | not null | polqual | pg_node_tree | C | | polwithcheck | pg_node_tree | C | | Indexes: "pg_policy_oid_index" UNIQUE, btree (oid) "pg_policy_polrelid_polname_index" UNIQUE, btree (polrelid, polname) Index "pg_catalog.pg_policy_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_policy" Index "pg_catalog.pg_policy_polrelid_polname_index" Column | Type | Key? | Definition ----------+---------+------+------------ polrelid | oid | yes | polrelid polname | cstring | yes | polname unique, btree, for table "pg_catalog.pg_policy" View "pg_catalog.pg_prepared_statements" Column | Type | Collation | Nullable | Default -----------------+--------------------------+-----------+----------+--------- name | text | | | statement | text | | | prepare_time | timestamp with time zone | | | parameter_types | regtype[] | | | from_sql | boolean | | | View "pg_catalog.pg_prepared_xacts" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------- transaction | xid | | | gid | text | | | prepared | timestamp with time zone | | | owner | name | | | database | name | | | Table "pg_catalog.pg_proc" Column | Type | Collation | Nullable | Default -----------------+--------------+-----------+----------+--------- oid | oid | | not null | proname | name | | not null | pronamespace | oid | | not null | proowner | oid | | not null | prolang | oid | | not null | procost | real | | not null | prorows | real | | not null | provariadic | oid | | not null | prosupport | regproc | | not null | prokind | "char" | | not null | prosecdef | boolean | | not null | proleakproof | boolean | | not null | proisstrict | boolean | | not null | proretset | boolean | | not null | provolatile | "char" | | not null | proparallel | "char" | | not null | pronargs | smallint | | not null | pronargdefaults | smallint | | not null | prorettype | oid | | not null | proargtypes | oidvector | | not null | proallargtypes | oid[] | | | proargmodes | "char"[] | | | proargnames | text[] | C | | proargdefaults | pg_node_tree | C | | protrftypes | oid[] | | | prosrc | text | C | not null | probin | text | C | | proconfig | text[] | C | | proacl | aclitem[] | | | Indexes: "pg_proc_oid_index" UNIQUE, btree (oid) "pg_proc_proname_args_nsp_index" UNIQUE, btree (proname, proargtypes, pronamespace) Index "pg_catalog.pg_proc_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_proc" Index "pg_catalog.pg_proc_proname_args_nsp_index" Column | Type | Key? | Definition --------------+-----------+------+-------------- proname | cstring | yes | proname proargtypes | oidvector | yes | proargtypes pronamespace | oid | yes | pronamespace unique, btree, for table "pg_catalog.pg_proc" Table "pg_catalog.pg_publication" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | pubname | name | | not null | pubowner | oid | | not null | puballtables | boolean | | not null | pubinsert | boolean | | not null | pubupdate | boolean | | not null | pubdelete | boolean | | not null | pubtruncate | boolean | | not null | Indexes: "pg_publication_oid_index" UNIQUE, btree (oid) "pg_publication_pubname_index" UNIQUE, btree (pubname) Index "pg_catalog.pg_publication_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_publication" Index "pg_catalog.pg_publication_pubname_index" Column | Type | Key? | Definition ---------+---------+------+------------ pubname | cstring | yes | pubname unique, btree, for table "pg_catalog.pg_publication" Table "pg_catalog.pg_publication_rel" Column | Type | Collation | Nullable | Default ---------+------+-----------+----------+--------- oid | oid | | not null | prpubid | oid | | not null | prrelid | oid | | not null | Indexes: "pg_publication_rel_oid_index" UNIQUE, btree (oid) "pg_publication_rel_prrelid_prpubid_index" UNIQUE, btree (prrelid, prpubid) Index "pg_catalog.pg_publication_rel_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_publication_rel" Index "pg_catalog.pg_publication_rel_prrelid_prpubid_index" Column | Type | Key? | Definition ---------+------+------+------------ prrelid | oid | yes | prrelid prpubid | oid | yes | prpubid unique, btree, for table "pg_catalog.pg_publication_rel" View "pg_catalog.pg_publication_tables" Column | Type | Collation | Nullable | Default ------------+------+-----------+----------+--------- pubname | name | | | schemaname | name | | | tablename | name | | | Table "pg_catalog.pg_range" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- rngtypid | oid | | not null | rngsubtype | oid | | not null | rngcollation | oid | | not null | rngsubopc | oid | | not null | rngcanonical | regproc | | not null | rngsubdiff | regproc | | not null | Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid) Index "pg_catalog.pg_range_rngtypid_index" Column | Type | Key? | Definition ----------+------+------+------------ rngtypid | oid | yes | rngtypid unique, btree, for table "pg_catalog.pg_range" Table "pg_catalog.pg_replication_origin" Column | Type | Collation | Nullable | Default ---------+------+-----------+----------+--------- roident | oid | | not null | roname | text | C | not null | Indexes: "pg_replication_origin_roiident_index" UNIQUE, btree (roident), tablespace "pg_global" "pg_replication_origin_roname_index" UNIQUE, btree (roname), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_replication_origin_roiident_index" Column | Type | Key? | Definition ---------+------+------+------------ roident | oid | yes | roident unique, btree, for table "pg_catalog.pg_replication_origin" Tablespace: "pg_global" Index "pg_catalog.pg_replication_origin_roname_index" Column | Type | Key? | Definition --------+------+------+------------ roname | text | yes | roname unique, btree, for table "pg_catalog.pg_replication_origin" Tablespace: "pg_global" View "pg_catalog.pg_replication_origin_status" Column | Type | Collation | Nullable | Default -------------+--------+-----------+----------+--------- local_id | oid | | | external_id | text | | | remote_lsn | pg_lsn | | | local_lsn | pg_lsn | | | View "pg_catalog.pg_replication_slots" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- slot_name | name | | | plugin | name | | | slot_type | text | | | datoid | oid | | | database | name | | | temporary | boolean | | | active | boolean | | | active_pid | integer | | | xmin | xid | | | catalog_xmin | xid | | | restart_lsn | pg_lsn | | | confirmed_flush_lsn | pg_lsn | | | Table "pg_catalog.pg_rewrite" Column | Type | Collation | Nullable | Default ------------+--------------+-----------+----------+--------- oid | oid | | not null | rulename | name | | not null | ev_class | oid | | not null | ev_type | "char" | | not null | ev_enabled | "char" | | not null | is_instead | boolean | | not null | ev_qual | pg_node_tree | C | not null | ev_action | pg_node_tree | C | not null | Indexes: "pg_rewrite_oid_index" UNIQUE, btree (oid) "pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename) Index "pg_catalog.pg_rewrite_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_rewrite" Index "pg_catalog.pg_rewrite_rel_rulename_index" Column | Type | Key? | Definition ----------+---------+------+------------ ev_class | oid | yes | ev_class rulename | cstring | yes | rulename unique, btree, for table "pg_catalog.pg_rewrite" View "pg_catalog.pg_roles" Column | Type | Collation | Nullable | Default ----------------+--------------------------+-----------+----------+--------- rolname | name | | | rolsuper | boolean | | | rolinherit | boolean | | | rolcreaterole | boolean | | | rolcreatedb | boolean | | | rolcanlogin | boolean | | | rolreplication | boolean | | | rolconnlimit | integer | | | rolpassword | text | | | rolvaliduntil | timestamp with time zone | | | rolbypassrls | boolean | | | rolconfig | text[] | C | | oid | oid | | | View "pg_catalog.pg_rules" Column | Type | Collation | Nullable | Default ------------+------+-----------+----------+--------- schemaname | name | | | tablename | name | | | rulename | name | | | definition | text | | | Table "pg_catalog.pg_seclabel" Column | Type | Collation | Nullable | Default ----------+---------+-----------+----------+--------- objoid | oid | | not null | classoid | oid | | not null | objsubid | integer | | not null | provider | text | C | not null | label | text | C | not null | Indexes: "pg_seclabel_object_index" UNIQUE, btree (objoid, classoid, objsubid, provider) Index "pg_catalog.pg_seclabel_object_index" Column | Type | Key? | Definition ----------+---------+------+------------ objoid | oid | yes | objoid classoid | oid | yes | classoid objsubid | integer | yes | objsubid provider | text | yes | provider unique, btree, for table "pg_catalog.pg_seclabel" View "pg_catalog.pg_seclabels" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- objoid | oid | | | classoid | oid | | | objsubid | integer | | | objtype | text | | | objnamespace | oid | | | objname | text | C | | provider | text | C | | label | text | C | | Table "pg_catalog.pg_sequence" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- seqrelid | oid | | not null | seqtypid | oid | | not null | seqstart | bigint | | not null | seqincrement | bigint | | not null | seqmax | bigint | | not null | seqmin | bigint | | not null | seqcache | bigint | | not null | seqcycle | boolean | | not null | Indexes: "pg_sequence_seqrelid_index" UNIQUE, btree (seqrelid) Index "pg_catalog.pg_sequence_seqrelid_index" Column | Type | Key? | Definition ----------+------+------+------------ seqrelid | oid | yes | seqrelid unique, btree, for table "pg_catalog.pg_sequence" View "pg_catalog.pg_sequences" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- schemaname | name | | | sequencename | name | | | sequenceowner | name | | | data_type | regtype | | | start_value | bigint | | | min_value | bigint | | | max_value | bigint | | | increment_by | bigint | | | cycle | boolean | | | cache_size | bigint | | | last_value | bigint | | | View "pg_catalog.pg_settings" Column | Type | Collation | Nullable | Default -----------------+---------+-----------+----------+--------- name | text | | | setting | text | | | unit | text | | | category | text | | | short_desc | text | | | extra_desc | text | | | context | text | | | vartype | text | | | source | text | | | min_val | text | | | max_val | text | | | enumvals | text[] | | | boot_val | text | | | reset_val | text | | | sourcefile | text | | | sourceline | integer | | | pending_restart | boolean | | | View "pg_catalog.pg_shadow" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+--------- usename | name | | | usesysid | oid | | | usecreatedb | boolean | | | usesuper | boolean | | | userepl | boolean | | | usebypassrls | boolean | | | passwd | text | C | | valuntil | timestamp with time zone | | | useconfig | text[] | C | | Table "pg_catalog.pg_shdepend" Column | Type | Collation | Nullable | Default ------------+---------+-----------+----------+--------- dbid | oid | | not null | classid | oid | | not null | objid | oid | | not null | objsubid | integer | | not null | refclassid | oid | | not null | refobjid | oid | | not null | deptype | "char" | | not null | Indexes: "pg_shdepend_depender_index" btree (dbid, classid, objid, objsubid), tablespace "pg_global" "pg_shdepend_reference_index" btree (refclassid, refobjid), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_shdepend_depender_index" Column | Type | Key? | Definition ----------+---------+------+------------ dbid | oid | yes | dbid classid | oid | yes | classid objid | oid | yes | objid objsubid | integer | yes | objsubid btree, for table "pg_catalog.pg_shdepend" Tablespace: "pg_global" Index "pg_catalog.pg_shdepend_reference_index" Column | Type | Key? | Definition ------------+------+------+------------ refclassid | oid | yes | refclassid refobjid | oid | yes | refobjid btree, for table "pg_catalog.pg_shdepend" Tablespace: "pg_global" Table "pg_catalog.pg_shdescription" Column | Type | Collation | Nullable | Default -------------+------+-----------+----------+--------- objoid | oid | | not null | classoid | oid | | not null | description | text | C | not null | Indexes: "pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_shdescription_o_c_index" Column | Type | Key? | Definition ----------+------+------+------------ objoid | oid | yes | objoid classoid | oid | yes | classoid unique, btree, for table "pg_catalog.pg_shdescription" Tablespace: "pg_global" Table "pg_catalog.pg_shseclabel" Column | Type | Collation | Nullable | Default ----------+------+-----------+----------+--------- objoid | oid | | not null | classoid | oid | | not null | provider | text | C | not null | label | text | C | not null | Indexes: "pg_shseclabel_object_index" UNIQUE, btree (objoid, classoid, provider), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_shseclabel_object_index" Column | Type | Key? | Definition ----------+------+------+------------ objoid | oid | yes | objoid classoid | oid | yes | classoid provider | text | yes | provider unique, btree, for table "pg_catalog.pg_shseclabel" Tablespace: "pg_global" View "pg_catalog.pg_stat_activity" Column | Type | Collation | Nullable | Default ------------------+--------------------------+-----------+----------+--------- datid | oid | | | datname | name | | | pid | integer | | | usesysid | oid | | | usename | name | | | application_name | text | | | client_addr | inet | | | client_hostname | text | | | client_port | integer | | | backend_start | timestamp with time zone | | | xact_start | timestamp with time zone | | | query_start | timestamp with time zone | | | state_change | timestamp with time zone | | | wait_event_type | text | | | wait_event | text | | | state | text | | | backend_xid | xid | | | backend_xmin | xid | | | query | text | | | backend_type | text | | | View "pg_catalog.pg_stat_all_indexes" Column | Type | Collation | Nullable | Default ---------------+--------+-----------+----------+--------- relid | oid | | | indexrelid | oid | | | schemaname | name | | | relname | name | | | indexrelname | name | | | idx_scan | bigint | | | idx_tup_read | bigint | | | idx_tup_fetch | bigint | | | View "pg_catalog.pg_stat_all_tables" Column | Type | Collation | Nullable | Default ---------------------+--------------------------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | seq_scan | bigint | | | seq_tup_read | bigint | | | idx_scan | bigint | | | idx_tup_fetch | bigint | | | n_tup_ins | bigint | | | n_tup_upd | bigint | | | n_tup_del | bigint | | | n_tup_hot_upd | bigint | | | n_live_tup | bigint | | | n_dead_tup | bigint | | | n_mod_since_analyze | bigint | | | last_vacuum | timestamp with time zone | | | last_autovacuum | timestamp with time zone | | | last_analyze | timestamp with time zone | | | last_autoanalyze | timestamp with time zone | | | vacuum_count | bigint | | | autovacuum_count | bigint | | | analyze_count | bigint | | | autoanalyze_count | bigint | | | View "pg_catalog.pg_stat_archiver" Column | Type | Collation | Nullable | Default --------------------+--------------------------+-----------+----------+--------- archived_count | bigint | | | last_archived_wal | text | | | last_archived_time | timestamp with time zone | | | failed_count | bigint | | | last_failed_wal | text | | | last_failed_time | timestamp with time zone | | | stats_reset | timestamp with time zone | | | View "pg_catalog.pg_stat_bgwriter" Column | Type | Collation | Nullable | Default -----------------------+--------------------------+-----------+----------+--------- checkpoints_timed | bigint | | | checkpoints_req | bigint | | | checkpoint_write_time | double precision | | | checkpoint_sync_time | double precision | | | buffers_checkpoint | bigint | | | buffers_clean | bigint | | | maxwritten_clean | bigint | | | buffers_backend | bigint | | | buffers_backend_fsync | bigint | | | buffers_alloc | bigint | | | stats_reset | timestamp with time zone | | | View "pg_catalog.pg_stat_database" Column | Type | Collation | Nullable | Default -----------------------+--------------------------+-----------+----------+--------- datid | oid | | | datname | name | | | numbackends | integer | | | xact_commit | bigint | | | xact_rollback | bigint | | | blks_read | bigint | | | blks_hit | bigint | | | tup_returned | bigint | | | tup_fetched | bigint | | | tup_inserted | bigint | | | tup_updated | bigint | | | tup_deleted | bigint | | | conflicts | bigint | | | temp_files | bigint | | | temp_bytes | bigint | | | deadlocks | bigint | | | checksum_failures | bigint | | | checksum_last_failure | timestamp with time zone | | | blk_read_time | double precision | | | blk_write_time | double precision | | | stats_reset | timestamp with time zone | | | View "pg_catalog.pg_stat_database_conflicts" Column | Type | Collation | Nullable | Default ------------------+--------+-----------+----------+--------- datid | oid | | | datname | name | | | confl_tablespace | bigint | | | confl_lock | bigint | | | confl_snapshot | bigint | | | confl_bufferpin | bigint | | | confl_deadlock | bigint | | | View "pg_catalog.pg_stat_gssapi" Column | Type | Collation | Nullable | Default -------------------+---------+-----------+----------+--------- pid | integer | | | gss_authenticated | boolean | | | principal | text | | | encrypted | boolean | | | View "pg_catalog.pg_stat_progress_cluster" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- pid | integer | | | datid | oid | | | datname | name | | | relid | oid | | | command | text | | | phase | text | | | cluster_index_relid | oid | | | heap_tuples_scanned | bigint | | | heap_tuples_written | bigint | | | heap_blks_total | bigint | | | heap_blks_scanned | bigint | | | index_rebuild_count | bigint | | | View "pg_catalog.pg_stat_progress_create_index" Column | Type | Collation | Nullable | Default --------------------+---------+-----------+----------+--------- pid | integer | | | datid | oid | | | datname | name | | | relid | oid | | | index_relid | oid | | | command | text | | | phase | text | | | lockers_total | bigint | | | lockers_done | bigint | | | current_locker_pid | bigint | | | blocks_total | bigint | | | blocks_done | bigint | | | tuples_total | bigint | | | tuples_done | bigint | | | partitions_total | bigint | | | partitions_done | bigint | | | View "pg_catalog.pg_stat_progress_vacuum" Column | Type | Collation | Nullable | Default --------------------+---------+-----------+----------+--------- pid | integer | | | datid | oid | | | datname | name | | | relid | oid | | | phase | text | | | heap_blks_total | bigint | | | heap_blks_scanned | bigint | | | heap_blks_vacuumed | bigint | | | index_vacuum_count | bigint | | | max_dead_tuples | bigint | | | num_dead_tuples | bigint | | | View "pg_catalog.pg_stat_replication" Column | Type | Collation | Nullable | Default ------------------+--------------------------+-----------+----------+--------- pid | integer | | | usesysid | oid | | | usename | name | | | application_name | text | | | client_addr | inet | | | client_hostname | text | | | client_port | integer | | | backend_start | timestamp with time zone | | | backend_xmin | xid | | | state | text | | | sent_lsn | pg_lsn | | | write_lsn | pg_lsn | | | flush_lsn | pg_lsn | | | replay_lsn | pg_lsn | | | write_lag | interval | | | flush_lag | interval | | | replay_lag | interval | | | sync_priority | integer | | | sync_state | text | | | reply_time | timestamp with time zone | | | View "pg_catalog.pg_stat_ssl" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- pid | integer | | | ssl | boolean | | | version | text | | | cipher | text | | | bits | integer | | | compression | boolean | | | client_dn | text | | | client_serial | numeric | | | issuer_dn | text | | | View "pg_catalog.pg_stat_subscription" Column | Type | Collation | Nullable | Default -----------------------+--------------------------+-----------+----------+--------- subid | oid | | | subname | name | | | pid | integer | | | relid | oid | | | received_lsn | pg_lsn | | | last_msg_send_time | timestamp with time zone | | | last_msg_receipt_time | timestamp with time zone | | | latest_end_lsn | pg_lsn | | | latest_end_time | timestamp with time zone | | | View "pg_catalog.pg_stat_sys_indexes" Column | Type | Collation | Nullable | Default ---------------+--------+-----------+----------+--------- relid | oid | | | indexrelid | oid | | | schemaname | name | | | relname | name | | | indexrelname | name | | | idx_scan | bigint | | | idx_tup_read | bigint | | | idx_tup_fetch | bigint | | | View "pg_catalog.pg_stat_sys_tables" Column | Type | Collation | Nullable | Default ---------------------+--------------------------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | seq_scan | bigint | | | seq_tup_read | bigint | | | idx_scan | bigint | | | idx_tup_fetch | bigint | | | n_tup_ins | bigint | | | n_tup_upd | bigint | | | n_tup_del | bigint | | | n_tup_hot_upd | bigint | | | n_live_tup | bigint | | | n_dead_tup | bigint | | | n_mod_since_analyze | bigint | | | last_vacuum | timestamp with time zone | | | last_autovacuum | timestamp with time zone | | | last_analyze | timestamp with time zone | | | last_autoanalyze | timestamp with time zone | | | vacuum_count | bigint | | | autovacuum_count | bigint | | | analyze_count | bigint | | | autoanalyze_count | bigint | | | View "pg_catalog.pg_stat_user_functions" Column | Type | Collation | Nullable | Default ------------+------------------+-----------+----------+--------- funcid | oid | | | schemaname | name | | | funcname | name | | | calls | bigint | | | total_time | double precision | | | self_time | double precision | | | View "pg_catalog.pg_stat_user_indexes" Column | Type | Collation | Nullable | Default ---------------+--------+-----------+----------+--------- relid | oid | | | indexrelid | oid | | | schemaname | name | | | relname | name | | | indexrelname | name | | | idx_scan | bigint | | | idx_tup_read | bigint | | | idx_tup_fetch | bigint | | | View "pg_catalog.pg_stat_user_tables" Column | Type | Collation | Nullable | Default ---------------------+--------------------------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | seq_scan | bigint | | | seq_tup_read | bigint | | | idx_scan | bigint | | | idx_tup_fetch | bigint | | | n_tup_ins | bigint | | | n_tup_upd | bigint | | | n_tup_del | bigint | | | n_tup_hot_upd | bigint | | | n_live_tup | bigint | | | n_dead_tup | bigint | | | n_mod_since_analyze | bigint | | | last_vacuum | timestamp with time zone | | | last_autovacuum | timestamp with time zone | | | last_analyze | timestamp with time zone | | | last_autoanalyze | timestamp with time zone | | | vacuum_count | bigint | | | autovacuum_count | bigint | | | analyze_count | bigint | | | autoanalyze_count | bigint | | | View "pg_catalog.pg_stat_wal_receiver" Column | Type | Collation | Nullable | Default -----------------------+--------------------------+-----------+----------+--------- pid | integer | | | status | text | | | receive_start_lsn | pg_lsn | | | receive_start_tli | integer | | | received_lsn | pg_lsn | | | received_tli | integer | | | last_msg_send_time | timestamp with time zone | | | last_msg_receipt_time | timestamp with time zone | | | latest_end_lsn | pg_lsn | | | latest_end_time | timestamp with time zone | | | slot_name | text | | | sender_host | text | | | sender_port | integer | | | conninfo | text | | | View "pg_catalog.pg_stat_xact_all_tables" Column | Type | Collation | Nullable | Default ---------------+--------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | seq_scan | bigint | | | seq_tup_read | bigint | | | idx_scan | bigint | | | idx_tup_fetch | bigint | | | n_tup_ins | bigint | | | n_tup_upd | bigint | | | n_tup_del | bigint | | | n_tup_hot_upd | bigint | | | View "pg_catalog.pg_stat_xact_sys_tables" Column | Type | Collation | Nullable | Default ---------------+--------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | seq_scan | bigint | | | seq_tup_read | bigint | | | idx_scan | bigint | | | idx_tup_fetch | bigint | | | n_tup_ins | bigint | | | n_tup_upd | bigint | | | n_tup_del | bigint | | | n_tup_hot_upd | bigint | | | View "pg_catalog.pg_stat_xact_user_functions" Column | Type | Collation | Nullable | Default ------------+------------------+-----------+----------+--------- funcid | oid | | | schemaname | name | | | funcname | name | | | calls | bigint | | | total_time | double precision | | | self_time | double precision | | | View "pg_catalog.pg_stat_xact_user_tables" Column | Type | Collation | Nullable | Default ---------------+--------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | seq_scan | bigint | | | seq_tup_read | bigint | | | idx_scan | bigint | | | idx_tup_fetch | bigint | | | n_tup_ins | bigint | | | n_tup_upd | bigint | | | n_tup_del | bigint | | | n_tup_hot_upd | bigint | | | View "pg_catalog.pg_statio_all_indexes" Column | Type | Collation | Nullable | Default ---------------+--------+-----------+----------+--------- relid | oid | | | indexrelid | oid | | | schemaname | name | | | relname | name | | | indexrelname | name | | | idx_blks_read | bigint | | | idx_blks_hit | bigint | | | View "pg_catalog.pg_statio_all_sequences" Column | Type | Collation | Nullable | Default ------------+--------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | blks_read | bigint | | | blks_hit | bigint | | | View "pg_catalog.pg_statio_all_tables" Column | Type | Collation | Nullable | Default -----------------+--------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | heap_blks_read | bigint | | | heap_blks_hit | bigint | | | idx_blks_read | bigint | | | idx_blks_hit | bigint | | | toast_blks_read | bigint | | | toast_blks_hit | bigint | | | tidx_blks_read | bigint | | | tidx_blks_hit | bigint | | | View "pg_catalog.pg_statio_sys_indexes" Column | Type | Collation | Nullable | Default ---------------+--------+-----------+----------+--------- relid | oid | | | indexrelid | oid | | | schemaname | name | | | relname | name | | | indexrelname | name | | | idx_blks_read | bigint | | | idx_blks_hit | bigint | | | View "pg_catalog.pg_statio_sys_sequences" Column | Type | Collation | Nullable | Default ------------+--------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | blks_read | bigint | | | blks_hit | bigint | | | View "pg_catalog.pg_statio_sys_tables" Column | Type | Collation | Nullable | Default -----------------+--------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | heap_blks_read | bigint | | | heap_blks_hit | bigint | | | idx_blks_read | bigint | | | idx_blks_hit | bigint | | | toast_blks_read | bigint | | | toast_blks_hit | bigint | | | tidx_blks_read | bigint | | | tidx_blks_hit | bigint | | | View "pg_catalog.pg_statio_user_indexes" Column | Type | Collation | Nullable | Default ---------------+--------+-----------+----------+--------- relid | oid | | | indexrelid | oid | | | schemaname | name | | | relname | name | | | indexrelname | name | | | idx_blks_read | bigint | | | idx_blks_hit | bigint | | | View "pg_catalog.pg_statio_user_sequences" Column | Type | Collation | Nullable | Default ------------+--------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | blks_read | bigint | | | blks_hit | bigint | | | View "pg_catalog.pg_statio_user_tables" Column | Type | Collation | Nullable | Default -----------------+--------+-----------+----------+--------- relid | oid | | | schemaname | name | | | relname | name | | | heap_blks_read | bigint | | | heap_blks_hit | bigint | | | idx_blks_read | bigint | | | idx_blks_hit | bigint | | | toast_blks_read | bigint | | | toast_blks_hit | bigint | | | tidx_blks_read | bigint | | | tidx_blks_hit | bigint | | | Table "pg_catalog.pg_statistic" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+--------- starelid | oid | | not null | staattnum | smallint | | not null | stainherit | boolean | | not null | stanullfrac | real | | not null | stawidth | integer | | not null | stadistinct | real | | not null | stakind1 | smallint | | not null | stakind2 | smallint | | not null | stakind3 | smallint | | not null | stakind4 | smallint | | not null | stakind5 | smallint | | not null | staop1 | oid | | not null | staop2 | oid | | not null | staop3 | oid | | not null | staop4 | oid | | not null | staop5 | oid | | not null | stacoll1 | oid | | not null | stacoll2 | oid | | not null | stacoll3 | oid | | not null | stacoll4 | oid | | not null | stacoll5 | oid | | not null | stanumbers1 | real[] | | | stanumbers2 | real[] | | | stanumbers3 | real[] | | | stanumbers4 | real[] | | | stanumbers5 | real[] | | | stavalues1 | anyarray | | | stavalues2 | anyarray | | | stavalues3 | anyarray | | | stavalues4 | anyarray | | | stavalues5 | anyarray | | | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit) Table "pg_catalog.pg_statistic_ext" Column | Type | Collation | Nullable | Default --------------+------------+-----------+----------+--------- oid | oid | | not null | stxrelid | oid | | not null | stxname | name | | not null | stxnamespace | oid | | not null | stxowner | oid | | not null | stxkeys | int2vector | | not null | stxkind | "char"[] | | not null | Indexes: "pg_statistic_ext_name_index" UNIQUE, btree (stxname, stxnamespace) "pg_statistic_ext_oid_index" UNIQUE, btree (oid) "pg_statistic_ext_relid_index" btree (stxrelid) Table "pg_catalog.pg_statistic_ext_data" Column | Type | Collation | Nullable | Default ------------------+-----------------+-----------+----------+--------- stxoid | oid | | not null | stxdndistinct | pg_ndistinct | C | | stxddependencies | pg_dependencies | C | | stxdmcv | pg_mcv_list | C | | Indexes: "pg_statistic_ext_data_stxoid_index" UNIQUE, btree (stxoid) Index "pg_catalog.pg_statistic_ext_data_stxoid_index" Column | Type | Key? | Definition --------+------+------+------------ stxoid | oid | yes | stxoid unique, btree, for table "pg_catalog.pg_statistic_ext_data" Index "pg_catalog.pg_statistic_ext_name_index" Column | Type | Key? | Definition --------------+---------+------+-------------- stxname | cstring | yes | stxname stxnamespace | oid | yes | stxnamespace unique, btree, for table "pg_catalog.pg_statistic_ext" Index "pg_catalog.pg_statistic_ext_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_statistic_ext" Index "pg_catalog.pg_statistic_ext_relid_index" Column | Type | Key? | Definition ----------+------+------+------------ stxrelid | oid | yes | stxrelid btree, for table "pg_catalog.pg_statistic_ext" Index "pg_catalog.pg_statistic_relid_att_inh_index" Column | Type | Key? | Definition ------------+----------+------+------------ starelid | oid | yes | starelid staattnum | smallint | yes | staattnum stainherit | boolean | yes | stainherit unique, btree, for table "pg_catalog.pg_statistic" View "pg_catalog.pg_stats" Column | Type | Collation | Nullable | Default ------------------------+----------+-----------+----------+--------- schemaname | name | | | tablename | name | | | attname | name | | | inherited | boolean | | | null_frac | real | | | avg_width | integer | | | n_distinct | real | | | most_common_vals | anyarray | | | most_common_freqs | real[] | | | histogram_bounds | anyarray | | | correlation | real | | | most_common_elems | anyarray | | | most_common_elem_freqs | real[] | | | elem_count_histogram | real[] | | | View "pg_catalog.pg_stats_ext" Column | Type | Collation | Nullable | Default ------------------------+--------------------+-----------+----------+--------- schemaname | name | | | tablename | name | | | statistics_schemaname | name | | | statistics_name | name | | | statistics_owner | name | | | attnames | name[] | | | kinds | "char"[] | | | n_distinct | pg_ndistinct | C | | dependencies | pg_dependencies | C | | most_common_vals | text[] | | | most_common_val_nulls | boolean[] | | | most_common_freqs | double precision[] | | | most_common_base_freqs | double precision[] | | | Table "pg_catalog.pg_subscription" Column | Type | Collation | Nullable | Default -----------------+---------+-----------+----------+--------- oid | oid | | not null | subdbid | oid | | not null | subname | name | | not null | subowner | oid | | not null | subenabled | boolean | | not null | subconninfo | text | C | not null | subslotname | name | | not null | subsynccommit | text | C | not null | subpublications | text[] | C | not null | Indexes: "pg_subscription_oid_index" UNIQUE, btree (oid), tablespace "pg_global" "pg_subscription_subname_index" UNIQUE, btree (subdbid, subname), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_subscription_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_subscription" Tablespace: "pg_global" Table "pg_catalog.pg_subscription_rel" Column | Type | Collation | Nullable | Default ------------+--------+-----------+----------+--------- srsubid | oid | | not null | srrelid | oid | | not null | srsubstate | "char" | | not null | srsublsn | pg_lsn | | not null | Indexes: "pg_subscription_rel_srrelid_srsubid_index" UNIQUE, btree (srrelid, srsubid) Index "pg_catalog.pg_subscription_rel_srrelid_srsubid_index" Column | Type | Key? | Definition ---------+------+------+------------ srrelid | oid | yes | srrelid srsubid | oid | yes | srsubid unique, btree, for table "pg_catalog.pg_subscription_rel" Index "pg_catalog.pg_subscription_subname_index" Column | Type | Key? | Definition ---------+---------+------+------------ subdbid | oid | yes | subdbid subname | cstring | yes | subname unique, btree, for table "pg_catalog.pg_subscription" Tablespace: "pg_global" View "pg_catalog.pg_tables" Column | Type | Collation | Nullable | Default -------------+---------+-----------+----------+--------- schemaname | name | | | tablename | name | | | tableowner | name | | | tablespace | name | | | hasindexes | boolean | | | hasrules | boolean | | | hastriggers | boolean | | | rowsecurity | boolean | | | Table "pg_catalog.pg_tablespace" Column | Type | Collation | Nullable | Default ------------+-----------+-----------+----------+--------- oid | oid | | not null | spcname | name | | not null | spcowner | oid | | not null | spcacl | aclitem[] | | | spcoptions | text[] | C | | Indexes: "pg_tablespace_oid_index" UNIQUE, btree (oid), tablespace "pg_global" "pg_tablespace_spcname_index" UNIQUE, btree (spcname), tablespace "pg_global" Tablespace: "pg_global" Index "pg_catalog.pg_tablespace_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_tablespace" Tablespace: "pg_global" Index "pg_catalog.pg_tablespace_spcname_index" Column | Type | Key? | Definition ---------+---------+------+------------ spcname | cstring | yes | spcname unique, btree, for table "pg_catalog.pg_tablespace" Tablespace: "pg_global" View "pg_catalog.pg_timezone_abbrevs" Column | Type | Collation | Nullable | Default ------------+----------+-----------+----------+--------- abbrev | text | | | utc_offset | interval | | | is_dst | boolean | | | View "pg_catalog.pg_timezone_names" Column | Type | Collation | Nullable | Default ------------+----------+-----------+----------+--------- name | text | | | abbrev | text | | | utc_offset | interval | | | is_dst | boolean | | | Table "pg_catalog.pg_transform" Column | Type | Collation | Nullable | Default ------------+---------+-----------+----------+--------- oid | oid | | not null | trftype | oid | | not null | trflang | oid | | not null | trffromsql | regproc | | not null | trftosql | regproc | | not null | Indexes: "pg_transform_oid_index" UNIQUE, btree (oid) "pg_transform_type_lang_index" UNIQUE, btree (trftype, trflang) Index "pg_catalog.pg_transform_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_transform" Index "pg_catalog.pg_transform_type_lang_index" Column | Type | Key? | Definition ---------+------+------+------------ trftype | oid | yes | trftype trflang | oid | yes | trflang unique, btree, for table "pg_catalog.pg_transform" Table "pg_catalog.pg_trigger" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | tgrelid | oid | | not null | tgname | name | | not null | tgfoid | oid | | not null | tgtype | smallint | | not null | tgenabled | "char" | | not null | tgisinternal | boolean | | not null | tgconstrrelid | oid | | not null | tgconstrindid | oid | | not null | tgconstraint | oid | | not null | tgdeferrable | boolean | | not null | tginitdeferred | boolean | | not null | tgnargs | smallint | | not null | tgattr | int2vector | | not null | tgargs | bytea | | not null | tgqual | pg_node_tree | C | | tgoldtable | name | | | tgnewtable | name | | | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint) Index "pg_catalog.pg_trigger_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_trigger" Index "pg_catalog.pg_trigger_tgconstraint_index" Column | Type | Key? | Definition --------------+------+------+-------------- tgconstraint | oid | yes | tgconstraint btree, for table "pg_catalog.pg_trigger" Index "pg_catalog.pg_trigger_tgrelid_tgname_index" Column | Type | Key? | Definition ---------+---------+------+------------ tgrelid | oid | yes | tgrelid tgname | cstring | yes | tgname unique, btree, for table "pg_catalog.pg_trigger" Table "pg_catalog.pg_ts_config" Column | Type | Collation | Nullable | Default --------------+------+-----------+----------+--------- oid | oid | | not null | cfgname | name | | not null | cfgnamespace | oid | | not null | cfgowner | oid | | not null | cfgparser | oid | | not null | Indexes: "pg_ts_config_cfgname_index" UNIQUE, btree (cfgname, cfgnamespace) "pg_ts_config_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_ts_config_cfgname_index" Column | Type | Key? | Definition --------------+---------+------+-------------- cfgname | cstring | yes | cfgname cfgnamespace | oid | yes | cfgnamespace unique, btree, for table "pg_catalog.pg_ts_config" Table "pg_catalog.pg_ts_config_map" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- mapcfg | oid | | not null | maptokentype | integer | | not null | mapseqno | integer | | not null | mapdict | oid | | not null | Indexes: "pg_ts_config_map_index" UNIQUE, btree (mapcfg, maptokentype, mapseqno) Index "pg_catalog.pg_ts_config_map_index" Column | Type | Key? | Definition --------------+---------+------+-------------- mapcfg | oid | yes | mapcfg maptokentype | integer | yes | maptokentype mapseqno | integer | yes | mapseqno unique, btree, for table "pg_catalog.pg_ts_config_map" Index "pg_catalog.pg_ts_config_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_ts_config" Table "pg_catalog.pg_ts_dict" Column | Type | Collation | Nullable | Default ----------------+------+-----------+----------+--------- oid | oid | | not null | dictname | name | | not null | dictnamespace | oid | | not null | dictowner | oid | | not null | dicttemplate | oid | | not null | dictinitoption | text | C | | Indexes: "pg_ts_dict_dictname_index" UNIQUE, btree (dictname, dictnamespace) "pg_ts_dict_oid_index" UNIQUE, btree (oid) Index "pg_catalog.pg_ts_dict_dictname_index" Column | Type | Key? | Definition ---------------+---------+------+--------------- dictname | cstring | yes | dictname dictnamespace | oid | yes | dictnamespace unique, btree, for table "pg_catalog.pg_ts_dict" Index "pg_catalog.pg_ts_dict_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_ts_dict" Table "pg_catalog.pg_ts_parser" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | prsname | name | | not null | prsnamespace | oid | | not null | prsstart | regproc | | not null | prstoken | regproc | | not null | prsend | regproc | | not null | prsheadline | regproc | | not null | prslextype | regproc | | not null | Indexes: "pg_ts_parser_oid_index" UNIQUE, btree (oid) "pg_ts_parser_prsname_index" UNIQUE, btree (prsname, prsnamespace) Index "pg_catalog.pg_ts_parser_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_ts_parser" Index "pg_catalog.pg_ts_parser_prsname_index" Column | Type | Key? | Definition --------------+---------+------+-------------- prsname | cstring | yes | prsname prsnamespace | oid | yes | prsnamespace unique, btree, for table "pg_catalog.pg_ts_parser" Table "pg_catalog.pg_ts_template" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- oid | oid | | not null | tmplname | name | | not null | tmplnamespace | oid | | not null | tmplinit | regproc | | not null | tmpllexize | regproc | | not null | Indexes: "pg_ts_template_oid_index" UNIQUE, btree (oid) "pg_ts_template_tmplname_index" UNIQUE, btree (tmplname, tmplnamespace) Index "pg_catalog.pg_ts_template_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_ts_template" Index "pg_catalog.pg_ts_template_tmplname_index" Column | Type | Key? | Definition ---------------+---------+------+--------------- tmplname | cstring | yes | tmplname tmplnamespace | oid | yes | tmplnamespace unique, btree, for table "pg_catalog.pg_ts_template" Table "pg_catalog.pg_type" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | typname | name | | not null | typnamespace | oid | | not null | typowner | oid | | not null | typlen | smallint | | not null | typbyval | boolean | | not null | typtype | "char" | | not null | typcategory | "char" | | not null | typispreferred | boolean | | not null | typisdefined | boolean | | not null | typdelim | "char" | | not null | typrelid | oid | | not null | typelem | oid | | not null | typarray | oid | | not null | typinput | regproc | | not null | typoutput | regproc | | not null | typreceive | regproc | | not null | typsend | regproc | | not null | typmodin | regproc | | not null | typmodout | regproc | | not null | typanalyze | regproc | | not null | typalign | "char" | | not null | typstorage | "char" | | not null | typnotnull | boolean | | not null | typbasetype | oid | | not null | typtypmod | integer | | not null | typndims | integer | | not null | typcollation | oid | | not null | typdefaultbin | pg_node_tree | C | | typdefault | text | C | | typacl | aclitem[] | | | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace) Index "pg_catalog.pg_type_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_type" Index "pg_catalog.pg_type_typname_nsp_index" Column | Type | Key? | Definition --------------+---------+------+-------------- typname | cstring | yes | typname typnamespace | oid | yes | typnamespace unique, btree, for table "pg_catalog.pg_type" View "pg_catalog.pg_user" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+--------- usename | name | | | usesysid | oid | | | usecreatedb | boolean | | | usesuper | boolean | | | userepl | boolean | | | usebypassrls | boolean | | | passwd | text | | | valuntil | timestamp with time zone | | | useconfig | text[] | C | | Table "pg_catalog.pg_user_mapping" Column | Type | Collation | Nullable | Default -----------+--------+-----------+----------+--------- oid | oid | | not null | umuser | oid | | not null | umserver | oid | | not null | umoptions | text[] | C | | Indexes: "pg_user_mapping_oid_index" UNIQUE, btree (oid) "pg_user_mapping_user_server_index" UNIQUE, btree (umuser, umserver) Index "pg_catalog.pg_user_mapping_oid_index" Column | Type | Key? | Definition --------+------+------+------------ oid | oid | yes | oid unique, btree, for table "pg_catalog.pg_user_mapping" Index "pg_catalog.pg_user_mapping_user_server_index" Column | Type | Key? | Definition ----------+------+------+------------ umuser | oid | yes | umuser umserver | oid | yes | umserver unique, btree, for table "pg_catalog.pg_user_mapping" View "pg_catalog.pg_user_mappings" Column | Type | Collation | Nullable | Default -----------+--------+-----------+----------+--------- umid | oid | | | srvid | oid | | | srvname | name | | | umuser | oid | | | usename | name | | | umoptions | text[] | C | | View "pg_catalog.pg_views" Column | Type | Collation | Nullable | Default ------------+------+-----------+----------+--------- schemaname | name | | | viewname | name | | | viewowner | name | | | definition | text | | | Table "public.auth_group" Column | Type | Collation | Nullable | Default --------+-----------------------+-----------+----------+---------------------------------------- id | integer | | not null | nextval('auth_group_id_seq'::regclass) name | character varying(80) | | not null | Indexes: "auth_group_pkey" PRIMARY KEY, btree (id) "auth_group_name_key" UNIQUE CONSTRAINT, btree (name) Referenced by: TABLE "auth_user_groups" CONSTRAINT "auth_user_groups_group_id_fkey" FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED TABLE "auth_group_permissions" CONSTRAINT "group_id_refs_id_3cea63fe" FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED TABLE "front_user_groups" CONSTRAINT "group_id_refs_id_512273754467b2d6" FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED Sequence "public.auth_group_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.auth_group.id Index "public.auth_group_name_key" Column | Type | Key? | Definition --------+-----------------------+------+------------ name | character varying(80) | yes | name unique, btree, for table "public.auth_group" Table "public.auth_group_permissions" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+---------------------------------------------------- id | integer | | not null | nextval('auth_group_permissions_id_seq'::regclass) group_id | integer | | not null | permission_id | integer | | not null | Indexes: "auth_group_permissions_pkey" PRIMARY KEY, btree (id) "auth_group_permissions_group_id_permission_id_key" UNIQUE CONSTRAINT, btree (group_id, permission_id) "auth_group_permissions_group_id" btree (group_id) "auth_group_permissions_permission_id" btree (permission_id) Foreign-key constraints: "auth_group_permissions_permission_id_fkey" FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED "group_id_refs_id_3cea63fe" FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED Index "public.auth_group_permissions_group_id" Column | Type | Key? | Definition ----------+---------+------+------------ group_id | integer | yes | group_id btree, for table "public.auth_group_permissions" Index "public.auth_group_permissions_group_id_permission_id_key" Column | Type | Key? | Definition ---------------+---------+------+--------------- group_id | integer | yes | group_id permission_id | integer | yes | permission_id unique, btree, for table "public.auth_group_permissions" Sequence "public.auth_group_permissions_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.auth_group_permissions.id Index "public.auth_group_permissions_permission_id" Column | Type | Key? | Definition ---------------+---------+------+--------------- permission_id | integer | yes | permission_id btree, for table "public.auth_group_permissions" Index "public.auth_group_permissions_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.auth_group_permissions" Index "public.auth_group_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.auth_group" Table "public.auth_permission" Column | Type | Collation | Nullable | Default -----------------+------------------------+-----------+----------+--------------------------------------------- id | integer | | not null | nextval('auth_permission_id_seq'::regclass) name | character varying(50) | | not null | content_type_id | integer | | not null | codename | character varying(100) | | not null | Indexes: "auth_permission_pkey" PRIMARY KEY, btree (id) "auth_permission_content_type_id_codename_key" UNIQUE CONSTRAINT, btree (content_type_id, codename) "auth_permission_content_type_id" btree (content_type_id) Foreign-key constraints: "content_type_id_refs_id_728de91f" FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED Referenced by: TABLE "auth_group_permissions" CONSTRAINT "auth_group_permissions_permission_id_fkey" FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED TABLE "auth_user_user_permissions" CONSTRAINT "auth_user_user_permissions_permission_id_fkey" FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED TABLE "front_user_user_permissions" CONSTRAINT "permission_id_refs_id_7300c62098ec4b67" FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED Index "public.auth_permission_content_type_id" Column | Type | Key? | Definition -----------------+---------+------+----------------- content_type_id | integer | yes | content_type_id btree, for table "public.auth_permission" Index "public.auth_permission_content_type_id_codename_key" Column | Type | Key? | Definition -----------------+------------------------+------+----------------- content_type_id | integer | yes | content_type_id codename | character varying(100) | yes | codename unique, btree, for table "public.auth_permission" Sequence "public.auth_permission_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.auth_permission.id Index "public.auth_permission_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.auth_permission" Table "public.auth_user_groups" Column | Type | Collation | Nullable | Default ----------+---------+-----------+----------+---------------------------------------------- id | integer | | not null | nextval('auth_user_groups_id_seq'::regclass) user_id | integer | | not null | group_id | integer | | not null | Indexes: "auth_user_groups_pkey" PRIMARY KEY, btree (id) "auth_user_groups_user_id_group_id_key" UNIQUE CONSTRAINT, btree (user_id, group_id) "auth_user_groups_group_id" btree (group_id) "auth_user_groups_user_id" btree (user_id) Foreign-key constraints: "auth_user_groups_group_id_fkey" FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED Index "public.auth_user_groups_group_id" Column | Type | Key? | Definition ----------+---------+------+------------ group_id | integer | yes | group_id btree, for table "public.auth_user_groups" Sequence "public.auth_user_groups_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.auth_user_groups.id Index "public.auth_user_groups_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.auth_user_groups" Index "public.auth_user_groups_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.auth_user_groups" Index "public.auth_user_groups_user_id_group_id_key" Column | Type | Key? | Definition ----------+---------+------+------------ user_id | integer | yes | user_id group_id | integer | yes | group_id unique, btree, for table "public.auth_user_groups" Table "public.auth_user_user_permissions" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+-------------------------------------------------------- id | integer | | not null | nextval('auth_user_user_permissions_id_seq'::regclass) user_id | integer | | not null | permission_id | integer | | not null | Indexes: "auth_user_user_permissions_pkey" PRIMARY KEY, btree (id) "auth_user_user_permissions_user_id_permission_id_key" UNIQUE CONSTRAINT, btree (user_id, permission_id) "auth_user_user_permissions_permission_id" btree (permission_id) "auth_user_user_permissions_user_id" btree (user_id) Foreign-key constraints: "auth_user_user_permissions_permission_id_fkey" FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED Sequence "public.auth_user_user_permissions_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.auth_user_user_permissions.id Index "public.auth_user_user_permissions_permission_id" Column | Type | Key? | Definition ---------------+---------+------+--------------- permission_id | integer | yes | permission_id btree, for table "public.auth_user_user_permissions" Index "public.auth_user_user_permissions_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.auth_user_user_permissions" Index "public.auth_user_user_permissions_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.auth_user_user_permissions" Index "public.auth_user_user_permissions_user_id_permission_id_key" Column | Type | Key? | Definition ---------------+---------+------+--------------- user_id | integer | yes | user_id permission_id | integer | yes | permission_id unique, btree, for table "public.auth_user_user_permissions" Table "public.django_admin_log" Column | Type | Collation | Nullable | Default -----------------+--------------------------+-----------+----------+---------------------------------------------- id | integer | | not null | nextval('django_admin_log_id_seq'::regclass) action_time | timestamp with time zone | | not null | user_id | integer | | not null | content_type_id | integer | | | object_id | text | | | object_repr | character varying(200) | | not null | action_flag | smallint | | not null | change_message | text | | not null | Indexes: "django_admin_log_pkey" PRIMARY KEY, btree (id) "django_admin_log_content_type_id" btree (content_type_id) "django_admin_log_user_id" btree (user_id) Check constraints: "django_admin_log_action_flag_check" CHECK (action_flag >= 0) Foreign-key constraints: "django_admin_log_content_type_id_fkey" FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED "user_id_refs_id_26732827718cbe4" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Index "public.django_admin_log_content_type_id" Column | Type | Key? | Definition -----------------+---------+------+----------------- content_type_id | integer | yes | content_type_id btree, for table "public.django_admin_log" Sequence "public.django_admin_log_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.django_admin_log.id Index "public.django_admin_log_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.django_admin_log" Index "public.django_admin_log_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.django_admin_log" Table "public.django_content_type" Column | Type | Collation | Nullable | Default -----------+------------------------+-----------+----------+------------------------------------------------- id | integer | | not null | nextval('django_content_type_id_seq'::regclass) name | character varying(100) | | not null | app_label | character varying(100) | | not null | model | character varying(100) | | not null | Indexes: "django_content_type_pkey" PRIMARY KEY, btree (id) "django_content_type_app_label_model_key" UNIQUE CONSTRAINT, btree (app_label, model) Referenced by: TABLE "auth_permission" CONSTRAINT "content_type_id_refs_id_728de91f" FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED TABLE "django_admin_log" CONSTRAINT "django_admin_log_content_type_id_fkey" FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED Index "public.django_content_type_app_label_model_key" Column | Type | Key? | Definition -----------+------------------------+------+------------ app_label | character varying(100) | yes | app_label model | character varying(100) | yes | model unique, btree, for table "public.django_content_type" Sequence "public.django_content_type_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.django_content_type.id Index "public.django_content_type_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.django_content_type" Table "public.django_session" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+--------- session_key | character varying(40) | | not null | session_data | text | | not null | expire_date | timestamp with time zone | | not null | Indexes: "django_session_pkey" PRIMARY KEY, btree (session_key) "django_session_expire_date" btree (expire_date) Index "public.django_session_expire_date" Column | Type | Key? | Definition -------------+--------------------------+------+------------- expire_date | timestamp with time zone | yes | expire_date btree, for table "public.django_session" Index "public.django_session_pkey" Column | Type | Key? | Definition -------------+-----------------------+------+------------- session_key | character varying(40) | yes | session_key primary key, btree, for table "public.django_session" Table "public.documents_document" Column | Type | Collation | Nullable | Default -------------------+--------------------------+-----------+----------+------------------------------------------------ id | integer | | not null | nextval('documents_document_id_seq'::regclass) name | character varying(100) | | not null | description | text | | not null | document | character varying(500) | | not null | uploader_id | integer | | | upload_date | timestamp with time zone | | not null | category_id | integer | | | original_filename | character varying(255) | | not null | dtype | smallint | | not null | url | character varying(200) | | | change_date | timestamp with time zone | | not null | license | smallint | | | public | boolean | | not null | flattr_disabled | boolean | | not null | Indexes: "documents_document_pkey" PRIMARY KEY, btree (id) "documents_document_category_id" btree (category_id) "documents_document_uploader_id" btree (uploader_id) Check constraints: "ck_license_pstv_1729ecc382bd5798" CHECK (license >= 0) "documents_document_dtype_check" CHECK (dtype >= 0) "documents_document_license_check" CHECK (license >= 0) Foreign-key constraints: "category_id_refs_id_e25ec0453894ce1" FOREIGN KEY (category_id) REFERENCES documents_documentcategory(id) DEFERRABLE INITIALLY DEFERRED "uploader_id_refs_id_5ff0d850c6e685b1" FOREIGN KEY (uploader_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Referenced by: TABLE "documents_documentdownload" CONSTRAINT "document_id_refs_id_239eb3d7b196a557" FOREIGN KEY (document_id) REFERENCES documents_document(id) DEFERRABLE INITIALLY DEFERRED TABLE "documents_documentrating" CONSTRAINT "documents_documentrating_document_id_fkey" FOREIGN KEY (document_id) REFERENCES documents_document(id) DEFERRABLE INITIALLY DEFERRED Index "public.documents_document_category_id" Column | Type | Key? | Definition -------------+---------+------+------------- category_id | integer | yes | category_id btree, for table "public.documents_document" Sequence "public.documents_document_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.documents_document.id Index "public.documents_document_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.documents_document" Index "public.documents_document_uploader_id" Column | Type | Key? | Definition -------------+---------+------+------------- uploader_id | integer | yes | uploader_id btree, for table "public.documents_document" Index "public.documents_documentcat_documentcategory_id_6e38e3d02b507d23_uniq" Column | Type | Key? | Definition ---------------------+---------+------+--------------------- documentcategory_id | integer | yes | documentcategory_id course_id | integer | yes | course_id unique, btree, for table "public.documents_documentcategory_courses" Index "public.documents_documentcat_documentcategory_id_6ff42fef31a40ef7_uniq" Column | Type | Key? | Definition ---------------------+---------+------+--------------------- documentcategory_id | integer | yes | documentcategory_id lecturer_id | integer | yes | lecturer_id unique, btree, for table "public.documents_documentcategory_lecturers" Table "public.documents_documentcategory" Column | Type | Collation | Nullable | Default -------------+------------------------+-----------+----------+-------------------------------------------------------- id | integer | | not null | nextval('documents_documentcategory_id_seq'::regclass) name | citext | | not null | description | character varying(255) | | not null | Indexes: "documents_documentcategory_pkey" PRIMARY KEY, btree (id) "documents_documentcategory_name_key" UNIQUE CONSTRAINT, btree (name) "documents_documentcategory_name" btree (name) Referenced by: TABLE "documents_document" CONSTRAINT "category_id_refs_id_e25ec0453894ce1" FOREIGN KEY (category_id) REFERENCES documents_documentcategory(id) DEFERRABLE INITIALLY DEFERRED TABLE "documents_documentcategory_lecturers" CONSTRAINT "documentcategory_id_refs_id_488eb9d5" FOREIGN KEY (documentcategory_id) REFERENCES documents_documentcategory(id) DEFERRABLE INITIALLY DEFERRED TABLE "documents_documentcategory_courses" CONSTRAINT "documentcategory_id_refs_id_5891b153" FOREIGN KEY (documentcategory_id) REFERENCES documents_documentcategory(id) DEFERRABLE INITIALLY DEFERRED Table "public.documents_documentcategory_courses" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+---------------------------------------------------------------- id | integer | | not null | nextval('documents_documentcategory_courses_id_seq'::regclass) documentcategory_id | integer | | not null | course_id | integer | | not null | Indexes: "documents_documentcategory_courses_pkey" PRIMARY KEY, btree (id) "documents_documentcat_documentcategory_id_6e38e3d02b507d23_uniq" UNIQUE CONSTRAINT, btree (documentcategory_id, course_id) "documents_documentcategory_courses_course_id" btree (course_id) "documents_documentcategory_courses_documentcategory_id" btree (documentcategory_id) Foreign-key constraints: "course_id_refs_id_6e0be908" FOREIGN KEY (course_id) REFERENCES lecturers_course(id) DEFERRABLE INITIALLY DEFERRED "documentcategory_id_refs_id_5891b153" FOREIGN KEY (documentcategory_id) REFERENCES documents_documentcategory(id) DEFERRABLE INITIALLY DEFERRED Index "public.documents_documentcategory_courses_course_id" Column | Type | Key? | Definition -----------+---------+------+------------ course_id | integer | yes | course_id btree, for table "public.documents_documentcategory_courses" Index "public.documents_documentcategory_courses_documentcategory_id" Column | Type | Key? | Definition ---------------------+---------+------+--------------------- documentcategory_id | integer | yes | documentcategory_id btree, for table "public.documents_documentcategory_courses" Sequence "public.documents_documentcategory_courses_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.documents_documentcategory_courses.id Index "public.documents_documentcategory_courses_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.documents_documentcategory_courses" Sequence "public.documents_documentcategory_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.documents_documentcategory.id Table "public.documents_documentcategory_lecturers" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+------------------------------------------------------------------ id | integer | | not null | nextval('documents_documentcategory_lecturers_id_seq'::regclass) documentcategory_id | integer | | not null | lecturer_id | integer | | not null | Indexes: "documents_documentcategory_lecturers_pkey" PRIMARY KEY, btree (id) "documents_documentcat_documentcategory_id_6ff42fef31a40ef7_uniq" UNIQUE CONSTRAINT, btree (documentcategory_id, lecturer_id) "documents_documentcategory_lecturers_documentcategory_id" btree (documentcategory_id) "documents_documentcategory_lecturers_lecturer_id" btree (lecturer_id) Foreign-key constraints: "documentcategory_id_refs_id_488eb9d5" FOREIGN KEY (documentcategory_id) REFERENCES documents_documentcategory(id) DEFERRABLE INITIALLY DEFERRED "lecturer_id_refs_id_f11a823e" FOREIGN KEY (lecturer_id) REFERENCES lecturers_lecturer(id) DEFERRABLE INITIALLY DEFERRED Index "public.documents_documentcategory_lecturers_documentcategory_id" Column | Type | Key? | Definition ---------------------+---------+------+--------------------- documentcategory_id | integer | yes | documentcategory_id btree, for table "public.documents_documentcategory_lecturers" Sequence "public.documents_documentcategory_lecturers_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.documents_documentcategory_lecturers.id Index "public.documents_documentcategory_lecturers_lecturer_id" Column | Type | Key? | Definition -------------+---------+------+------------- lecturer_id | integer | yes | lecturer_id btree, for table "public.documents_documentcategory_lecturers" Index "public.documents_documentcategory_lecturers_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.documents_documentcategory_lecturers" Index "public.documents_documentcategory_name" Column | Type | Key? | Definition --------+--------+------+------------ name | citext | yes | name btree, for table "public.documents_documentcategory" Index "public.documents_documentcategory_name_key" Column | Type | Key? | Definition --------+--------+------+------------ name | citext | yes | name unique, btree, for table "public.documents_documentcategory" Index "public.documents_documentcategory_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.documents_documentcategory" Table "public.documents_documentdownload" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+-------------------------------------------------------- id | integer | | not null | nextval('documents_documentdownload_id_seq'::regclass) document_id | integer | | not null | timestamp | timestamp with time zone | | not null | ip | inet | | not null | Indexes: "documents_documentdownload_pkey" PRIMARY KEY, btree (id) "documents_documentdownload_document_id" btree (document_id) "documents_documentdownload_ip" btree (ip) Foreign-key constraints: "document_id_refs_id_239eb3d7b196a557" FOREIGN KEY (document_id) REFERENCES documents_document(id) DEFERRABLE INITIALLY DEFERRED Index "public.documents_documentdownload_document_id" Column | Type | Key? | Definition -------------+---------+------+------------- document_id | integer | yes | document_id btree, for table "public.documents_documentdownload" Sequence "public.documents_documentdownload_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.documents_documentdownload.id Index "public.documents_documentdownload_ip" Column | Type | Key? | Definition --------+------+------+------------ ip | inet | yes | ip btree, for table "public.documents_documentdownload" Index "public.documents_documentdownload_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.documents_documentdownload" Table "public.documents_documentrating" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+------------------------------------------------------ id | integer | | not null | nextval('documents_documentrating_id_seq'::regclass) user_id | integer | | not null | document_id | integer | | not null | rating | smallint | | not null | Indexes: "documents_documentrating_pkey" PRIMARY KEY, btree (id) "documents_documentrating_user_id_document_id_key" UNIQUE CONSTRAINT, btree (user_id, document_id) "documents_documentrating_document_id" btree (document_id) "documents_documentrating_user_id" btree (user_id) Check constraints: "documents_documentrating_rating_check" CHECK (rating >= 0) Foreign-key constraints: "documents_documentrating_document_id_fkey" FOREIGN KEY (document_id) REFERENCES documents_document(id) DEFERRABLE INITIALLY DEFERRED "user_id_refs_id_6d66bf1cd6804cfe" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Index "public.documents_documentrating_document_id" Column | Type | Key? | Definition -------------+---------+------+------------- document_id | integer | yes | document_id btree, for table "public.documents_documentrating" Sequence "public.documents_documentrating_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.documents_documentrating.id Index "public.documents_documentrating_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.documents_documentrating" Index "public.documents_documentrating_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.documents_documentrating" Index "public.documents_documentrating_user_id_document_id_key" Column | Type | Key? | Definition -------------+---------+------+------------- user_id | integer | yes | user_id document_id | integer | yes | document_id unique, btree, for table "public.documents_documentrating" Table "public.easy_thumbnails_source" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+----------------------------------------------------------- id | integer | | not null | nextval('easy_thumbnails_source_id_seq'::regclass) name | character varying(255) | | not null | modified | timestamp with time zone | | not null | '2009-11-22 20:16:23.523494+00'::timestamp with time zone storage_hash | character varying(40) | | not null | Indexes: "easy_thumbnails_source_pkey" PRIMARY KEY, btree (id) "easy_thumbnails_source_name_7549c98cc6dd6969_uniq" UNIQUE CONSTRAINT, btree (name, storage_hash) "easy_thumbnails_source_name" btree (name) "easy_thumbnails_source_storage_hash" btree (storage_hash) Referenced by: TABLE "easy_thumbnails_thumbnail" CONSTRAINT "source_id_refs_id_38c628a45bffe8f5" FOREIGN KEY (source_id) REFERENCES easy_thumbnails_source(id) DEFERRABLE INITIALLY DEFERRED Sequence "public.easy_thumbnails_source_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.easy_thumbnails_source.id Index "public.easy_thumbnails_source_name" Column | Type | Key? | Definition --------+------------------------+------+------------ name | character varying(255) | yes | name btree, for table "public.easy_thumbnails_source" Index "public.easy_thumbnails_source_name_7549c98cc6dd6969_uniq" Column | Type | Key? | Definition --------------+------------------------+------+-------------- name | character varying(255) | yes | name storage_hash | character varying(40) | yes | storage_hash unique, btree, for table "public.easy_thumbnails_source" Index "public.easy_thumbnails_source_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.easy_thumbnails_source" Index "public.easy_thumbnails_source_storage_hash" Column | Type | Key? | Definition --------------+-----------------------+------+-------------- storage_hash | character varying(40) | yes | storage_hash btree, for table "public.easy_thumbnails_source" Table "public.easy_thumbnails_thumbnail" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+----------------------------------------------------------- id | integer | | not null | nextval('easy_thumbnails_thumbnail_id_seq'::regclass) name | character varying(255) | | not null | modified | timestamp with time zone | | not null | '2009-11-22 20:16:23.523494+00'::timestamp with time zone source_id | integer | | not null | storage_hash | character varying(40) | | not null | Indexes: "easy_thumbnails_thumbnail_pkey" PRIMARY KEY, btree (id) "easy_thumbnails_thumbnail_source_id_1f50d53db8191480_uniq" UNIQUE CONSTRAINT, btree (source_id, name, storage_hash) "easy_thumbnails_thumbnail_name" btree (name) "easy_thumbnails_thumbnail_source_id" btree (source_id) "easy_thumbnails_thumbnail_storage_hash" btree (storage_hash) Foreign-key constraints: "source_id_refs_id_38c628a45bffe8f5" FOREIGN KEY (source_id) REFERENCES easy_thumbnails_source(id) DEFERRABLE INITIALLY DEFERRED Sequence "public.easy_thumbnails_thumbnail_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.easy_thumbnails_thumbnail.id Index "public.easy_thumbnails_thumbnail_name" Column | Type | Key? | Definition --------+------------------------+------+------------ name | character varying(255) | yes | name btree, for table "public.easy_thumbnails_thumbnail" Index "public.easy_thumbnails_thumbnail_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.easy_thumbnails_thumbnail" Index "public.easy_thumbnails_thumbnail_source_id" Column | Type | Key? | Definition -----------+---------+------+------------ source_id | integer | yes | source_id btree, for table "public.easy_thumbnails_thumbnail" Index "public.easy_thumbnails_thumbnail_source_id_1f50d53db8191480_uniq" Column | Type | Key? | Definition --------------+------------------------+------+-------------- source_id | integer | yes | source_id name | character varying(255) | yes | name storage_hash | character varying(40) | yes | storage_hash unique, btree, for table "public.easy_thumbnails_thumbnail" Index "public.easy_thumbnails_thumbnail_storage_hash" Column | Type | Key? | Definition --------------+-----------------------+------+-------------- storage_hash | character varying(40) | yes | storage_hash btree, for table "public.easy_thumbnails_thumbnail" Table "public.events_event" Column | Type | Collation | Nullable | Default -------------+------------------------+-----------+----------+------------------------------------------ id | integer | | not null | nextval('events_event_id_seq'::regclass) summary | character varying(64) | | not null | description | text | | not null | author_id | integer | | | start_date | date | | not null | start_time | time without time zone | | | end_date | date | | | end_time | time without time zone | | | picture | character varying(100) | | | location | character varying(80) | | | url | character varying(200) | | | Indexes: "events_event_pkey" PRIMARY KEY, btree (id) "events_event_author_id" btree (author_id) Foreign-key constraints: "author_id_refs_id_7f1015e581a1637d" FOREIGN KEY (author_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Index "public.events_event_author_id" Column | Type | Key? | Definition -----------+---------+------+------------ author_id | integer | yes | author_id btree, for table "public.events_event" Sequence "public.events_event_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.events_event.id Index "public.events_event_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.events_event" Table "public.front_user" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+---------------------------------------- id | integer | | not null | nextval('front_user_id_seq'::regclass) password | character varying(128) | | not null | last_login | timestamp with time zone | | not null | is_superuser | boolean | | not null | username | character varying(30) | | not null | first_name | character varying(30) | | not null | last_name | character varying(30) | | not null | email | character varying(75) | | not null | is_staff | boolean | | not null | is_active | boolean | | not null | date_joined | timestamp with time zone | | not null | twitter | character varying(24) | | not null | flattr | character varying(128) | | not null | Indexes: "front_user_pkey" PRIMARY KEY, btree (id) "front_user_username_key" UNIQUE CONSTRAINT, btree (username) "front_user_username_like" btree (username varchar_pattern_ops) Referenced by: TABLE "lecturers_quote" CONSTRAINT "author_id_refs_id_587cadff6b1cccc9" FOREIGN KEY (author_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "events_event" CONSTRAINT "author_id_refs_id_7f1015e581a1637d" FOREIGN KEY (author_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "oauth2_accesstoken" CONSTRAINT "oauth2_accesstoken_user_id_fkey" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "oauth2_client" CONSTRAINT "oauth2_client_user_id_fkey" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "oauth2_grant" CONSTRAINT "oauth2_grant_user_id_fkey" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "oauth2_refreshtoken" CONSTRAINT "oauth2_refreshtoken_user_id_fkey" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "documents_document" CONSTRAINT "uploader_id_refs_id_5ff0d850c6e685b1" FOREIGN KEY (uploader_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "django_admin_log" CONSTRAINT "user_id_refs_id_26732827718cbe4" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "lecturers_lecturerrating" CONSTRAINT "user_id_refs_id_3742235688de9ea5" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "lecturers_quotevote" CONSTRAINT "user_id_refs_id_48ffca2d84c51d77" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "front_user_groups" CONSTRAINT "user_id_refs_id_57df118fbc192d77" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "documents_documentrating" CONSTRAINT "user_id_refs_id_6d66bf1cd6804cfe" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "registration_registrationprofile" CONSTRAINT "user_id_refs_id_70e4e57a94a96576" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED TABLE "front_user_user_permissions" CONSTRAINT "user_id_refs_id_718f6c53be7e3e37" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Table "public.front_user_groups" Column | Type | Collation | Nullable | Default ----------+---------+-----------+----------+----------------------------------------------- id | integer | | not null | nextval('front_user_groups_id_seq'::regclass) user_id | integer | | not null | group_id | integer | | not null | Indexes: "front_user_groups_pkey" PRIMARY KEY, btree (id) "front_user_groups_user_id_385ef041e2b5eed4_uniq" UNIQUE CONSTRAINT, btree (user_id, group_id) "front_user_groups_group_id" btree (group_id) "front_user_groups_user_id" btree (user_id) Foreign-key constraints: "group_id_refs_id_512273754467b2d6" FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED "user_id_refs_id_57df118fbc192d77" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Index "public.front_user_groups_group_id" Column | Type | Key? | Definition ----------+---------+------+------------ group_id | integer | yes | group_id btree, for table "public.front_user_groups" Sequence "public.front_user_groups_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.front_user_groups.id Index "public.front_user_groups_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.front_user_groups" Index "public.front_user_groups_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.front_user_groups" Index "public.front_user_groups_user_id_385ef041e2b5eed4_uniq" Column | Type | Key? | Definition ----------+---------+------+------------ user_id | integer | yes | user_id group_id | integer | yes | group_id unique, btree, for table "public.front_user_groups" Sequence "public.front_user_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.front_user.id Index "public.front_user_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.front_user" Table "public.front_user_user_permissions" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------------------------------------------------------- id | integer | | not null | nextval('front_user_user_permissions_id_seq'::regclass) user_id | integer | | not null | permission_id | integer | | not null | Indexes: "front_user_user_permissions_pkey" PRIMARY KEY, btree (id) "front_user_user_permissions_user_id_f520d12104326a3_uniq" UNIQUE CONSTRAINT, btree (user_id, permission_id) "front_user_user_permissions_permission_id" btree (permission_id) "front_user_user_permissions_user_id" btree (user_id) Foreign-key constraints: "permission_id_refs_id_7300c62098ec4b67" FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED "user_id_refs_id_718f6c53be7e3e37" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Sequence "public.front_user_user_permissions_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.front_user_user_permissions.id Index "public.front_user_user_permissions_permission_id" Column | Type | Key? | Definition ---------------+---------+------+--------------- permission_id | integer | yes | permission_id btree, for table "public.front_user_user_permissions" Index "public.front_user_user_permissions_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.front_user_user_permissions" Index "public.front_user_user_permissions_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.front_user_user_permissions" Index "public.front_user_user_permissions_user_id_f520d12104326a3_uniq" Column | Type | Key? | Definition ---------------+---------+------+--------------- user_id | integer | yes | user_id permission_id | integer | yes | permission_id unique, btree, for table "public.front_user_user_permissions" Index "public.front_user_username_key" Column | Type | Key? | Definition ----------+-----------------------+------+------------ username | character varying(30) | yes | username unique, btree, for table "public.front_user" Index "public.front_user_username_like" Column | Type | Key? | Definition ----------+-----------------------+------+------------ username | character varying(30) | yes | username btree, for table "public.front_user" Table "public.lecturers_course" Column | Type | Collation | Nullable | Default --------------+-----------------------+-----------+----------+--------- id | integer | | not null | abbreviation | character varying(10) | | not null | name | character varying(50) | | not null | Indexes: "lecturers_course_pkey" PRIMARY KEY, btree (id) "lecturers_course_abbreviation_key" UNIQUE CONSTRAINT, btree (abbreviation) "lecturers_course_abbreviation_like" btree (abbreviation varchar_pattern_ops) Referenced by: TABLE "documents_documentcategory_courses" CONSTRAINT "course_id_refs_id_6e0be908" FOREIGN KEY (course_id) REFERENCES lecturers_course(id) DEFERRABLE INITIALLY DEFERRED Index "public.lecturers_course_abbreviation_key" Column | Type | Key? | Definition --------------+-----------------------+------+-------------- abbreviation | character varying(10) | yes | abbreviation unique, btree, for table "public.lecturers_course" Index "public.lecturers_course_abbreviation_like" Column | Type | Key? | Definition --------------+-----------------------+------+-------------- abbreviation | character varying(10) | yes | abbreviation btree, for table "public.lecturers_course" Index "public.lecturers_course_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.lecturers_course" Table "public.lecturers_lecturer" Column | Type | Collation | Nullable | Default --------------+------------------------+-----------+----------+--------- id | integer | | not null | title | character varying(32) | | | last_name | character varying(255) | | not null | first_name | character varying(255) | | not null | abbreviation | character varying(10) | | not null | department | character varying(100) | | | function | character varying(255) | | | main_area | character varying(255) | | | subjects | character varying(50) | | | email | character varying(75) | | | office | character varying(20) | | | Indexes: "lecturers_lecturer_pkey" PRIMARY KEY, btree (id) "lecturers_lecturer_abbreviation_key" UNIQUE CONSTRAINT, btree (abbreviation) Referenced by: TABLE "documents_documentcategory_lecturers" CONSTRAINT "lecturer_id_refs_id_f11a823e" FOREIGN KEY (lecturer_id) REFERENCES lecturers_lecturer(id) DEFERRABLE INITIALLY DEFERRED Index "public.lecturers_lecturer_abbreviation_key" Column | Type | Key? | Definition --------------+-----------------------+------+-------------- abbreviation | character varying(10) | yes | abbreviation unique, btree, for table "public.lecturers_lecturer" Index "public.lecturers_lecturer_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.lecturers_lecturer" Table "public.lecturers_lecturerrating" Column | Type | Collation | Nullable | Default -------------+----------------------+-----------+----------+------------------------------------------------------ id | integer | | not null | nextval('lecturers_lecturerrating_id_seq'::regclass) user_id | integer | | not null | lecturer_id | integer | | not null | category | character varying(1) | | not null | rating | smallint | | not null | Indexes: "lecturers_lecturerrating_pkey" PRIMARY KEY, btree (id) "lecturers_lecturerrating_user_id_lecturer_id_category_key" UNIQUE CONSTRAINT, btree (user_id, lecturer_id, category) "lecturers_lecturerrating_category" btree (category) "lecturers_lecturerrating_category_like" btree (category varchar_pattern_ops) "lecturers_lecturerrating_lecturer_id" btree (lecturer_id) "lecturers_lecturerrating_rating" btree (rating) "lecturers_lecturerrating_user_id" btree (user_id) Check constraints: "lecturers_lecturerrating_rating_check" CHECK (rating >= 0) Foreign-key constraints: "user_id_refs_id_3742235688de9ea5" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Index "public.lecturers_lecturerrating_category" Column | Type | Key? | Definition ----------+----------------------+------+------------ category | character varying(1) | yes | category btree, for table "public.lecturers_lecturerrating" Index "public.lecturers_lecturerrating_category_like" Column | Type | Key? | Definition ----------+----------------------+------+------------ category | character varying(1) | yes | category btree, for table "public.lecturers_lecturerrating" Sequence "public.lecturers_lecturerrating_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.lecturers_lecturerrating.id Index "public.lecturers_lecturerrating_lecturer_id" Column | Type | Key? | Definition -------------+---------+------+------------- lecturer_id | integer | yes | lecturer_id btree, for table "public.lecturers_lecturerrating" Index "public.lecturers_lecturerrating_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.lecturers_lecturerrating" Index "public.lecturers_lecturerrating_rating" Column | Type | Key? | Definition --------+----------+------+------------ rating | smallint | yes | rating btree, for table "public.lecturers_lecturerrating" Index "public.lecturers_lecturerrating_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.lecturers_lecturerrating" Index "public.lecturers_lecturerrating_user_id_lecturer_id_category_key" Column | Type | Key? | Definition -------------+----------------------+------+------------- user_id | integer | yes | user_id lecturer_id | integer | yes | lecturer_id category | character varying(1) | yes | category unique, btree, for table "public.lecturers_lecturerrating" Table "public.lecturers_quote" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------------------------------------------- id | integer | | not null | nextval('lecturers_quote_id_seq'::regclass) author_id | integer | | | lecturer_id | integer | | not null | date | timestamp with time zone | | not null | quote | text | | not null | comment | text | | not null | Indexes: "lecturers_quote_pkey" PRIMARY KEY, btree (id) "lecturers_quote_author_id" btree (author_id) "lecturers_quote_lecturer_id" btree (lecturer_id) Foreign-key constraints: "author_id_refs_id_587cadff6b1cccc9" FOREIGN KEY (author_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Referenced by: TABLE "lecturers_quotevote" CONSTRAINT "quote_id_refs_id_4ec50dc747eea33d" FOREIGN KEY (quote_id) REFERENCES lecturers_quote(id) DEFERRABLE INITIALLY DEFERRED Index "public.lecturers_quote_author_id" Column | Type | Key? | Definition -----------+---------+------+------------ author_id | integer | yes | author_id btree, for table "public.lecturers_quote" Sequence "public.lecturers_quote_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.lecturers_quote.id Index "public.lecturers_quote_lecturer_id" Column | Type | Key? | Definition -------------+---------+------+------------- lecturer_id | integer | yes | lecturer_id btree, for table "public.lecturers_quote" Index "public.lecturers_quote_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.lecturers_quote" Table "public.lecturers_quotevote" Column | Type | Collation | Nullable | Default ----------+---------+-----------+----------+------------------------------------------------- id | integer | | not null | nextval('lecturers_quotevote_id_seq'::regclass) user_id | integer | | not null | quote_id | integer | | not null | vote | boolean | | not null | false Indexes: "lecturers_quotevote_pkey" PRIMARY KEY, btree (id) "lecturers_quotevote_user_id_3ecc6f4b83d4492b_uniq" UNIQUE CONSTRAINT, btree (user_id, quote_id) "lecturers_quotevote_quote_id" btree (quote_id) "lecturers_quotevote_user_id" btree (user_id) Foreign-key constraints: "quote_id_refs_id_4ec50dc747eea33d" FOREIGN KEY (quote_id) REFERENCES lecturers_quote(id) DEFERRABLE INITIALLY DEFERRED "user_id_refs_id_48ffca2d84c51d77" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Sequence "public.lecturers_quotevote_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.lecturers_quotevote.id Index "public.lecturers_quotevote_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.lecturers_quotevote" Index "public.lecturers_quotevote_quote_id" Column | Type | Key? | Definition ----------+---------+------+------------ quote_id | integer | yes | quote_id btree, for table "public.lecturers_quotevote" Index "public.lecturers_quotevote_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.lecturers_quotevote" Index "public.lecturers_quotevote_user_id_3ecc6f4b83d4492b_uniq" Column | Type | Key? | Definition ----------+---------+------+------------ user_id | integer | yes | user_id quote_id | integer | yes | quote_id unique, btree, for table "public.lecturers_quotevote" Table "public.oauth2_accesstoken" Column | Type | Collation | Nullable | Default -----------+--------------------------+-----------+----------+------------------------------------------------ id | integer | | not null | nextval('oauth2_accesstoken_id_seq'::regclass) user_id | integer | | not null | token | character varying(255) | | not null | client_id | integer | | not null | expires | timestamp with time zone | | not null | scope | integer | | not null | Indexes: "oauth2_accesstoken_pkey" PRIMARY KEY, btree (id) "oauth2_accesstoken_client_id" btree (client_id) "oauth2_accesstoken_user_id" btree (user_id) Foreign-key constraints: "oauth2_accesstoken_client_id_fkey" FOREIGN KEY (client_id) REFERENCES oauth2_client(id) DEFERRABLE INITIALLY DEFERRED "oauth2_accesstoken_user_id_fkey" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Referenced by: TABLE "oauth2_refreshtoken" CONSTRAINT "oauth2_refreshtoken_access_token_id_fkey" FOREIGN KEY (access_token_id) REFERENCES oauth2_accesstoken(id) DEFERRABLE INITIALLY DEFERRED Index "public.oauth2_accesstoken_client_id" Column | Type | Key? | Definition -----------+---------+------+------------ client_id | integer | yes | client_id btree, for table "public.oauth2_accesstoken" Sequence "public.oauth2_accesstoken_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.oauth2_accesstoken.id Index "public.oauth2_accesstoken_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.oauth2_accesstoken" Index "public.oauth2_accesstoken_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.oauth2_accesstoken" Table "public.oauth2_client" Column | Type | Collation | Nullable | Default ---------------+------------------------+-----------+----------+------------------------------------------- id | integer | | not null | nextval('oauth2_client_id_seq'::regclass) user_id | integer | | | name | character varying(255) | | not null | url | character varying(200) | | not null | redirect_uri | character varying(200) | | not null | client_id | character varying(255) | | not null | client_secret | character varying(255) | | not null | client_type | integer | | not null | Indexes: "oauth2_client_pkey" PRIMARY KEY, btree (id) "oauth2_client_user_id" btree (user_id) Foreign-key constraints: "oauth2_client_user_id_fkey" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Referenced by: TABLE "oauth2_accesstoken" CONSTRAINT "oauth2_accesstoken_client_id_fkey" FOREIGN KEY (client_id) REFERENCES oauth2_client(id) DEFERRABLE INITIALLY DEFERRED TABLE "oauth2_grant" CONSTRAINT "oauth2_grant_client_id_fkey" FOREIGN KEY (client_id) REFERENCES oauth2_client(id) DEFERRABLE INITIALLY DEFERRED TABLE "oauth2_refreshtoken" CONSTRAINT "oauth2_refreshtoken_client_id_fkey" FOREIGN KEY (client_id) REFERENCES oauth2_client(id) DEFERRABLE INITIALLY DEFERRED Sequence "public.oauth2_client_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.oauth2_client.id Index "public.oauth2_client_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.oauth2_client" Index "public.oauth2_client_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.oauth2_client" Table "public.oauth2_grant" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+------------------------------------------ id | integer | | not null | nextval('oauth2_grant_id_seq'::regclass) user_id | integer | | not null | client_id | integer | | not null | code | character varying(255) | | not null | expires | timestamp with time zone | | not null | redirect_uri | character varying(255) | | not null | scope | integer | | not null | Indexes: "oauth2_grant_pkey" PRIMARY KEY, btree (id) "oauth2_grant_client_id" btree (client_id) "oauth2_grant_user_id" btree (user_id) Foreign-key constraints: "oauth2_grant_client_id_fkey" FOREIGN KEY (client_id) REFERENCES oauth2_client(id) DEFERRABLE INITIALLY DEFERRED "oauth2_grant_user_id_fkey" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Index "public.oauth2_grant_client_id" Column | Type | Key? | Definition -----------+---------+------+------------ client_id | integer | yes | client_id btree, for table "public.oauth2_grant" Sequence "public.oauth2_grant_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.oauth2_grant.id Index "public.oauth2_grant_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.oauth2_grant" Index "public.oauth2_grant_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.oauth2_grant" Table "public.oauth2_refreshtoken" Column | Type | Collation | Nullable | Default -----------------+------------------------+-----------+----------+------------------------------------------------- id | integer | | not null | nextval('oauth2_refreshtoken_id_seq'::regclass) user_id | integer | | not null | token | character varying(255) | | not null | access_token_id | integer | | not null | client_id | integer | | not null | expired | boolean | | not null | Indexes: "oauth2_refreshtoken_pkey" PRIMARY KEY, btree (id) "oauth2_refreshtoken_access_token_id_key" UNIQUE CONSTRAINT, btree (access_token_id) "oauth2_refreshtoken_client_id" btree (client_id) "oauth2_refreshtoken_user_id" btree (user_id) Foreign-key constraints: "oauth2_refreshtoken_access_token_id_fkey" FOREIGN KEY (access_token_id) REFERENCES oauth2_accesstoken(id) DEFERRABLE INITIALLY DEFERRED "oauth2_refreshtoken_client_id_fkey" FOREIGN KEY (client_id) REFERENCES oauth2_client(id) DEFERRABLE INITIALLY DEFERRED "oauth2_refreshtoken_user_id_fkey" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Index "public.oauth2_refreshtoken_access_token_id_key" Column | Type | Key? | Definition -----------------+---------+------+----------------- access_token_id | integer | yes | access_token_id unique, btree, for table "public.oauth2_refreshtoken" Index "public.oauth2_refreshtoken_client_id" Column | Type | Key? | Definition -----------+---------+------+------------ client_id | integer | yes | client_id btree, for table "public.oauth2_refreshtoken" Sequence "public.oauth2_refreshtoken_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.oauth2_refreshtoken.id Index "public.oauth2_refreshtoken_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.oauth2_refreshtoken" Index "public.oauth2_refreshtoken_user_id" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id btree, for table "public.oauth2_refreshtoken" Table "public.registration_registrationprofile" Column | Type | Collation | Nullable | Default ----------------+-----------------------+-----------+----------+-------------------------------------------------------------- id | integer | | not null | nextval('registration_registrationprofile_id_seq'::regclass) user_id | integer | | not null | activation_key | character varying(40) | | not null | Indexes: "registration_registrationprofile_pkey" PRIMARY KEY, btree (id) "registration_registrationprofile_user_id_key" UNIQUE CONSTRAINT, btree (user_id) Foreign-key constraints: "user_id_refs_id_70e4e57a94a96576" FOREIGN KEY (user_id) REFERENCES front_user(id) DEFERRABLE INITIALLY DEFERRED Sequence "public.registration_registrationprofile_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.registration_registrationprofile.id Index "public.registration_registrationprofile_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.registration_registrationprofile" Index "public.registration_registrationprofile_user_id_key" Column | Type | Key? | Definition ---------+---------+------+------------ user_id | integer | yes | user_id unique, btree, for table "public.registration_registrationprofile" Table "public.south_migrationhistory" Column | Type | Collation | Nullable | Default -----------+--------------------------+-----------+----------+---------------------------------------------------- id | integer | | not null | nextval('south_migrationhistory_id_seq'::regclass) app_name | character varying(255) | | not null | migration | character varying(255) | | not null | applied | timestamp with time zone | | not null | Indexes: "south_migrationhistory_pkey" PRIMARY KEY, btree (id) Sequence "public.south_migrationhistory_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache --------+-------+---------+---------------------+-----------+---------+------- bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1 Owned by: public.south_migrationhistory.id Index "public.south_migrationhistory_pkey" Column | Type | Key? | Definition --------+---------+------+------------ id | integer | yes | id primary key, btree, for table "public.south_migrationhistory" ```
The-Compiler commented 4 years ago

Django-Migration

Operations to perform:
  Apply all migrations: front
Running migrations:
  Applying contenttypes.0001_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
psycopg2.errors.DuplicateTable: relation "django_content_type" already exists

Theoretisch hilft da --fake-initial (docs):

Allows Django to skip an app’s initial migration if all database tables with the names of all models created by all CreateModel operations in that migration already exist. This option is intended for use when first running migrations against a database that preexisted the use of migrations. This option does not, however, check for matching database schema beyond matching table names and so is only safe to use if you are confident that your existing schema matches what is recorded in your initial migration.

Das scheint mir aber bei uns nicht der Fall zu sein. Unser Schema passt ja nicht auf die initiale Migration, sondern da sind eigentlich schon mal Migrationen durchgelaufen (einfach via South).

In #193 sagt @dbrgn:

The first time this code is deployed on the server, the following code needs to be run: python manage.py migrate --fake

Das würde dann ja aber auch diverse Migrationen überspringen, die gar noch nicht gemacht wurden auf der aktuellen Datenbank, oder? Vermutlich müsste man da also explizit die letzte Migration angeben, die via South ausgeführt wurde? Ich grabe mal weiter!

South migration history ```sql -- -- Data for Name: south_migrationhistory; Type: TABLE DATA; Schema: public; Owner: studentenportal -- COPY south_migrationhistory (id, app_name, migration, applied) FROM stdin; 1 front 0001_initial 2014-02-25 15:07:25.681574+01 2 django_extensions 0001_empty 2014-02-25 15:07:26.298235+01 3 easy_thumbnails 0001_initial 2014-02-25 15:07:26.585375+01 4 easy_thumbnails 0002_filename_indexes 2014-02-25 15:07:26.64599+01 5 easy_thumbnails 0003_auto__add_storagenew 2014-02-25 15:07:26.735075+01 6 easy_thumbnails 0004_auto__add_field_source_storage_new__add_field_thumbnail_storage_new 2014-02-25 15:07:26.779812+01 7 easy_thumbnails 0005_storage_fks_null 2014-02-25 15:07:26.830334+01 8 easy_thumbnails 0006_copy_storage 2014-02-25 15:07:26.841954+01 9 easy_thumbnails 0007_storagenew_fks_not_null 2014-02-25 15:07:26.884035+01 10 easy_thumbnails 0008_auto__del_field_source_storage__del_field_thumbnail_storage 2014-02-25 15:07:26.89638+01 11 easy_thumbnails 0009_auto__del_storage 2014-02-25 15:07:26.907565+01 12 easy_thumbnails 0010_rename_storage 2014-02-25 15:07:26.920461+01 13 easy_thumbnails 0011_auto__add_field_source_storage_hash__add_field_thumbnail_storage_hash 2014-02-25 15:07:27.083652+01 14 easy_thumbnails 0012_build_storage_hashes 2014-02-25 15:07:27.095868+01 15 easy_thumbnails 0013_auto__del_storage__del_field_source_storage__del_field_thumbnail_stora 2014-02-25 15:07:27.13941+01 16 easy_thumbnails 0014_auto__add_unique_source_name_storage_hash__add_unique_thumbnail_name_s 2014-02-25 15:07:27.184419+01 17 easy_thumbnails 0015_auto__del_unique_thumbnail_name_storage_hash__add_unique_thumbnail_sou 2014-02-25 15:07:27.216761+01 18 oauth2 0001_initial 2014-02-25 15:07:27.629193+01 19 oauth2 0002_auto__chg_field_client_user 2014-02-25 15:07:27.671603+01 20 oauth2 0003_auto__add_field_client_name 2014-02-25 15:07:27.743344+01 21 documents 0001_initial 2014-02-25 15:07:28.247327+01 22 events 0001_initial 2014-02-25 15:07:28.401152+01 23 lecturers 0001_initial 2014-02-25 15:07:28.927696+01 24 lecturers 0002_auto__add_course 2014-06-16 23:17:56.804473+02 25 lecturers 0003_remove_modulereview 2014-06-16 23:17:56.851858+02 26 documents 0002_auto__m2m_table_for_course 2014-06-16 23:18:00.133419+02 27 documents 0003_auto__add_field_document_flattr_disabled 2014-08-12 11:57:17.718732+02 \. ```
dbrgn commented 4 years ago

Ich glaube beim Wechsel von South auf Django Migrations muss man einmal mit --fake migrieren, aber ich habe nicht mehr ganz im Kopf wie das genau läuft... Ist schon 4 Jahre her, seit ich den PR #193 erstellt hab :smile:

Im Zweifelsfall einfach mal in einer Test-DB ausprobieren.

The-Compiler commented 4 years ago

Migrations-Attempt 1

Ich versuche, die Migrationen in möglichst kleinen Schritten auf den Stand zu bringen, der momentan in der South-Tabelle steht. Dazu schaue ich mir jeweils mit --plan an, was Django an Migrationen macht, und nutze jeweils --fake mit einzelnen Apps, um auf den richtigen Stand zu bringen. Danach sollten die neuen Migrationen kein Problem mehr darstellen.

Auth

$ python3 manage.py migrate --plan auth
Planned operations:
auth.0007_alter_validators_add_error_messages
    Alter field username on user
auth.0008_alter_user_username_max_length
    Alter field username on user
auth.0009_alter_user_last_name_max_length
    Alter field last_name on user
auth.0010_alter_group_name_max_length
    Alter field name on group
auth.0011_update_proxy_permissions
    Raw Python operation ->     Update the content_type of prox…
$ python3 manage.py migrate auth
Operations to perform:
  Apply all migrations: auth
Running migrations:
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK

front

$ python3 manage.py migrate --plan --fake front 0001_initial
Planned operations:
  No planned migration operations.
$ python3 manage.py migrate --fake front 0001_initial
Operations to perform:
  Target specific migration: 0001_initial, from front
Running migrations:
  No migrations to apply.

django_extensions

Haben wir entfernt, sollte also okay sein.

easy_thumbnails

Hier mappt die south-Migration 0015_auto__del_unique_thumbnail_name_storage_hash__add_unique_thumbnail_sou nicht so wirklich auf die Django-Migrationen. Also mal gucken, was eine volle Migration ohne --fake machen würde:

$ python3 manage.py migrate --plan easy_thumbnails
Planned operations:
easy_thumbnails.0001_initial
    Create model Source
    Create model Thumbnail
    Alter unique_together for thumbnail (1 constraint(s))
    Alter unique_together for source (1 constraint(s))
easy_thumbnails.0002_thumbnaildimensions
    Create model ThumbnailDimensions

Mal probieren:

$ python3 manage.py migrate easy_thumbnails
Operations to perform:
  Apply all migrations: easy_thumbnails
Running migrations:
  Applying easy_thumbnails.0001_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
psycopg2.errors.DuplicateTable: relation "easy_thumbnails_source" already exists

Okay, das initiale DB-Schema ist sicher schon hier, also mal mit --fake-initial:

$ python3 manage.py migrate easy_thumbnails --fake-initial
Operations to perform:
  Apply all migrations: easy_thumbnails
Running migrations:
  Applying easy_thumbnails.0001_initial... FAKED
  Applying easy_thumbnails.0002_thumbnaildimensions... OK
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.NotNullViolation: null value in column "name" violates not-null constraint
DETAIL:  Failing row contains (39, null, easy_thumbnails, thumbnaildimensions).

Meh. Da wurden wohl die Migrationen von easy-thumbnails mal zusammengefasst, als die von South zu Django migriert (hah) wurden...

Wenn ich mir https://github.com/SmileyChris/easy-thumbnails/commit/7360356e8d14cd3f0feac0c56ac893f960bf5c6d#diff-9f346111d1dccf8bd4fae42646e8d1ac so anschaue, dann fehlt uns nur 0016_auto__add_thumbnaildimensions.py. Die 0002_thumbnaildimensions.py welche oben failt scheint da eigentlich das Equivalent dazu zu sein...

Passiert während: STATEMENT: INSERT INTO "django_content_type" ("app_label", "model") VALUES ('easy_thumbnails', 'thumbnaildimensions') RETURNING "django_content_type"."id"

Etwas ähnlich: https://code.djangoproject.com/ticket/24299

Schlussendlich gefixt, indem ich die entsprechende contenttypes-Migration nochmals explizit durchgeführt habe:

$ python3 manage.py migrate contenttypes 0001 --fake
Operations to perform:
  Target specific migration: 0001_initial, from contenttypes
Running migrations:
  Rendering model states... DONE
  Unapplying auth.0011_update_proxy_permissions... FAKED
  Unapplying front.0001_initial... FAKED
  Unapplying auth.0010_alter_group_name_max_length... FAKED
  Unapplying auth.0009_alter_user_last_name_max_length... FAKED
  Unapplying auth.0008_alter_user_username_max_length... FAKED
  Unapplying auth.0007_alter_validators_add_error_messages... FAKED
  Unapplying auth.0006_require_contenttypes_0002... FAKED
  Unapplying contenttypes.0002_remove_content_type_name... FAKED
$ python3 manage.py migrate contenttypes
Operations to perform:
  Apply all migrations: contenttypes
Running migrations:
  Applying contenttypes.0002_remove_content_type_name... OK
$ python3 manage.py migrate easy_thumbnails 
Operations to perform:
  Apply all migrations: easy_thumbnails
Running migrations:
  No migrations to apply.

Da würde ich aber gerne noch ne schönere Lösung finden... Ev. hat einer der vorherigen Schritte implizit contenttypes.0002_remove_content_type_name als faked markiert, oder ich hatte versehentlich doch noch Resten von einem früheren Test in der Datenbank? Aber gut, mal weiter im Text...

oauth2

$ python3 manage.py migrate --plan oauth2
CommandError: No installed app with label 'oauth2'.

Vermutlich seit b2a83b2e70277d9ce94cc3738caa9ea7de91f0f5 nicht mehr relevant.

Auth, zum Zweiten

nach dem unapply:

$ python3 manage.py migrate --plan auth
Planned operations:
auth.0006_require_contenttypes_0002
auth.0007_alter_validators_add_error_messages
    Alter field username on user
auth.0008_alter_user_username_max_length
    Alter field username on user
auth.0009_alter_user_last_name_max_length
    Alter field last_name on user
auth.0010_alter_group_name_max_length
    Alter field name on group
auth.0011_update_proxy_permissions
    Raw Python operation ->     Update the content_type of prox…
$ python3 manage.py migrate auth
Operations to perform:
  Apply all migrations: auth
Running migrations:
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK

front, zum Zweiten

dito

$ python3 manage.py migrate --plan --fake front 0001_initial
Planned operations:
front.0001_initial
    Create model User
$ python3 manage.py migrate --fake front 0001_initial
Operations to perform:
  Target specific migration: 0001_initial, from front
Running migrations:
  Applying front.0001_initial... FAKED

events

$ python3 manage.py migrate --plan --fake events 0001_initial
Planned operations:
events.0001_initial
    Create model Event
$ python3 manage.py migrate --fake events 0001_initial
Operations to perform:
  Target specific migration: 0001_initial, from events
Running migrations:
  Applying events.0001_initial... FAKED

lecturers

$ python3 manage.py migrate --plan lecturers
Planned operations:
lecturers.0001_initial
    Create model Course
    Create model Lecturer
    Create model LecturerRating
    Create model Quote
    Create model QuoteVote
    Alter unique_together for quotevote (1 constraint(s))
    Alter unique_together for lecturerrating (1 constraint(s))

Versteh nicht ganz, was da aus den south-Migrationen geworden ist, aber mal probieren!

$ python3 manage.py migrate --fake lecturers 0001_initial
Operations to perform:
  Target specific migration: 0001_initial, from lecturers
Running migrations:
  Applying lecturers.0001_initial... FAKED

documents

$ python3 manage.py migrate --plan documents
Planned operations:
documents.0001_initial
    Create model Document
    Create model DocumentCategory
    Create model DocumentDownload
    Create model DocumentRating
documents.0002_auto_20161124_2111
    Add field user to documentrating
    Add field document to documentdownload
    Add field courses to documentcategory
    Add field lecturers to documentcategory
    Add field category to document
    Add field uploader to document
    Alter unique_together for documentrating (1 constraint(s))
    Alter index_together for documentdownload (1 constraint(s))
documents.0003_auto_20200122_1624
    Alter index_together for documentdownload (1 constraint(s))
    Remove field ip from documentdownload

Vermutlich wurde da erst die initial-Migration via South durchgeführt?

$ python3 manage.py migrate --fake documents 0001_initial
Operations to perform:
  Target specific migration: 0001_initial, from documents
Running migrations:
  Applying documents.0001_initial... FAKED

neue Migrations

$ python3 manage.py migrate front
Operations to perform:
  Apply all migrations: front
Running migrations:
  Applying front.0002_auto_20200119_1707... OK
  Applying front.0003_username_normalization... OK
  Applying front.0004_auto_20200121_1625... OK
  Applying front.0005_remove_user_twitter... OK
  Applying front.0006_change_user_manager... OK
$ python3 manage.py migrate 
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, documents, easy_thumbnails, events, front, lecturers, registration, sessions
Running migrations:
  Applying admin.0001_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
psycopg2.errors.DuplicateTable: relation "django_admin_log" already exists
$ python3 manage.py migrate --fake-initial admin
Operations to perform:
  Apply all migrations: admin
Running migrations:
  Applying admin.0001_initial... FAKED
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
$ python3 manage.py migrate 
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, documents, easy_thumbnails, events, front, lecturers, registration, sessions
Running migrations:
  Applying documents.0002_auto_20161124_2111...Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.DuplicateColumn: column "user_id" of relation "documents_documentrating" already exists

Okay, ev. wurde documents.0002_auto_20161124_2111 doch schon gemacht in der bestehenden Datenbank (TODO: verifizieren) - also mal faken:

$ python3 manage.py migrate --fake documents 0002_auto_20161124_2111
Operations to perform:
  Target specific migration: 0002_auto_20161124_2111, from documents
Running migrations:
  Applying documents.0002_auto_20161124_2111... FAKED

aber danach geht immer noch was schief, bei der Migration, die neu ist:

$ python3 manage.py migrate 
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, documents, easy_thumbnails, events, front, lecturers, registration, sessions
Running migrations:
  Applying documents.0003_auto_20200122_1624...Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 234, in handle
    fake_initial=fake_initial,
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/operations/models.py", line 530, in database_forwards
    getattr(new_model._meta, self.option_name, set()),
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 379, in alter_index_together
    self._delete_composed_index(model, fields, {'index': True}, self.sql_delete_index)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 397, in _delete_composed_index
    ", ".join(columns),
ValueError: Found wrong number (0) of constraints for documents_documentdownload(document_id, timestamp, ip)
The-Compiler commented 4 years ago

@dbrgn

Ich glaube beim Wechsel von South auf Django Migrations muss man einmal mit --fake migrieren, aber ich habe nicht mehr ganz im Kopf wie das genau läuft...

Einmal komplett mit --fake zu migrieren macht meiner Meinung nach keinen Sinn: Seit der Migration von South zu Django kamen ja noch diverse neue Migrationen dazu, und die sollen ja durchaus ausgeführt werden.

Was ich momentan probiere ist, rauszufinden, welche Migrationen schon von South durchgeführt wurden, und die dann mittels --fake zu faken. Leider gibt's aber nicht zwingend ein 1:1-Mapping von South- zu Django-Migrationen wie's ausschaut, zumindest bei easy_thumbnails.

The-Compiler commented 4 years ago

Momentan stecke ich fest bei documents.0002_auto_20161124_2111. Obwohl die letzten South-Migrationen aus dem 2014 sind und diese Migration aus dem 2016, scheint sie auf dem alten Server grösstenteils schon durchgeführt zu sein.

So wird beispielsweise folgendes dort gemacht:

        migrations.AddField(
            model_name='documentrating',
            name='user',
            field=models.ForeignKey(related_name='DocumentRating', to=settings.AUTH_USER_MODEL, on_delete=django.db.models.deletion.CASCADE),
        ),

und in der Datenbank steht bereits:

CREATE TABLE documents_documentrating (                                         
   id integer NOT NULL,                                                        
   user_id integer NOT NULL,                                                   
   document_id integer NOT NULL,                                               
   rating smallint NOT NULL,                                                   
   CONSTRAINT documents_documentrating_rating_check CHECK ((rating >= 0))                                                                                                                                                                                                                                                                                                            );  

ebenso bei:

        migrations.AlterUniqueTogether(
            name='documentrating',
            unique_together=set([('user', 'document')]),
        ),
ALTER TABLE ONLY documents_documentrating                                       
  ADD CONSTRAINT documents_documentrating_user_id_document_id_key UNIQUE (user_id, document_id);    

aber der letzte Schritt darin fehlt:

        migrations.AlterIndexTogether(
            name='documentdownload',
            index_together=set([('document', 'timestamp', 'ip')]),
        ),

finde ich nirgends in der Datenbank, weshalb dann auch die darauffolgende Migration failt:

ValueError: Found wrong number (0) of constraints for documents_documentdownload(document_id, timestamp, ip)

@dbrgn hast du da eine Ahnung, was schiefgelaufen sein könnte? Das index_together scheint in https://github.com/studentenportal/web/commit/1264397230d9e3474ad1c1775050afea74e31b5a dazugekommen zu sein (vorher war nur ein "# TODO django 1.5: index_together on document/timestamp/ip" da), aber diese Änderung hat es wohl nie in die Datenbank vom (alten) studentenportal.ch geschafft.

The-Compiler commented 4 years ago

Workaround für Documents-Migration

Wenn ich die Migration fake:

$ python3 manage.py migrate documents 0002 --fake

und dann von Hand den Index hinzufüge (output via sqlmigrate):

CREATE INDEX "documents_documentdownlo_document_id_timestamp_ip_216f63fd_idx" ON "documents_documentdownload" ("document_id", "timestamp", "ip");

dann komme ich einen Schritt weiter:

events

$ python3 manage.py migrate 
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, documents, easy_thumbnails, events, front, lecturers, registration, sessions
Running migrations:
  Applying documents.0003_auto_20200122_1624... OK
  Applying events.0002_event_author...Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.DuplicateColumn: column "author_id" of relation "events_event" already exists

das scheint tatsächlich auch schon vorhanden zu sein, also wieder mal faken:

$ python3 manage.py migrate --fake events 0002_event_author
Operations to perform:
  Target specific migration: 0002_event_author, from events
Running migrations:
  Applying events.0002_event_author... FAKED

registration

$ python3 manage.py migrate 
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, documents, easy_thumbnails, events, front, lecturers, registration, sessions
Running migrations:
  Applying registration.0001_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
psycopg2.errors.DuplicateTable: relation "registration_registrationprofile" already exists
$ python3 manage.py migrate --fake-initial registration
Operations to perform:
  Apply all migrations: registration
Running migrations:
  Applying registration.0001_initial... FAKED
  Applying registration.0002_registrationprofile_activated... OK
  Applying registration.0003_migrate_activatedstatus... OK
  Applying registration.0004_supervisedregistrationprofile... OK
  Applying registration.0005_activation_key_sha256... OK

sessions

$ python3 manage.py migrate 
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, documents, easy_thumbnails, events, front, lecturers, registration, sessions
Running migrations:
  Applying sessions.0001_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
psycopg2.errors.DuplicateTable: relation "django_session" already exists
$ python3 manage.py migrate --fake-initial sessions
Operations to perform:
  Apply all migrations: sessions
Running migrations:
  Applying sessions.0001_initial... FAKED
$ python3 manage.py migrate 
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, documents, easy_thumbnails, events, front, lecturers, registration, sessions
Running migrations:
  No migrations to apply.

:tada: :sparkles:

Läuft jetzt mal so auf https://new.studentenportal.ch/ - ich würd aber gerne noch nen Weg finden, der etwas weniger Hacks benötigt. Gibt sicher nochmals nen zweiten Anlauf vor der endgültigen Migration.

TODO: Thumbnails scheinen kaputt zu sein! das war nur ich mit deaktiviertem JS

fabianhauser commented 4 years ago

(Würde aber im Zweifel schonmal Zügeln, das können wir auch nach dem Umzug der daten noch fixen.)

The-Compiler commented 4 years ago

Bei der Registrierung (getestet mit open@hsr.ch) haut es mir einen 500er um die Ohren:

Oh, spannend... Das scheint auch irgendwas mit der Datenmigration zu tun haben, das ging davor nämlich noch.

IntegrityError at /accounts/register/
null value in column "last_login" violates not-null constraint
DETAIL:  Failing row contains (4203, pbkdf2_sha256$[...], null, f, open, , , open@hsr.ch, f, f, 2020-03-09 21:30:55.98991+01, ).
The-Compiler commented 4 years ago

Zum Registrierungs-Fehler, siehe die Django 1.8 release notes:

If you are using a custom user model that inherits from AbstractUser, you’ll need to run makemigrations and generate a migration for your app that contains that model.

Bei uns ist in der initialen Migration schon null=True gesetzt:

('last_login', models.DateTimeField(null=True, verbose_name='last login', blank=True)),

In unserem Datenbankschema ist das aber wohl nicht der Fall....

(Würde aber im Zweifel schonmal Zügeln, das können wir auch nach dem Umzug der daten noch fixen.)

Ich guck mir das heute (beim zweiten Testlauf) noch kurz an. Ich würde doch sehr gerne wissen, wo es noch Inkonsistenzen zwischen Datenbankschema und Django gibt in unseren Daten, bevor dann neue Daten dazukommen. Vermutlich würde Postgres dann schon irgendwie meckern falls nicht, aber diese Probleme sind aus meiner Sicht deutlich einfacher behebbar, wenn man das nicht "in production" macht.

(Oder zumindest will ich wissen, wo es denn Inkonsistenzen gibt, bzw. wie gravierend die sind - aber ab dem Punkt ist ein Fix dann auch nicht mehr weit weg.)

The-Compiler commented 4 years ago

(Oder zumindest will ich wissen, wo es denn Inkonsistenzen gibt, bzw. wie gravierend die sind - aber ab dem Punkt ist ein Fix dann auch nicht mehr weit weg.)

Okay, den Punkt nehm ich zurück - es sind deutlich mehr Änderungen, als gedacht: #19. Ich werde einfach das "not null" während den Migrationen korrigieren, alles andere ist relativ irrelevant (zusätzliche Indices, alte Datenleichen, Datentyp-Änderungen die uns vermutlich nicht betreffen).

The-Compiler commented 4 years ago

Zweiter Anlauf

Diesmal in einer etwas anderen Reihenfolge, um einige der Probleme oben zu vermeiden. Hat geklappt: Es trat nur noch ein (erwarteter) Fehler auf:

easy_thumbnails

Diesmal zuerst, weil es beim letzten Mal Probleme gab damit.

$ python3 manage.py migrate --plan easy_thumbnails
Planned operations:
easy_thumbnails.0001_initial
    Create model Source
    Create model Thumbnail
    Alter unique_together for thumbnail (1 constraint(s))
    Alter unique_together for source (1 constraint(s))
easy_thumbnails.0002_thumbnaildimensions
    Create model ThumbnailDimensions
$ python3 manage.py migrate --fake-initial easy_thumbnails
Operations to perform:
  Apply all migrations: easy_thumbnails
Running migrations:
  Applying easy_thumbnails.0001_initial... FAKED
  Applying easy_thumbnails.0002_thumbnaildimensions... OK

contentypes

$ python3 manage.py migrate --plan contenttypes
Planned operations:
contenttypes.0001_initial
    Create model ContentType
    Alter unique_together for contenttype (1 constraint(s))
contenttypes.0002_remove_content_type_name
    Change Meta options on contenttype
    Alter field name on contenttype
    Raw Python operation
    Remove field name from contenttype
$ python3 manage.py migrate --fake-initial contenttypes
Operations to perform:
  Apply all migrations: contenttypes
Running migrations:
  Applying contenttypes.0001_initial... FAKED
  Applying contenttypes.0002_remove_content_type_name... OK

auth

$ python3 manage.py migrate --plan auth
Planned operations:
auth.0001_initial
    Create model Permission
    Create model Group
    Create model User
auth.0002_alter_permission_name_max_length
    Alter field name on permission
auth.0003_alter_user_email_max_length
    Alter field email on user
auth.0004_alter_user_username_opts
    Alter field username on user
auth.0005_alter_user_last_login_null
    Alter field last_login on user
auth.0006_require_contenttypes_0002
auth.0007_alter_validators_add_error_messages
    Alter field username on user
auth.0008_alter_user_username_max_length
    Alter field username on user
auth.0009_alter_user_last_name_max_length
    Alter field last_name on user
auth.0010_alter_group_name_max_length
    Alter field name on group
auth.0011_update_proxy_permissions
    Raw Python operation ->     Update the content_type of prox…
$ python3 manage.py migrate --fake-initial auth
Operations to perform:
  Apply all migrations: auth
Running migrations:
  Applying auth.0001_initial... FAKED
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK

sessions

$ python3 manage.py migrate --plan sessions
Planned operations:
sessions.0001_initial
    Create model Session
$ python3 manage.py migrate --fake-initial sessions
Operations to perform:
  Apply all migrations: sessions
Running migrations:
  Applying sessions.0001_initial... FAKED

registration

$ python3 manage.py migrate --plan registration
Planned operations:
front.0001_initial
    Create model User
registration.0001_initial
    Create model RegistrationProfile
registration.0002_registrationprofile_activated
    Add field activated to registrationprofile
registration.0003_migrate_activatedstatus
    Raw Python operation
registration.0004_supervisedregistrationprofile
    Create model SupervisedRegistrationProfile
registration.0005_activation_key_sha256
    Alter field activation_key on registrationprofile
$ python3 manage.py migrate --fake-initial registration
Operations to perform:
  Apply all migrations: registration
Running migrations:
  Applying front.0001_initial... FAKED
  Applying registration.0001_initial... FAKED
  Applying registration.0002_registrationprofile_activated... OK
  Applying registration.0003_migrate_activatedstatus... OK
  Applying registration.0004_supervisedregistrationprofile... OK
  Applying registration.0005_activation_key_sha256... OK

(Achtung: hat die initial migration von front gefaked, sollte aber hoffentlich klappen)

front

$ python3 manage.py migrate --fake-initial front
Operations to perform:
  Apply all migrations: front
Running migrations:
  Applying front.0002_auto_20200119_1707... OK
  Applying front.0003_username_normalization... OK
  Applying front.0004_auto_20200121_1625... OK
  Applying front.0005_remove_user_twitter... OK
  Applying front.0006_change_user_manager... OK

events

$ python3 manage.py migrate --plan events
Planned operations:
events.0001_initial
    Create model Event
events.0002_event_author
    Add field author to event
$ python3 manage.py migrate --fake events 0002
Operations to perform:
  Target specific migration: 0002_event_author, from events
Running migrations:
  Applying events.0001_initial... FAKED
  Applying events.0002_event_author... FAKED

(--fake events 0002 statt --fake-initial weil events_event bereits eine Spalte author_id hat)

$ python3 manage.py migrate events
Operations to perform:
  Apply all migrations: events
Running migrations:
  No migrations to apply.

lecturers

$ python3 manage.py migrate --plan lecturers
Planned operations:
lecturers.0001_initial
    Create model Course
    Create model Lecturer
    Create model LecturerRating
    Create model Quote
    Create model QuoteVote
    Alter unique_together for quotevote (1 constraint(s))
    Alter unique_together for lecturerrating (1 constraint(s))
$ python3 manage.py migrate --fake-initial lecturers
Operations to perform:
  Apply all migrations: lecturers
Running migrations:
  Applying lecturers.0001_initial... FAKED

documents

$ python3 manage.py migrate --plan documents
Planned operations:
documents.0001_initial
    Create model Document
    Create model DocumentCategory
    Create model DocumentDownload
    Create model DocumentRating
documents.0002_auto_20161124_2111
    Add field user to documentrating
    Add field document to documentdownload
    Add field courses to documentcategory
    Add field lecturers to documentcategory
    Add field category to document
    Add field uploader to document
    Alter unique_together for documentrating (1 constraint(s))
    Alter index_together for documentdownload (1 constraint(s))
documents.0003_auto_20200122_1624
    Alter index_together for documentdownload (1 constraint(s))
    Remove field ip from documentdownload
$ python3 manage.py migrate --fake documents 0002
Operations to perform:
  Target specific migration: 0002_auto_20161124_2111, from documents
Running migrations:
  Applying documents.0001_initial... FAKED
  Applying documents.0002_auto_20161124_2111... FAKED

Danach wie erwartet ein Fehler:

$ python3 manage.py migrate documents
Operations to perform:
  Apply all migrations: documents
Running migrations:
  Applying documents.0003_auto_20200122_1624...Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 234, in handle
    fake_initial=fake_initial,
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python3.7/site-packages/django/db/migrations/operations/models.py", line 530, in database_forwards
    getattr(new_model._meta, self.option_name, set()),
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 379, in alter_index_together
    self._delete_composed_index(model, fields, {'index': True}, self.sql_delete_index)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 397, in _delete_composed_index
    ", ".join(columns),
ValueError: Found wrong number (0) of constraints for documents_documentdownload(document_id, timestamp, ip)

Fixups von Hand

CREATE INDEX "documents_documentdownlo_document_id_timestamp_ip_216f63fd_idx" ON "documents_documentdownload" ("document_id", "timestamp", "ip");
ALTER TABLE "front_user" ALTER COLUMN last_login DROP NOT NULL;
$ psql -U studentenportal -h postgres studentenportal
Password for user studentenportal: 
psql (11.5 (Debian 11.5-1+deb10u1), server 12.2 (Debian 12.2-2.pgdg100+1))
WARNING: psql major version 11, server major version 12.
         Some psql features might not work.
Type "help" for help.

studentenportal=# CREATE INDEX "documents_documentdownlo_document_id_timestamp_ip_216f63fd_idx" ON "documents_documentdownload" ("document_id", "timestamp", "ip");
CREATE INDEX

studentenportal=# ALTER TABLE "front_user" ALTER COLUMN last_login DROP NOT NULL;
ALTER TABLE

studentenportal=# \q
could not save history to file "/home/studentenportal/.psql_history": No such file or directory

documents 2

$ python3 manage.py migrate documents
Operations to perform:
  Apply all migrations: documents
Running migrations:
  Applying documents.0003_auto_20200122_1624... OK

admin

$ python3 manage.py migrate --plan admin
Planned operations:
admin.0001_initial
    Create model LogEntry
admin.0002_logentry_remove_auto_add
    Alter field action_time on logentry
admin.0003_logentry_add_action_flag_choices
    Alter field action_flag on logentry
$ python3 manage.py migrate --fake-initial admin
Operations to perform:
  Apply all migrations: admin
Running migrations:
  Applying admin.0001_initial... FAKED
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
$ python3 manage.py migrate --fake-initial admin
Operations to perform:
  Apply all migrations: admin
Running migrations:
  Applying admin.0001_initial... FAKED
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK

done

$ python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, documents, easy_thumbnails, events, front, lecturers, registration, sessions
Running migrations:
  No migrations to apply.

Sieht also super aus. Registrierung geht jetzt auch (hab's auch einfach mal frech mit open@hsr.ch getestet).

Heisst: Ich bin mir ziemlich sicher, dass ich heute die Migration reibungslos durchführen kann!

The-Compiler commented 4 years ago

Hab noch ein bisschen mit Docker gekämpft (https://github.com/studentenportal/web/issues/248 passierte dann auch auf einmal da) - aber jetzt läuft alles wieder rund, inklusive den neuen Daten. Wheeeeeeee!