Skip to content

Instantly share code, notes, and snippets.

@Mrnikbobjeff
Last active December 11, 2021 12:10
Show Gist options
  • Save Mrnikbobjeff/1107c631ebb049f366b7ce47e10b78bf to your computer and use it in GitHub Desktop.
Save Mrnikbobjeff/1107c631ebb049f366b7ce47e10b78bf to your computer and use it in GitHub Desktop.
create table Users(
user_id INT NOT NULL AUTO_INCREMENT,
user_name VARCHAR(40) NOT NULL,
PRIMARY KEY ( user_id )
);
create table Documents(
doc_id INT NOT NULL AUTO_INCREMENT,
originalname VARCHAR(400) NOT NULL,
owner_id INT NOT NULL,
size INT NOT NULL,
CONSTRAINT owner_id_fk_userId
FOREIGN KEY (owner_id)
REFERENCES Users(user_id),
PRIMARY KEY ( doc_id )
);
create table DocumentContent(
id INT NOT NULL AUTO_INCREMENT,
originalPath VARCHAR(400) NOT NULL,
extractedPath VARCHAR(400) NOT NULL,
doc_id INT NOT NULL,
CONSTRAINT doc_content_fk_docId
FOREIGN KEY (doc_id)
REFERENCES Documents(doc_id),
PRIMARY KEY ( id )
);
INSERT INTO Users(user_name) VALUES ('niklas');
INSERT INTO Users(user_name) VALUES ('david');
INSERT INTO Users(user_name) VALUES ('robert');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment