diff --git a/postgres/CreateTables.py b/postgres/CreateTables.py index 3c470ef..8e027cc 100644 --- a/postgres/CreateTables.py +++ b/postgres/CreateTables.py @@ -84,7 +84,7 @@ def create_dockets_table(conn: psycopg.Connection): def create_documents_table(conn: psycopg.Connection): query = """ - CREATE TABLE documents ( + CREATE TABLE documentsWithFRDoc ( document_id VARCHAR(50) NOT NULL PRIMARY KEY, document_api_link VARCHAR(2000) NOT NULL UNIQUE, address1 VARCHAR(200), @@ -126,10 +126,42 @@ def create_documents_table(conn: psycopg.Connection): document_title VARCHAR(500), topics VARCHAR(250)[], is_withdrawn BOOLEAN DEFAULT FALSE, - postal_code VARCHAR(10) + postal_code VARCHAR(10), + frdocnum VARCHAR(50), + attachments_self_link VARCHAR(2000), + attachments_related_link VARCHAR(2000), + file_formats JSONB, + display_properties JSONB ); """ - _create_table(conn, query, "documents") + _create_table(conn, query, "documentsWithFRDoc") + +def create_federal_register_docs_table(conn: psycopg.Connection): + query = """ + CREATE TABLE federal_register_documents ( + document_number VARCHAR(50) NOT NULL PRIMARY KEY, + document_id VARCHAR(50), + document_title TEXT, + document_type VARCHAR(50), + abstract TEXT, + publication_date DATE, + effective_on DATE, + docket_ids TEXT[], + agency_id VARCHAR(20), + agency_names TEXT[], + topics TEXT[], + significant BOOLEAN, + regulation_id_numbers TEXT[], + html_url VARCHAR(2000), + pdf_url VARCHAR(2000), + json_url VARCHAR(2000), + start_page INTEGER, + title VARCHAR(50), + cfrpart VARCHAR(50), + end_page INTEGER + ); + """ + _create_table(conn, query, "federal_register_documents") def main(): @@ -155,6 +187,7 @@ def main(): create_dockets_table(conn) create_documents_table(conn) create_comments_table(conn) + create_federal_register_docs_table(conn) conn.close() diff --git a/postgres/DropTables.py b/postgres/DropTables.py index aa9c84e..78eb7ad 100644 --- a/postgres/DropTables.py +++ b/postgres/DropTables.py @@ -41,7 +41,10 @@ def drop_dockets_table(conn: psycopg.Connection): def drop_documents_table(conn: psycopg.Connection): - _drop_table(conn, "documents") + _drop_table(conn, "documentsWithFRDoc") + +def drop_fed_reg_docs_table(conn: psycopg.Connection): + _drop_table(conn, "federal_register_documents") def main(): @@ -69,6 +72,7 @@ def main(): drop_comments_table(conn) drop_dockets_table(conn) drop_documents_table(conn) + drop_fed_reg_docs_table(conn) conn.close()