CREATE TABLE utenti (
    codice serial,
    username character varying,
    "password" character varying,
    nome character varying,
    cognome character varying,
    nome_cognome character varying,
    nickname character varying,
    ragsoc character varying,
    indirizzo character varying,
    citta character varying,
    provincia character varying,
    cap character varying,
    nazione character varying,
    cf character varying,
    cf_piva character varying,
    cciaa character varying,
    nr_cciaa character varying,
    data_cciaa date,
    datanascita date,
    indirizzo_sp character varying,
    citta_sp character varying,
    provincia_sp character varying,
    cap_sp character varying,
    nazione_sp character varying,
    luogo_spedizione character varying,
    telefono character varying,
    fax character varying,
    radiomobile character varying,
    email character varying,
    old_email character varying,
    settore_appartenenza character varying,
    settori_interesse character varying,
    privacy1 boolean DEFAULT false,
    privacy2 boolean DEFAULT false,
    note character varying,
    securelevel integer DEFAULT 1,
    sesso character varying,
    statocivile character varying,
    professione character varying,
    titolostudio character varying,
    strumento character varying,
    generemusicale character varying,
    auth character varying,
    completed boolean DEFAULT false,
    contratto boolean DEFAULT false,
    freenet boolean DEFAULT false,
    modified boolean DEFAULT false,
    autore boolean DEFAULT false,
    strumento1 integer,
    strumento2 integer,
    mailbox boolean DEFAULT false,
    mail_modified boolean DEFAULT false,
    modospedizione character varying,
    shop boolean DEFAULT false,
    corriere character varying,
    modopagamento character varying,
    news boolean DEFAULT false,
    news_modified boolean DEFAULT false,
    uin character varying,
    homepage character varying,
    hobby character varying,
    genere_musicale character varying,
    musicista_preferito character varying,
    cosa_fa character varying,
    dice_di_se character varying,
    varie character varying,
    messaggi boolean DEFAULT false,
    foto character varying,
    anagrafe boolean DEFAULT false,
    domanda character varying,
    risposta character varying,
    chat boolean DEFAULT false,
    nick_chat character varying,
    attivo boolean DEFAULT false,
    tipoutente integer,
    importato boolean DEFAULT false,
    deleted boolean DEFAULT false NOT NULL,
    autorizzato boolean DEFAULT false NOT NULL,
    locale character varying DEFAULT 'it'::character varying NOT NULL,
    scadenza date DEFAULT now() NOT NULL,
    localita integer,
    special boolean DEFAULT false NOT NULL,
    categoria integer DEFAULT 0 NOT NULL,
    newsletter integer
);

INSERT INTO utenti VALUES (1, 'valerio', '123456', 'Valerio', 'Granato', NULL, NULL, '', 'via Ricciardi, 10', 'Napoli', '15', '80142', '157', NULL, 'GRNVLR76C07F839F', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0815625909', '08119560343', '+393487777251', 'valerio@livenet.it', NULL, NULL, NULL, true, true, NULL, 3, 'm', NULL, NULL, NULL, NULL, NULL, '11483057487358', false, false, false, false, false, NULL, NULL, false, false, NULL, false, NULL, 'contrassegno', false, false, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, false, '2', 'io', false, NULL, true, NULL, false, false, false, 'it', '2005-01-01', 8175, false, 0, 0);
INSERT INTO utenti VALUES (2, 'quidieci', 'quidieci', 'Amministratore', 'Qui Dieci', NULL, NULL, '', '', 'Napoli', '15', '80100', '157', NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', '', '', 'info@quidieci.com', NULL, NULL, NULL, true, true, NULL, 3, 'm', NULL, NULL, NULL, NULL, NULL, '1a4b3c57487358', false, false, false, false, false, NULL, NULL, false, false, NULL, false, NULL, 'contrassegno', false, false, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, false, '2', 'io', false, NULL, true, NULL, false, false, false, 'it', '2005-01-01', 8175, false, 0, 0);

CREATE INDEX attivo_utenti_key ON utenti USING btree (attivo);
CREATE UNIQUE INDEX utenti_codice_key ON utenti USING btree (codice);
CREATE INDEX utenti_importato_index ON utenti USING btree (importato);
CREATE INDEX utenti_provincia_index ON utenti USING btree (provincia);
CREATE INDEX utenti_username_password_attivo_auth_index ON utenti USING btree (username, "password", attivo, auth);

select setval('utenti_codice_seq', (select max(codice) from utenti), true);

