feat: changed primary key of facts table
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.env
|
.env
|
||||||
.venv
|
.venv
|
||||||
sec_data/
|
sec_data/
|
||||||
CIK*
|
CIK*
|
||||||
|
.vscode
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
CREATE TABLE entities (
|
CREATE TABLE entities (
|
||||||
cik INT PRIMARY KEY, -- CIK is now the primary key, ensuring uniqueness
|
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 (
|
CREATE TABLE facts (
|
||||||
|
id VARCHAR(255) PRIMARY KEY, -- Unique identifier for the fact
|
||||||
taxonomy VARCHAR(255), -- Taxonomy of 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
|
label VARCHAR(255), -- Label of the fact
|
||||||
description TEXT, -- Description of the fact
|
description TEXT, -- Description of the fact
|
||||||
unit VARCHAR(255), -- Unit of the fact
|
unit VARCHAR(255), -- Unit of the fact
|
||||||
@@ -13,7 +13,7 @@ CREATE TABLE facts (
|
|||||||
|
|
||||||
CREATE TABLE data (
|
CREATE TABLE data (
|
||||||
cik INT, -- CIK of the company
|
cik INT, -- CIK of the company
|
||||||
fact VARCHAR(255),
|
fact_id VARCHAR(255),
|
||||||
start DATE, -- Start date of the fact
|
start DATE, -- Start date of the fact
|
||||||
end DATE,
|
end DATE,
|
||||||
val INT,
|
val INT,
|
||||||
@@ -25,5 +25,5 @@ CREATE TABLE data (
|
|||||||
frame VARCHAR(255),
|
frame VARCHAR(255),
|
||||||
PRIMARY KEY (cik, label)
|
PRIMARY KEY (cik, label)
|
||||||
FOREIGN KEY (cik) REFERENCES entities(cik),
|
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