-- ----------------------------
-- Table structure for system_settings
-- ----------------------------
DROP TABLE IF EXISTS "system_settings";
CREATE TABLE "system_settings" (
  "setting_key" TEXT NOT NULL,
  "setting_value" TEXT,
  "description" TEXT,
  PRIMARY KEY ("setting_key")
);

-- ----------------------------
-- Records of system_settings
-- ----------------------------
INSERT INTO "system_settings" ("setting_key", "setting_value", "description") VALUES ('registration.enabled', 'true', '是否开放用户注册功能');

-- ----------------------------
-- Table structure for registration_codes
-- ----------------------------
DROP TABLE IF EXISTS "registration_codes";
CREATE TABLE "registration_codes" (
  "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  "code" TEXT NOT NULL,
  "expiry_time" TEXT NOT NULL,
  "created_by" TEXT,
  "created_at" TEXT DEFAULT (datetime('now','localtime'))
);

CREATE UNIQUE INDEX "uk_code"
ON "registration_codes" (
  "code" ASC
);
