/*
 Navicat Premium Data Transfer

 Source Server         : anjabbawah
 Source Server Type    : PostgreSQL
 Source Server Version : 150003 (150003)
 Source Host           : localhost:5432
 Source Catalog        : sppai
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 150003 (150003)
 File Encoding         : 65001

 Date: 24/04/2026 17:09:17
*/


-- ----------------------------
-- Table structure for users
-- ----------------------------
CREATE TABLE "public"."users" (
  "id" int4 NOT NULL DEFAULT nextval('users_id_seq'::regclass),
  "username" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "password_hash" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "full_name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "email" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "role" varchar(20) COLLATE "pg_catalog"."default" NOT NULL,
  "scope_ref_id" int4 NOT NULL DEFAULT 0,
  "created_at" timestamp(6),
  "updated_at" timestamp(6),
  "faculty_id" int4,
  "department_id" int4,
  "study_program_id" int4,
  "user_level_id" int8,
  "is_active" bool DEFAULT true,
  "fullname" varchar(150) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO "public"."users" VALUES (7, 'superuser', '$2y$10$Av6DnyfzGkw1.GBEmt6JjelxruY5VQkoA.Jn4UJFJpOwn.pDiqs4.', 'Super Administrator', 'superuser@spp.ac.id', 'superuser', 0, NULL, NULL, NULL, NULL, NULL, NULL, 't', NULL);
INSERT INTO "public"."users" VALUES (8, 'admin_fikk', '$2y$10$Av6DnyfzGkw1.GBEmt6JjelxruY5VQkoA.Jn4UJFJpOwn.pDiqs4.', 'Admin Fakultas FIKK', 'admin_fikk@spp.ac.id', 'admin_fakultas', 0, NULL, NULL, 1, NULL, NULL, NULL, 't', NULL);
INSERT INTO "public"."users" VALUES (16, 'admin_pjsd_s1', '$2y$10$Av6DnyfzGkw1.GBEmt6JjelxruY5VQkoA.Jn4UJFJpOwn.pDiqs4.', 'Admin Prodi PJSD S1', 'admin_pjsd_s1@uny.ac.id', 'admin_prodi', 0, '2025-12-27 02:14:43', NULL, 1, 2, 4, NULL, 't', NULL);
INSERT INTO "public"."users" VALUES (17, 'admin_pjsd_s2', '$2y$10$Av6DnyfzGkw1.GBEmt6JjelxruY5VQkoA.Jn4UJFJpOwn.pDiqs4.', 'Admin Prodi PJSD S2', 'admin_pjsd_s2@uny.ac.id', 'admin_prodi', 0, '2025-12-27 02:14:43', NULL, 1, 2, 5, NULL, 't', NULL);
INSERT INTO "public"."users" VALUES (18, 'admin_pjsd_s3', '$2y$10$Av6DnyfzGkw1.GBEmt6JjelxruY5VQkoA.Jn4UJFJpOwn.pDiqs4.', 'Admin Prodi PJSD S3', 'admin_pjsd_s3@uny.ac.id', 'admin_prodi', 0, '2025-12-27 02:14:43', NULL, 1, 2, 6, NULL, 't', NULL);
INSERT INTO "public"."users" VALUES (4, 'admin_dept_pjsd', '$2y$10$Av6DnyfzGkw1.GBEmt6JjelxruY5VQkoA.Jn4UJFJpOwn.pDiqs4.', 'Admin Dept PJSD', 'if@univ.ac.id', 'admin_dept', 1, NULL, NULL, NULL, 2, NULL, NULL, 't', NULL);
INSERT INTO "public"."users" VALUES (2, 'admin_univ', '$2y$10$Av6DnyfzGkw1.GBEmt6JjelxruY5VQkoA.Jn4UJFJpOwn.pDiqs4.', 'Admin Universitas', 'univ@univ.ac.id', 'admin_univ', 0, NULL, NULL, NULL, NULL, NULL, NULL, 't', NULL);

-- ----------------------------
-- Uniques structure for table users
-- ----------------------------
ALTER TABLE "public"."users" ADD CONSTRAINT "users_username" UNIQUE ("username");
ALTER TABLE "public"."users" ADD CONSTRAINT "users_email" UNIQUE ("email");

-- ----------------------------
-- Primary Key structure for table users
-- ----------------------------
ALTER TABLE "public"."users" ADD CONSTRAINT "pk_users" PRIMARY KEY ("id");

-- ----------------------------
-- Foreign Keys structure for table users
-- ----------------------------
ALTER TABLE "public"."users" ADD CONSTRAINT "fk_user_level" FOREIGN KEY ("user_level_id") REFERENCES "public"."ms_user_levels" ("id") ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE "public"."users" ADD CONSTRAINT "users_department_id_foreign" FOREIGN KEY ("department_id") REFERENCES "public"."ms_departments" ("id") ON DELETE CASCADE ON UPDATE SET NULL;
ALTER TABLE "public"."users" ADD CONSTRAINT "users_faculty_id_foreign" FOREIGN KEY ("faculty_id") REFERENCES "public"."ms_faculties" ("id") ON DELETE CASCADE ON UPDATE SET NULL;
ALTER TABLE "public"."users" ADD CONSTRAINT "users_study_program_id_foreign" FOREIGN KEY ("study_program_id") REFERENCES "public"."ms_study_programs" ("id") ON DELETE CASCADE ON UPDATE SET NULL;
