\c santander;



------------------------
-- Table `santander`.`keyword`
------------------

CREATE TABLE IF NOT EXISTS keyword (
  
	idkeyword serial NOT NULL,
  
	nombre VARCHAR(45) NULL,
  
	PRIMARY KEY (idkeyword)
)
;
 
-----------------------
-- Table `santander`.`tweet`
----------------------

CREATE TABLE IF NOT EXISTS tweet (
  
	idtweet serial NOT NULL,
  
	data jsonb NULL,
  
	timestamp TIMESTAMP NULL,
  
	keyword_idkeyword INT NOT NULL,

	PRIMARY KEY (idtweet)
  
	,
  
	CONSTRAINT fk_tweet_keyword 
	FOREIGN KEY (keyword_idkeyword)
	REFERENCES keyword (idkeyword)
	ON DELETE NO ACTION

	ON UPDATE NO ACTION
);


CREATE INDEX fk_tweet_keyword_idx ON tweet (keyword_idkeyword ASC);