feat: db schema has now a base
This commit is contained in:
@@ -1,4 +1,27 @@
|
|||||||
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
|
entityName VARCHAR(255) NOT NULL -- Name of the company
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE facts (
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE data (
|
||||||
|
cik INT, -- CIK of the company
|
||||||
|
fact VARCHAR(255),
|
||||||
|
end DATE,
|
||||||
|
val INT,
|
||||||
|
accn VARCHAR(255),
|
||||||
|
fy INT,
|
||||||
|
fp VARCHAR(255),
|
||||||
|
form VARCHAR(255),
|
||||||
|
filed DATE,
|
||||||
|
frame VARCHAR(255),
|
||||||
|
PRIMARY KEY (cik, label)
|
||||||
|
FOREIGN KEY (cik) REFERENCES entities(cik),
|
||||||
|
FOREIGN KEY (fact) REFERENCES facts(fact)
|
||||||
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user