Files
ppanel-web/migrations/postgres/02105_node.sql
T
Ember Moth 2744c70c5c Initial
2026-07-05 20:27:58 +08:00

34 lines
1.2 KiB
SQL

-- migrate:up
CREATE TABLE IF NOT EXISTS "servers" (
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
"name" varchar(100) NOT NULL DEFAULT '',
"country" varchar(128) NOT NULL DEFAULT '',
"city" varchar(128) NOT NULL DEFAULT '',
"ratio" decimal(4,2) NOT NULL DEFAULT '0.00',
"address" varchar(100) NOT NULL DEFAULT '',
"sort" bigint NOT NULL DEFAULT '0',
"protocols" text,
"last_reported_at" TIMESTAMP(3) DEFAULT NULL,
"created_at" TIMESTAMP(3) DEFAULT NULL,
"updated_at" TIMESTAMP(3) DEFAULT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE IF NOT EXISTS "nodes" (
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
"name" varchar(100) NOT NULL DEFAULT '',
"tags" varchar(255) NOT NULL DEFAULT '',
"port" INTEGER NOT NULL DEFAULT '0',
"address" varchar(255) NOT NULL DEFAULT '',
"server_id" bigint NOT NULL DEFAULT '0',
"protocol" varchar(100) NOT NULL DEFAULT '',
"enabled" BOOLEAN NOT NULL DEFAULT true,
"created_at" TIMESTAMP(3) DEFAULT NULL,
"updated_at" TIMESTAMP(3) DEFAULT NULL,
PRIMARY KEY ("id")
);
-- migrate:down
DROP TABLE IF EXISTS "nodes";
DROP TABLE IF EXISTS "servers";