BEGIN;

CREATE TABLE IF NOT EXISTS "ldaps" (
    "id" bigserial not null primary key ,
    "name" varchar(100) NOT NULL,
    "address" varchar(100) NOT NULL,
    "port" varchar(100) NOT NULL,
    "read_username" varchar(100) NOT NULL DEFAULT '',
    "read_password" varchar(100) NOT NULL DEFAULT '',
    "dn" varchar(100) NOT NULL,
    "attribute_login" varchar(100) NOT NULL,
    "attribute_firstname" varchar(100) NOT NULL,
    "attribute_lastname" varchar(100) NOT NULL);


DO $$
BEGIN
  BEGIN
      ALTER TABLE users ADD COLUMN source integer NOT NULL DEFAULT 0;
  EXCEPTION
      WHEN duplicate_column THEN
      -- do nothing
  END;
END;
$$;

COMMIT;
