feat: changed primary key of facts table
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
.env
|
||||
.venv
|
||||
sec_data/
|
||||
CIK*
|
||||
CIK*
|
||||
.vscode
|
||||
@@ -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)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user