spacer gif
spacer gif

DB TABLE auth_user_role WILL BE CREATED!

--
-- DB TABLES :: app=login
-- TABLE     :: auth_user_role
-- SEQUENCE  :: auth_user_role_id_seq
--

-- DROP TABLE auth_user_role;
-- DROP SEQUENCE auth_user_role_id_seq;

--
-- TABLE :: auth_user_role
--
CREATE TABLE auth_user_role (
    user_role_id integer NOT NULL,
    username character varying(50),
    role character varying(50),
    permission character varying(50),
    context character varying(50),
    auth_user_id integer,
    auth_role_id integer,
    remarks character varying(255),
    credtm timestamp(0) without time zone DEFAULT now(),
    creusr character varying(32) DEFAULT "current_user"(),
    upddtm timestamp(0) without time zone DEFAULT now(),
    updusr character varying(32) DEFAULT "current_user"()
);
--
ALTER TABLE public.auth_user_role OWNER TO nobody;
ALTER TABLE ONLY auth_user_role
    ADD CONSTRAINT auth_user_role_pkey PRIMARY KEY (user_role_id);
-- CREATE UNIQUE INDEX auth_user_role_id_uidx ON auth_user_role USING btree (user_role_id);
CREATE UNIQUE INDEX auth_user_role_username_role_uidx ON auth_user_role (username, role);
CREATE UNIQUE INDEX auth_user_role_user_id_role_id_uidx ON auth_user_role (auth_user_id, auth_role_id);
CREATE INDEX auth_user_role_uidx ON auth_user_role USING btree (role);
--
REVOKE ALL ON TABLE auth_user_role FROM PUBLIC;
--REVOKE ALL ON TABLE auth_user_role FROM nobody;
GRANT ALL ON TABLE auth_user_role TO nobody;
GRANT SELECT,INSERT,UPDATE ON TABLE auth_user_role TO PUBLIC;

--
-- COMMENTS :: auth_user_role
--
COMMENT ON TABLE auth_user_role IS 'Roles and permissions for logged in users.';
--
COMMENT ON COLUMN auth_user_role.user_role_id IS 'PK (Primary key)';
COMMENT ON COLUMN auth_user_role.context IS 'Role context';
COMMENT ON COLUMN auth_user_role.auth_role_id IS 'FK Foreign Key to auth_role';

--
-- SEQUENCE :: auth_user_role_id_seq
--
CREATE SEQUENCE auth_user_role_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
--
ALTER TABLE public.auth_user_role_id_seq OWNER TO nobody;
ALTER SEQUENCE auth_user_role_id_seq OWNED BY auth_user_role.user_role_id;
ALTER TABLE auth_user_role ALTER COLUMN user_role_id SET DEFAULT nextval('auth_user_role_id_seq'::regclass);
--
REVOKE ALL ON SEQUENCE auth_user_role_id_seq FROM PUBLIC;
--REVOKE ALL ON SEQUENCE auth_user_role_id_seq FROM nobody;
GRANT ALL ON SEQUENCE auth_user_role_id_seq TO nobody;
GRANT SELECT,UPDATE ON SEQUENCE auth_user_role_id_seq TO PUBLIC;

--
-- Default role admin for dagterje
--
INSERT INTO auth_user_role (user_role_id, username, role, permission, auth_user_id)
    VALUES (nextval('auth_user_role_id_seq'), 'admin', 'admin', 'user,editor,admin', 1);

INSERT INTO auth_user_role (user_role_id, username, role, permission, auth_user_id)
    VALUES (nextval('auth_user_role_id_seq'), 'dagterje', 'admin', 'user,editor,admin', 2);


FAILED TO RUN SQL SCRIPT (auth_user_role.sql)
ERROR: permission denied for schema public LINE 13: CREATE TABLE auth_user_role ( ^