Skip to content

davi-marangoni/movie-watchlist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Movie Watchlist

Description

Another simple prompt aplication to test some functions of python and psychopg2

Technologies Used

  • Python 3.10
  • Psychopg2 2.9.6
  • PostgreSQL 15.3
  • Docker 24.0.2
  • Docker Compose 2.18.1

How to run

  1. Clone this repository
$ [email protected]:davi-marangoni/movie-watchlist.git
  1. Install the psycopg2 library
$ pip install psycopg2
  1. Install Docker and Docker Compose
 $ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
 $ sudo apt-get install docker-compose-plugin
  1. Create the docker.compose.yml file and run
version: '3'
services:
  postgres:
    image: postgres:latest
    restart: always
    ports:
      - '5432:5432'
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=postgres
    volumes:
      - ./data:/var/lib/postgresql/data
$ docker compose up -d
  1. Create the database and table's
CREATE DATABASE watchlist;

CREATE TABLE public.movies (
	id serial4 NOT NULL,
	title text NULL,
	release_timestamp float4 NULL,
	CONSTRAINT movies_pkey PRIMARY KEY (id)
);
CREATE INDEX idx_movies_release ON public.movies USING btree (release_timestamp);

CREATE TABLE public.users (
	username text NOT NULL,
	CONSTRAINT users_pkey PRIMARY KEY (username)
);

CREATE TABLE public.watched (
	username text NULL,
	movie_id int4 NULL
);
ALTER TABLE public.watched ADD CONSTRAINT watched_movie_id_fkey FOREIGN KEY (movie_id) REFERENCES public.movies(id);
ALTER TABLE public.watched ADD CONSTRAINT watched_user_name_fkey FOREIGN KEY (username) REFERENCES public.users(username);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages