feat: changed primary key of facts table

This commit is contained in:
Leonard Excoffier
2024-08-29 21:35:30 -04:00
parent 97bd73c4a3
commit d5d823b290
2 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
.venv
sec_data/
CIK*
.vscode

View File

@@ -1,11 +1,11 @@
CREATE TABLE entities (
cik INT PRIMARY KEY, -- CIK is now the primary key, ensuring uniqueness
entityName VARCHAR(255) NOT NULL -- Name of the company
name VARCHAR(255) NOT NULL -- Name of the company
);
CREATE TABLE facts (
id VARCHAR(255) PRIMARY KEY, -- Unique identifier for the fact
taxonomy VARCHAR(255), -- Taxonomy of the fact
fact VARCHAR(255) PRIMARY KEY, -- Label of the fact
label VARCHAR(255), -- Label of the fact
description TEXT, -- Description of the fact
unit VARCHAR(255), -- Unit of the fact
@@ -13,7 +13,7 @@ CREATE TABLE facts (
CREATE TABLE data (
cik INT, -- CIK of the company
fact VARCHAR(255),
fact_id VARCHAR(255),
start DATE, -- Start date of the fact
end DATE,
val INT,
@@ -25,5 +25,5 @@ CREATE TABLE data (
frame VARCHAR(255),
PRIMARY KEY (cik, label)
FOREIGN KEY (cik) REFERENCES entities(cik),
FOREIGN KEY (fact) REFERENCES facts(fact)
FOREIGN KEY (fact_id) REFERENCES facts(id)
);