2025-08-04 17:45:44 +02:00
|
|
|
--
|
|
|
|
|
-- Name: adminpack; Type: EXTENSION; Schema: -; Owner: -
|
|
|
|
|
--
|
|
|
|
|
CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner:
|
|
|
|
|
--
|
|
|
|
|
COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL';
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: BanType; Type: TYPE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE TYPE public."BanType" AS ENUM ('ip', 'email', 'phone', 'cf');
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
ALTER TYPE public."BanType" OWNER TO postgres;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: GenericStatusEnum; Type: TYPE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE TYPE public."GenericStatusEnum" AS ENUM ('pending', 'success', 'failed');
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
ALTER TYPE public."GenericStatusEnum" OWNER TO postgres;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: OrderTypeEnum; Type: TYPE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TYPE public."OrderTypeEnum" AS ENUM (
|
|
|
|
|
'Acconto',
|
|
|
|
|
'Saldo',
|
|
|
|
|
'Consulenza',
|
|
|
|
|
'Altro'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
ALTER TYPE public."OrderTypeEnum" OWNER TO postgres;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: PaymentStatusEnum; Type: TYPE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE TYPE public."PaymentStatusEnum" AS ENUM ('processing', 'success', 'failed');
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
ALTER TYPE public."PaymentStatusEnum" OWNER TO postgres;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: TipologiaPosizioneEnum; Type: TYPE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE TYPE public."TipologiaPosizioneEnum" AS ENUM ('Transitorio', 'Stabile');
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
ALTER TYPE public."TipologiaPosizioneEnum" OWNER TO postgres;
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
SET
|
|
|
|
|
default_tablespace = '';
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
SET
|
|
|
|
|
default_table_access_method = heap;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: annunci; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.annunci (
|
|
|
|
|
id integer NOT NULL,
|
|
|
|
|
codice text NOT NULL,
|
|
|
|
|
locatore text,
|
|
|
|
|
numero text,
|
|
|
|
|
idlocatore text,
|
|
|
|
|
indirizzo text,
|
|
|
|
|
civico text,
|
|
|
|
|
comune text,
|
|
|
|
|
cap text,
|
|
|
|
|
provincia text,
|
|
|
|
|
regione text,
|
|
|
|
|
lat text,
|
|
|
|
|
lon text,
|
|
|
|
|
indirizzo_secondario text,
|
|
|
|
|
civico_secondario text,
|
|
|
|
|
lat_secondario text,
|
|
|
|
|
lon_secondario text,
|
|
|
|
|
tipo text,
|
2025-10-29 11:06:53 +01:00
|
|
|
categorie text [],
|
2025-08-04 17:45:44 +02:00
|
|
|
prezzo integer DEFAULT 0 NOT NULL,
|
|
|
|
|
anno text,
|
|
|
|
|
classe text,
|
|
|
|
|
mq numeric,
|
|
|
|
|
piano text,
|
|
|
|
|
piano_palazzo integer,
|
|
|
|
|
unita_condominio integer,
|
|
|
|
|
numero_vani integer,
|
|
|
|
|
numero_camere integer,
|
|
|
|
|
numero_bagni integer,
|
|
|
|
|
numero_balconi integer,
|
|
|
|
|
numero_terrazzi integer,
|
|
|
|
|
numero_box integer,
|
|
|
|
|
numero_postiauto integer,
|
2025-10-29 11:06:53 +01:00
|
|
|
accessori text [],
|
2025-08-04 17:45:44 +02:00
|
|
|
titolo_it text,
|
|
|
|
|
desc_it text,
|
|
|
|
|
titolo_en text,
|
|
|
|
|
desc_en text,
|
|
|
|
|
stato text,
|
|
|
|
|
web boolean,
|
|
|
|
|
caratteristiche json,
|
|
|
|
|
homepage boolean,
|
2025-10-29 11:06:53 +01:00
|
|
|
url_video text [],
|
2025-08-04 17:45:44 +02:00
|
|
|
email text,
|
|
|
|
|
creato_il timestamp without time zone,
|
|
|
|
|
modificato_il timestamp without time zone,
|
2025-08-16 19:38:38 +02:00
|
|
|
consegna integer,
|
2025-08-29 10:28:15 +02:00
|
|
|
disponibile_da date,
|
2025-10-29 11:06:53 +01:00
|
|
|
permanenza integer [],
|
|
|
|
|
persone text [],
|
2025-10-29 09:39:06 +01:00
|
|
|
updated_at timestamp without time zone
|
2025-08-04 17:45:44 +02:00
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.annunci OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: COLUMN annunci.caratteristiche; Type: COMMENT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
COMMENT ON COLUMN public.annunci.caratteristiche IS '@type(Caratteristiche, ''src/utils/kanel-types.ts'', false, false, true)';
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: annunci_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE SEQUENCE public.annunci_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
ALTER SEQUENCE public.annunci_id_seq OWNER TO postgres;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: annunci_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
ALTER SEQUENCE public.annunci_id_seq OWNED BY public.annunci.id;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: banlist; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.banlist (
|
|
|
|
|
id integer NOT NULL,
|
|
|
|
|
value text NOT NULL,
|
|
|
|
|
type public."BanType" NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.banlist OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: banlist_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE SEQUENCE public.banlist_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
ALTER SEQUENCE public.banlist_id_seq OWNER TO postgres;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: banlist_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
ALTER SEQUENCE public.banlist_id_seq OWNED BY public.banlist.id;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: banners; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.banners (
|
|
|
|
|
idbanner text NOT NULL,
|
|
|
|
|
titolo text,
|
|
|
|
|
testo text,
|
|
|
|
|
is_unskippable boolean NOT NULL,
|
|
|
|
|
has_cta boolean NOT NULL,
|
|
|
|
|
cta_href text,
|
|
|
|
|
cta_icon text,
|
|
|
|
|
cta_text text,
|
|
|
|
|
color text,
|
|
|
|
|
is_active boolean NOT NULL,
|
|
|
|
|
show_public boolean NOT NULL,
|
|
|
|
|
show_private boolean NOT NULL,
|
|
|
|
|
hide_duration integer
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.banners OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: chats; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.chats (
|
|
|
|
|
chatid uuid DEFAULT gen_random_uuid() NOT NULL,
|
|
|
|
|
created_at timestamp without time zone NOT NULL,
|
|
|
|
|
user_ref uuid NOT NULL,
|
2025-10-29 11:06:53 +01:00
|
|
|
tags text []
|
2025-08-04 17:45:44 +02:00
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.chats OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: chats_etichette; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.chats_etichette (
|
|
|
|
|
chatid uuid NOT NULL,
|
|
|
|
|
etichettaid integer NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.chats_etichette OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: emails; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.emails (
|
|
|
|
|
id_email integer NOT NULL,
|
|
|
|
|
user_id uuid NOT NULL,
|
|
|
|
|
created_at timestamp without time zone DEFAULT now() NOT NULL,
|
|
|
|
|
data json NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.emails OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: emails_id_email_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE SEQUENCE public.emails_id_email_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
ALTER SEQUENCE public.emails_id_email_seq OWNER TO postgres;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: emails_id_email_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
ALTER SEQUENCE public.emails_id_email_seq OWNED BY public.emails.id_email;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: etichette; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.etichette (
|
|
|
|
|
id_etichetta integer NOT NULL,
|
|
|
|
|
title text NOT NULL,
|
|
|
|
|
color_hex character varying(7) NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.etichette OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: etichette_id_etichetta_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE SEQUENCE public.etichette_id_etichetta_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
ALTER SEQUENCE public.etichette_id_etichetta_seq OWNER TO postgres;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: etichette_id_etichetta_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
ALTER SEQUENCE public.etichette_id_etichetta_seq OWNED BY public.etichette.id_etichetta;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: event_queue; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.event_queue (
|
|
|
|
|
event_id integer NOT NULL,
|
|
|
|
|
lock_expires timestamp with time zone NOT NULL,
|
|
|
|
|
data jsonb,
|
2025-10-29 11:06:53 +01:00
|
|
|
status text DEFAULT 'pending' :: text NOT NULL
|
2025-08-04 17:45:44 +02:00
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.event_queue OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: event_queue_event_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE SEQUENCE public.event_queue_event_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
ALTER SEQUENCE public.event_queue_event_id_seq OWNER TO postgres;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: event_queue_event_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
ALTER SEQUENCE public.event_queue_event_id_seq OWNED BY public.event_queue.event_id;
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: flags; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
CREATE TABLE public.flags (id text NOT NULL, value text NOT NULL);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.flags OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-10-29 09:39:06 +01:00
|
|
|
--
|
|
|
|
|
-- Name: images_refs; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.images_refs (
|
|
|
|
|
codice text NOT NULL,
|
|
|
|
|
ordine integer NOT NULL,
|
|
|
|
|
img text NOT NULL,
|
|
|
|
|
thumb text NOT NULL,
|
|
|
|
|
og_url text NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.images_refs OWNER TO postgres;
|
2025-10-29 09:39:06 +01:00
|
|
|
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
|
|
|
|
-- Name: messages; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.messages (
|
|
|
|
|
messageid uuid DEFAULT gen_random_uuid() NOT NULL,
|
|
|
|
|
chatid uuid NOT NULL,
|
|
|
|
|
message text,
|
|
|
|
|
"time" timestamp without time zone NOT NULL,
|
|
|
|
|
isread boolean DEFAULT false NOT NULL,
|
|
|
|
|
sender uuid NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.messages OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: ordini; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.ordini (
|
|
|
|
|
ordine_id uuid DEFAULT gen_random_uuid() NOT NULL,
|
|
|
|
|
userid uuid NOT NULL,
|
|
|
|
|
created_at timestamp without time zone DEFAULT now() NOT NULL,
|
|
|
|
|
packid text NOT NULL,
|
|
|
|
|
servizio_id uuid NOT NULL,
|
|
|
|
|
type public."OrderTypeEnum" NOT NULL,
|
|
|
|
|
"isActive" boolean DEFAULT false NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.ordini OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: payments; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.payments (
|
|
|
|
|
id uuid DEFAULT gen_random_uuid() NOT NULL,
|
|
|
|
|
userid uuid NOT NULL,
|
|
|
|
|
amount_cent integer NOT NULL,
|
|
|
|
|
created_at timestamp without time zone DEFAULT now() NOT NULL,
|
|
|
|
|
paymentmethod text,
|
|
|
|
|
paymentname text NOT NULL,
|
|
|
|
|
paid_at timestamp without time zone,
|
|
|
|
|
intent_id text,
|
|
|
|
|
paymentstatus public."PaymentStatusEnum",
|
|
|
|
|
servizio_id uuid NOT NULL,
|
|
|
|
|
ordine_id uuid NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.payments OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: prezziario; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.prezziario (
|
|
|
|
|
idprezziario text NOT NULL,
|
|
|
|
|
prezzo_cent integer NOT NULL,
|
|
|
|
|
testo_condizioni text,
|
|
|
|
|
"isActive" boolean DEFAULT true NOT NULL,
|
|
|
|
|
nome_it text NOT NULL,
|
|
|
|
|
nome_en text NOT NULL,
|
|
|
|
|
desc_it text NOT NULL,
|
|
|
|
|
desc_en text NOT NULL,
|
|
|
|
|
sconto integer DEFAULT 0 NOT NULL,
|
|
|
|
|
"isAcconto" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"isSaldo" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"isConsulenza" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"isStabile" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"isTransitorio" boolean DEFAULT false NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.prezziario OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: ratelimiter; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.ratelimiter (
|
|
|
|
|
key text NOT NULL,
|
|
|
|
|
request_timestamp timestamp without time zone NOT NULL,
|
|
|
|
|
request_count integer NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.ratelimiter OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: servizio; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.servizio (
|
|
|
|
|
user_id uuid NOT NULL,
|
|
|
|
|
created_at timestamp without time zone DEFAULT now() NOT NULL,
|
|
|
|
|
tipologia public."TipologiaPosizioneEnum" NOT NULL,
|
|
|
|
|
arredato boolean DEFAULT false NOT NULL,
|
|
|
|
|
budget integer NOT NULL,
|
|
|
|
|
n_adulti integer NOT NULL,
|
|
|
|
|
n_minori integer NOT NULL,
|
|
|
|
|
animali boolean DEFAULT false NOT NULL,
|
|
|
|
|
fumatori boolean DEFAULT false NOT NULL,
|
|
|
|
|
giardino boolean DEFAULT false NOT NULL,
|
|
|
|
|
parcheggio boolean DEFAULT false NOT NULL,
|
|
|
|
|
terrazzo boolean DEFAULT false NOT NULL,
|
|
|
|
|
ascensore boolean DEFAULT false NOT NULL,
|
|
|
|
|
pianoterra boolean DEFAULT false NOT NULL,
|
|
|
|
|
motivazione_transitorio text,
|
|
|
|
|
reddito text,
|
|
|
|
|
"isSent" boolean DEFAULT false NOT NULL,
|
|
|
|
|
servizio_id uuid DEFAULT gen_random_uuid() NOT NULL,
|
|
|
|
|
decorrenza timestamp without time zone,
|
|
|
|
|
"isInterrotto" boolean DEFAULT false NOT NULL,
|
|
|
|
|
entromese integer,
|
|
|
|
|
permanenza integer,
|
|
|
|
|
"isOkAcconto" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"isOkSaldo" boolean DEFAULT false NOT NULL,
|
2025-10-29 09:39:06 +01:00
|
|
|
"isOkConsulenza" boolean DEFAULT false NOT NULL,
|
|
|
|
|
doc_personale_fronte_ref uuid,
|
|
|
|
|
doc_personale_retro_ref uuid,
|
|
|
|
|
doc_motivazione_ref uuid
|
2025-08-04 17:45:44 +02:00
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.servizio OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: servizio_annunci; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.servizio_annunci (
|
|
|
|
|
servizio_id uuid NOT NULL,
|
|
|
|
|
annunci_id integer NOT NULL,
|
|
|
|
|
created_at timestamp without time zone DEFAULT now() NOT NULL,
|
|
|
|
|
open_contatti_at timestamp without time zone,
|
2025-10-29 09:39:06 +01:00
|
|
|
doc_conferma_ref text,
|
2025-08-04 17:45:44 +02:00
|
|
|
user_confirmed_at timestamp without time zone,
|
|
|
|
|
accettato_conferma_at timestamp without time zone,
|
|
|
|
|
caparra_causale text,
|
|
|
|
|
caparra_iban text,
|
|
|
|
|
caparra_importo text,
|
|
|
|
|
caparra_intestazione text,
|
|
|
|
|
"hasConfermaAdmin" boolean DEFAULT false NOT NULL,
|
2025-10-29 09:39:06 +01:00
|
|
|
doc_contratto_ref text,
|
2025-08-04 17:45:44 +02:00
|
|
|
gestionale_id integer,
|
|
|
|
|
contratto_decorrenza date,
|
|
|
|
|
contratto_scadenza date,
|
|
|
|
|
contratto_tipo text,
|
2025-10-29 09:39:06 +01:00
|
|
|
doc_registrazione_ref text,
|
2025-08-04 17:45:44 +02:00
|
|
|
doc_conferma_added boolean DEFAULT false NOT NULL,
|
|
|
|
|
doc_contratto_added boolean DEFAULT false NOT NULL,
|
|
|
|
|
doc_registrazione_added boolean DEFAULT false NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.servizio_annunci OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-05 16:21:55 +02:00
|
|
|
--
|
|
|
|
|
-- Name: servizio_interessi; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.servizio_interessi (
|
|
|
|
|
"annuncioId" integer NOT NULL,
|
|
|
|
|
"userId" uuid NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.servizio_interessi OWNER TO postgres;
|
2025-08-05 16:21:55 +02:00
|
|
|
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
|
|
|
|
-- Name: testi_e_stringhe; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.testi_e_stringhe (
|
|
|
|
|
stinga_id text NOT NULL,
|
|
|
|
|
stringa_value text
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.testi_e_stringhe OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.users (
|
|
|
|
|
id uuid DEFAULT gen_random_uuid() NOT NULL,
|
|
|
|
|
username text NOT NULL,
|
|
|
|
|
email text NOT NULL,
|
|
|
|
|
"isAdmin" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"isBlocked" boolean DEFAULT false NOT NULL,
|
|
|
|
|
password text NOT NULL,
|
|
|
|
|
nome text NOT NULL,
|
|
|
|
|
cognome text NOT NULL,
|
|
|
|
|
created_at timestamp without time zone DEFAULT now() NOT NULL,
|
|
|
|
|
reset_password_token text,
|
|
|
|
|
reset_password_expires timestamp without time zone,
|
|
|
|
|
telefono text NOT NULL,
|
|
|
|
|
"isAdminMade" boolean DEFAULT false,
|
|
|
|
|
"isVerified" boolean DEFAULT false NOT NULL,
|
|
|
|
|
"verificationToken" text,
|
|
|
|
|
"verificationTokenExpires" timestamp without time zone,
|
|
|
|
|
salt text NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.users OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: users_anagrafica; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.users_anagrafica (
|
|
|
|
|
idanagrafica uuid DEFAULT gen_random_uuid() NOT NULL,
|
|
|
|
|
userid uuid NOT NULL,
|
|
|
|
|
luogo_nascita text,
|
|
|
|
|
data_nascita timestamp without time zone,
|
|
|
|
|
nazione_nascita text,
|
|
|
|
|
codice_fiscale text,
|
|
|
|
|
via_residenza text,
|
|
|
|
|
civico_residenza text,
|
|
|
|
|
comune_residenza text,
|
|
|
|
|
provincia_residenza text,
|
|
|
|
|
cap_residenza text,
|
|
|
|
|
nazione_residenza text,
|
|
|
|
|
sesso text,
|
|
|
|
|
azienda boolean DEFAULT false NOT NULL,
|
|
|
|
|
ragione_sociale text,
|
|
|
|
|
sede_legale text,
|
|
|
|
|
p_iva text,
|
|
|
|
|
fatturazione_aziendale boolean DEFAULT false NOT NULL,
|
|
|
|
|
codice_destinatario text,
|
|
|
|
|
legale_rappresentante text
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.users_anagrafica OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: users_storage; Type: TABLE; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE TABLE public.users_storage (
|
2025-10-29 09:39:06 +01:00
|
|
|
"userId" uuid NOT NULL,
|
|
|
|
|
"storageId" text NOT NULL,
|
|
|
|
|
from_admin boolean DEFAULT false NOT NULL,
|
|
|
|
|
user_storage_id uuid DEFAULT gen_random_uuid() NOT NULL
|
2025-08-04 17:45:44 +02:00
|
|
|
);
|
|
|
|
|
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
public.users_storage OWNER TO postgres;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: annunci id; Type: DEFAULT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.annunci
|
|
|
|
|
ALTER COLUMN
|
|
|
|
|
id
|
|
|
|
|
SET
|
|
|
|
|
DEFAULT nextval('public.annunci_id_seq' :: regclass);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: banlist id; Type: DEFAULT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.banlist
|
|
|
|
|
ALTER COLUMN
|
|
|
|
|
id
|
|
|
|
|
SET
|
|
|
|
|
DEFAULT nextval('public.banlist_id_seq' :: regclass);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: emails id_email; Type: DEFAULT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.emails
|
|
|
|
|
ALTER COLUMN
|
|
|
|
|
id_email
|
|
|
|
|
SET
|
|
|
|
|
DEFAULT nextval('public.emails_id_email_seq' :: regclass);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: etichette id_etichetta; Type: DEFAULT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.etichette
|
|
|
|
|
ALTER COLUMN
|
|
|
|
|
id_etichetta
|
|
|
|
|
SET
|
|
|
|
|
DEFAULT nextval('public.etichette_id_etichetta_seq' :: regclass);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: event_queue event_id; Type: DEFAULT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.event_queue
|
|
|
|
|
ALTER COLUMN
|
|
|
|
|
event_id
|
|
|
|
|
SET
|
|
|
|
|
DEFAULT nextval('public.event_queue_event_id_seq' :: regclass);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: annunci annunci_codice_key; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.annunci
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT annunci_codice_key UNIQUE (codice);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: annunci annunci_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.annunci
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT annunci_pkey PRIMARY KEY (id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: banlist banlist_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.banlist
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT banlist_pkey PRIMARY KEY (id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: banners banners_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.banners
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT banners_pkey PRIMARY KEY (idbanner);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: chats_etichette chats_etichette_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.chats_etichette
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT chats_etichette_pkey PRIMARY KEY (chatid, etichettaid);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: chats chats_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.chats
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT chats_pkey PRIMARY KEY (chatid);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: emails emails_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.emails
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT emails_pkey PRIMARY KEY (id_email);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: etichette etichette_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.etichette
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT etichette_pkey PRIMARY KEY (id_etichetta);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: event_queue event_queue_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.event_queue
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT event_queue_pkey PRIMARY KEY (event_id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-10-29 09:39:06 +01:00
|
|
|
-- Name: images_refs img_cod_order; Type: CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.images_refs
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT img_cod_order UNIQUE (codice, ordine);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-10-29 09:39:06 +01:00
|
|
|
-- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.messages
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT messages_pkey PRIMARY KEY (messageid);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: ordini ordini2_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.ordini
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT ordini2_pkey PRIMARY KEY (ordine_id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: payments payments2_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.payments
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT payments2_pkey PRIMARY KEY (id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: prezziario prezziario2_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.prezziario
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT prezziario2_pkey PRIMARY KEY (idprezziario);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: servizio servizio_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT servizio_pkey PRIMARY KEY (servizio_id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: flags sitesettings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.flags
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT sitesettings_pkey PRIMARY KEY (id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: testi_e_stringhe testi_e_stringhe_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.testi_e_stringhe
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT testi_e_stringhe_pkey PRIMARY KEY (stinga_id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: banlist typeval; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.banlist
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT typeval UNIQUE (type, value);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: servizio_annunci uniq_annuncio_servizio; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio_annunci
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT uniq_annuncio_servizio UNIQUE (annunci_id, servizio_id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-10-29 09:39:06 +01:00
|
|
|
--
|
|
|
|
|
-- Name: users_storage unique_user_storage; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.users_storage
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT unique_user_storage UNIQUE ("userId", "storageId");
|
2025-10-29 09:39:06 +01:00
|
|
|
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-08-05 16:21:55 +02:00
|
|
|
-- Name: servizio_interessi uniqui_interest; Type: CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio_interessi
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT uniqui_interest UNIQUE ("annuncioId", "userId");
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.users
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT users_email_key UNIQUE (email);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.users
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT users_pkey PRIMARY KEY (id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-10-29 09:39:06 +01:00
|
|
|
-- Name: users_storage users_storage_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.users_storage
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT users_storage_pkey PRIMARY KEY (user_storage_id);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-10-29 09:39:06 +01:00
|
|
|
-- Name: users_anagrafica usersanagrafica2_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.users_anagrafica
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT usersanagrafica2_pkey PRIMARY KEY (idanagrafica);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-10-29 09:39:06 +01:00
|
|
|
-- Name: users_anagrafica usserunique2; Type: CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.users_anagrafica
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT usserunique2 UNIQUE (userid);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: ratelimiter_key_index; Type: INDEX; Schema: public; Owner: postgres
|
|
|
|
|
--
|
|
|
|
|
CREATE INDEX ratelimiter_key_index ON public.ratelimiter USING btree (key);
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: chats_etichette chat_etichetta_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.chats_etichette
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT chat_etichetta_fkey FOREIGN KEY (chatid) REFERENCES public.chats(chatid) ON UPDATE CASCADE ON DELETE CASCADE;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-10-29 09:39:06 +01:00
|
|
|
--
|
|
|
|
|
-- Name: images_refs cod_image; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.images_refs
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT cod_image FOREIGN KEY (codice) REFERENCES public.annunci(codice);
|
2025-10-29 09:39:06 +01:00
|
|
|
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
|
|
|
|
-- Name: emails email_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.emails
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT email_user FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: chats_etichette etichetta_chetich_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.chats_etichette
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT etichetta_chetich_fkey FOREIGN KEY (etichettaid) REFERENCES public.etichette(id_etichetta) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-08-05 16:21:55 +02:00
|
|
|
-- Name: servizio_interessi interesse_annuncio; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio_interessi
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT interesse_annuncio FOREIGN KEY ("annuncioId") REFERENCES public.annunci(id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-08-05 16:21:55 +02:00
|
|
|
-- Name: servizio_interessi interesse_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio_interessi
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT interesse_user FOREIGN KEY ("userId") REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: messages messages_chatid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.messages
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT messages_chatid_fkey FOREIGN KEY (chatid) REFERENCES public.chats(chatid) ON DELETE CASCADE;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: messages messages_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.messages
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT messages_user_fkey FOREIGN KEY (sender) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: ordini ordine2_pack_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.ordini
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT ordine2_pack_fkey FOREIGN KEY (packid) REFERENCES public.prezziario(idprezziario) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: ordini ordine2_servizio_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.ordini
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT ordine2_servizio_fkey FOREIGN KEY (servizio_id) REFERENCES public.servizio(servizio_id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: ordini ordine2_userid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.ordini
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT ordine2_userid_fkey FOREIGN KEY (userid) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: payments payments2_ordine_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.payments
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT payments2_ordine_fkey FOREIGN KEY (ordine_id) REFERENCES public.ordini(ordine_id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: payments payments2_servizio_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.payments
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT payments2_servizio_fkey FOREIGN KEY (servizio_id) REFERENCES public.servizio(servizio_id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: payments payments2_userid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.payments
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT payments2_userid_fkey FOREIGN KEY (userid) REFERENCES public.users(id) ON DELETE CASCADE;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: servizio_annunci servizio_annuncio_J_annuncio; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio_annunci
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT "servizio_annuncio_J_annuncio" FOREIGN KEY (annunci_id) REFERENCES public.annunci(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: servizio_annunci servizio_annuncio_J_servizio; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio_annunci
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT "servizio_annuncio_J_servizio" FOREIGN KEY (servizio_id) REFERENCES public.servizio(servizio_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-10-29 09:39:06 +01:00
|
|
|
-- Name: servizio servizio_doc_fronte; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT servizio_doc_fronte FOREIGN KEY (doc_personale_fronte_ref) REFERENCES public.users_storage(user_storage_id) ON UPDATE CASCADE ON DELETE
|
|
|
|
|
SET
|
|
|
|
|
NULL NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-10-29 09:39:06 +01:00
|
|
|
-- Name: servizio servizio_doc_motivazione; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT servizio_doc_motivazione FOREIGN KEY (doc_motivazione_ref) REFERENCES public.users_storage(user_storage_id) ON UPDATE CASCADE ON DELETE
|
|
|
|
|
SET
|
|
|
|
|
NULL NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
2025-10-29 09:39:06 +01:00
|
|
|
-- Name: servizio servizio_doc_retro; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
2025-08-04 17:45:44 +02:00
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT servizio_doc_retro FOREIGN KEY (doc_personale_retro_ref) REFERENCES public.users_storage(user_storage_id) ON UPDATE CASCADE ON DELETE
|
|
|
|
|
SET
|
|
|
|
|
NULL NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: servizio user_servizio; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.servizio
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT user_servizio FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: chats userchats; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.chats
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT userchats FOREIGN KEY (user_ref) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: users_anagrafica useridfkeyanagrafica2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.users_anagrafica
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT useridfkeyanagrafica2 FOREIGN KEY (userid) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- Name: users_storage userstorage; Type: FK CONSTRAINT; Schema: public; Owner: postgres
|
|
|
|
|
--
|
2025-10-29 11:06:53 +01:00
|
|
|
ALTER TABLE
|
|
|
|
|
ONLY public.users_storage
|
|
|
|
|
ADD
|
|
|
|
|
CONSTRAINT userstorage FOREIGN KEY ("userId") REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
--
|
|
|
|
|
-- PostgreSQL database dump complete
|
2025-10-29 11:06:53 +01:00
|
|
|
--
|