text: CREATE DATABASE foodfy
  
  CREATE TABLE "recipes" (
    "id" SERIAL PRIMARY KEY,
    "chef_id" int NOT NULL,
    "title" text NOT NULL,
    "information" text,
    "preparations" text[],
    "ingredients" text[],
    "user_id" int NOT NULL,
    "created_at" timestamp DEFAULT (now()),
    "updated_at" timestamp DEFAULT (now())
  );
  
  CREATE TABLE "chefs" (
    "id" SERIAL PRIMARY KEY,
    "name" text NOT NULL,
    "file_id" int,
    "created_at" timestamp DEFAULT (now()),
    "updated_at" timestamp DEFAULT (now())
  );
  
  CREATE TABLE "files" (
    "id" SERIAL PRIMARY KEY,
    "name" text,
    "path" text NOT NULL
  );
  
  CREATE TABLE "recipe_files" (
    "id" SERIAL PRIMARY KEY,
    "recipe_id" int,
    "file_id" int
  );
  
  CREATE TABLE "users" (
    "id" SERIAL PRIMARY KEY,
    "name" text NOT NULL,
    "email" text NOT NULL UNIQUE,
    "password" text NOT NULL,
    "reset_token" text,
    "reset_token_expires" text,
    "is_admin" boolean DEFAULT false,
    "created_at" timestamp DEFAULT (now()),
    "updated_at" timestamp DEFAULT (now())
  );
  
  ALTER TABLE "recipes" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id");
  
  ALTER TABLE "recipes" ADD FOREIGN KEY ("chef_id") REFERENCES "chefs" ("id");
  
  ALTER TABLE "recipe_files" ADD FOREIGN KEY ("recipe_id") REFERENCES "recipes" ("id");
  
  ALTER TABLE "recipe_files" ADD FOREIGN KEY ("file_id") REFERENCES "files" ("id");
  
  ALTER TABLE "chefs" ADD FOREIGN KEY ("file_id") REFERENCES "files" ("id");
  
  CREATE TABLE "session" (
    "sid" varchar NOT NULL COLLATE "default",
    "sess" json NOT NULL,
    "expire" timestamp(6) NOT NULL
  )
  WITH (OIDS=FALSE);
  ALTER TABLE "session" 
  ADD CONSTRAINT "session_pkey" 
  PRIMARY KEY ("sid") NOT DEFERRABLE INITIALLY IMMEDIATE;
  
  CREATE FUNCTION trigger_set_timestamp()
  RETURNS TRIGGER AS $$
  BEGIN 
  	NEW.updated_at = NOW();
    RETURN NEW;
  END
    $$ LANGUAGE plpgsql;
    
  CREATE TRIGGER set_timestamp
  BEFORE UPDATE ON recipes
  FOR EACH ROW 
  EXECUTE PROCEDURE trigger_set_timestamp();
  
  CREATE TRIGGER set_timestamp
  BEFORE UPDATE ON chefs
  FOR EACH ROW 
  EXECUTE PROCEDURE trigger_set_timestamp();
  
  CREATE TRIGGER set_timestamp
  BEFORE UPDATE ON users
  FOR EACH ROW 
  EXECUTE PROCEDURE trigger_set_timestamp();
  
  -- if you need reset the database
  DROP DATABASE IF EXISTS foodfy
  
  DELETE FROM recipe_files;
  DELETE FROM recipes;
  DELETE FROM users;
  DELETE FROM chefs;
  DELETE FROM files;
  
  
  ALTER SEQUENCE users_id_seq RESTART WITH 1;
  ALTER SEQUENCE chefs_id_seq RESTART WITH 1;
  ALTER SEQUENCE recipes_id_seq RESTART WITH 1;
  ALTER SEQUENCE recipe_files_id_seq RESTART WITH 1;
  ALTER SEQUENCE files_id_seq RESTART WITH 1;