-- ----------------------------
-- Table structure for watershed_facility
-- ----------------------------
DROP TABLE IF EXISTS "watershed_facility";
CREATE TABLE "watershed_facility" (
  "facility_id" BIGINT NOT NULL AUTO_INCREMENT,
  "facility_name" VARCHAR(100) NOT NULL,
  "facility_type" VARCHAR(50) NOT NULL,
  "location" VARCHAR(255),
  "longitude" DECIMAL(10,6),
  "latitude" DECIMAL(10,6),
  "build_time" DATE,
  "status" CHAR(1) NOT NULL DEFAULT '0',
  "manager" VARCHAR(50),
  "phone" VARCHAR(20),
  "image_path" VARCHAR(255),
  "model_path" VARCHAR(255),
  "create_by" VARCHAR(64) DEFAULT '',
  "create_time" DATETIME,
  "update_by" VARCHAR(64) DEFAULT '',
  "update_time" DATETIME,
  "remark" VARCHAR(500) DEFAULT NULL,
  PRIMARY KEY ("facility_id")
);

-- ----------------------------
-- Records of watershed_facility
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Checks for watershed_facility
-- ----------------------------
ALTER TABLE "watershed_facility" ADD CONSTRAINT "watershed_facility_check_1" CHECK ("status" IN ('0','1','2','3'));

-- ----------------------------
-- Comments for watershed_facility
-- ----------------------------
COMMENT ON TABLE "watershed_facility" IS '水利设施表';
COMMENT ON COLUMN "watershed_facility"."facility_id" IS '设施ID';
COMMENT ON COLUMN "watershed_facility"."facility_name" IS '设施名称';
COMMENT ON COLUMN "watershed_facility"."facility_type" IS '设施类型';
COMMENT ON COLUMN "watershed_facility"."location" IS '地理位置';
COMMENT ON COLUMN "watershed_facility"."longitude" IS '经度';
COMMENT ON COLUMN "watershed_facility"."latitude" IS '纬度';
COMMENT ON COLUMN "watershed_facility"."build_time" IS '建设时间';
COMMENT ON COLUMN "watershed_facility"."status" IS '设施状态（0正常运行 1维护中 2维修中 3停用）';
COMMENT ON COLUMN "watershed_facility"."manager" IS '负责人';
COMMENT ON COLUMN "watershed_facility"."phone" IS '联系电话';
COMMENT ON COLUMN "watershed_facility"."image_path" IS '图片路径';
COMMENT ON COLUMN "watershed_facility"."model_path" IS '三维模型路径';
COMMENT ON COLUMN "watershed_facility"."create_by" IS '创建者';
COMMENT ON COLUMN "watershed_facility"."create_time" IS '创建时间';
COMMENT ON COLUMN "watershed_facility"."update_by" IS '更新者';
COMMENT ON COLUMN "watershed_facility"."update_time" IS '更新时间';
COMMENT ON COLUMN "watershed_facility"."remark" IS '备注';