diff --git a/pom.xml b/pom.xml index 12db57e..be86cce 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,10 @@ freemarker 2.3.31 + + org.flywaydb + flyway-core + diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5f9c3a5..ae53c6b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,6 +1,16 @@ +server : + port : 80 + spring: datasource: url: jdbc:sqlite:D:/Sige5193/uf/app.db username: 1 password: 1 - driver-class-name: org.sqlite.JDBC \ No newline at end of file + driver-class-name: org.sqlite.JDBC + +flyway: + enabled: true + encoding: UTF-8 + locations: classpath:db/migration + validate-on-migrate: true + validateMigrationNaming: true \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0__int.sql b/src/main/resources/db/migration/V1_0__int.sql new file mode 100644 index 0000000..c7d2c32 --- /dev/null +++ b/src/main/resources/db/migration/V1_0__int.sql @@ -0,0 +1,145 @@ +-- ---------------------------- +-- Table structure for app_actuator_cmds +-- ---------------------------- +DROP TABLE IF EXISTS "app_actuator_cmds"; +CREATE TABLE "app_actuator_cmds" ( + "id" text NOT NULL, + "actuatorId" text NOT NULL, + "connectionKey" TEXT NOT NULL DEFAULT '', + "name" TEXT NOT NULL, + "cmdId" TEXT NOT NULL, + "cmdKey" TEXT NOT NULL, + "cmdFlags" TEXT NOT NULL DEFAULT '', + "parameters" TEXT NOT NULL, + "fixedParameters" TEXT NOT NULL, + "waitForFinish" integer NOT NULL DEFAULT 0, + PRIMARY KEY ("id") +); + +-- ---------------------------- +-- Table structure for app_actuators +-- ---------------------------- +DROP TABLE IF EXISTS "app_actuators"; +CREATE TABLE "app_actuators" ( + "id" text NOT NULL, + "moduleId" text NOT NULL, + "key" TEXT NOT NULL, + "name" TEXT NOT NULL, + "properties" TEXT NOT NULL DEFAULT "{}", + PRIMARY KEY ("id") +); + +-- ---------------------------- +-- Table structure for app_dict_items +-- ---------------------------- +DROP TABLE IF EXISTS "app_dict_items"; +CREATE TABLE "app_dict_items" ( + "id" text NOT NULL, + "groupKey" TEXT NOT NULL, + "groupName" TEXT NOT NULL, + "itemKey" TEXT NOT NULL, + "itemName" TEXT NOT NULL, + "itemValue" TEXT NOT NULL +); + +-- ---------------------------- +-- Table structure for app_modules +-- ---------------------------- +DROP TABLE IF EXISTS "app_modules"; +CREATE TABLE "app_modules" ( + "id" text NOT NULL, + "key" TEXT NOT NULL, + "name" TEXT NOT NULL, + PRIMARY KEY ("id") +); + +-- ---------------------------- +-- Table structure for app_notifications +-- ---------------------------- +DROP TABLE IF EXISTS "app_notifications"; +CREATE TABLE "app_notifications" ( + "id" text NOT NULL, + "type" TEXT, + "data" TEXT, + "status" TEXT, + PRIMARY KEY ("id") +); + +-- ---------------------------- +-- Table structure for app_operation_logs +-- ---------------------------- +DROP TABLE IF EXISTS "app_operation_logs"; +CREATE TABLE "app_operation_logs" ( + "id" text NOT NULL, + "userId" text NOT NULL, + "content" text NOT NULL, + "time" integer, + PRIMARY KEY ("id") +); + +-- ---------------------------- +-- Table structure for app_options +-- ---------------------------- +DROP TABLE IF EXISTS "app_options"; +CREATE TABLE "app_options" ( + "id" text NOT NULL, + "key" TEXT, + "value" TEXT, + "comment" TEXT, + "editable" TEXT, + "dataType" TEXT, + "unit" TEXT +); + +-- ---------------------------- +-- Table structure for app_runtime_log +-- ---------------------------- +DROP TABLE IF EXISTS "app_runtime_log"; +CREATE TABLE "app_runtime_log" ( + "id" text NOT NULL, + "type" text NOT NULL, + "content" text NOT NULL, + "timestamp" integer NOT NULL, + "time" text NOT NULL, + PRIMARY KEY ("id") +); + +-- ---------------------------- +-- Table structure for app_runtime_variables +-- ---------------------------- +DROP TABLE IF EXISTS "app_runtime_variables"; +CREATE TABLE "app_runtime_variables" ( + "id" text NOT NULL, + "key" TEXT, + "value" TEXT, + PRIMARY KEY ("id") +); + +-- ---------------------------- +-- Table structure for app_snippets +-- ---------------------------- +DROP TABLE IF EXISTS "app_snippets"; +CREATE TABLE "app_snippets" ( + "id" text NOT NULL, + "key" TEXT NOT NULL DEFAULT '', + "name" TEXT NOT NULL, + "cmds" TEXT NOT NULL, + PRIMARY KEY ("id") +); + +-- ---------------------------- +-- Table structure for app_users +-- ---------------------------- +DROP TABLE IF EXISTS "app_users"; +CREATE TABLE "app_users" ( + "id" text NOT NULL, + "account" TEXT NOT NULL, + "password" TEXT NOT NULL, + "salt" TEXT DEFAULT '', + "createdAt" integer DEFAULT 0, + "createdBy" text DEFAULT 0, + "accessToken" TEXT, + "accessTokenExpiredAt" integer, + "isAdmin" integer DEFAULT 0, + PRIMARY KEY ("id") +);