build: flyway init

This commit is contained in:
CaptainB 2023-06-02 14:38:27 +08:00
parent ce5fcf76a3
commit dbfbe14762
12 changed files with 17 additions and 16 deletions

View File

@ -1,6 +1,7 @@
spring.application.name=metersphere spring.application.name=metersphere
management.server.port=7071 management.server.port=7071
server.port=8081 server.port=8081
server.servlet.context-path=/backend
# gzip # gzip
server.compression.enabled=true server.compression.enabled=true
server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css,text/javascript,image/jpeg server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css,text/javascript,image/jpeg
@ -55,7 +56,7 @@ mybatis.configuration.map-underscore-to-camel-case=true
# view # view
spring.mvc.throw-exception-if-no-handler-found=true spring.mvc.throw-exception-if-no-handler-found=true
# flyway enable # flyway enable
spring.flyway.enabled=false spring.flyway.enabled=true
spring.flyway.baseline-on-migrate=true spring.flyway.baseline-on-migrate=true
spring.flyway.locations=classpath:migration spring.flyway.locations=classpath:migration
spring.flyway.table=metersphere_version spring.flyway.table=metersphere_version

View File

@ -1,7 +1,7 @@
-- set innodb lock wait timeout -- set innodb lock wait timeout
SET SESSION innodb_lock_wait_timeout = 7200; SET SESSION innodb_lock_wait_timeout = 7200;
CREATE TABLE `project` CREATE TABLE IF NOT EXISTS `project`
( (
`id` VARCHAR(50) NOT NULL COMMENT '项目ID', `id` VARCHAR(50) NOT NULL COMMENT '项目ID',
`workspace_id` VARCHAR(50) NOT NULL COMMENT '工作空间ID', `workspace_id` VARCHAR(50) NOT NULL COMMENT '工作空间ID',
@ -17,7 +17,7 @@ CREATE TABLE `project`
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='项目'; COLLATE = utf8mb4_general_ci COMMENT ='项目';
CREATE TABLE `project_application` CREATE TABLE IF NOT EXISTS `project_application`
( (
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID', `project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
`type` VARCHAR(50) NOT NULL COMMENT '配置项', `type` VARCHAR(50) NOT NULL COMMENT '配置项',
@ -30,7 +30,7 @@ CREATE TABLE `project_application`
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='项目应用'; COLLATE = utf8mb4_general_ci COMMENT ='项目应用';
CREATE TABLE `project_extend` CREATE TABLE IF NOT EXISTS `project_extend`
( (
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID', `project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
`tapd_id` VARCHAR(50) DEFAULT NULL, `tapd_id` VARCHAR(50) DEFAULT NULL,
@ -49,7 +49,7 @@ CREATE TABLE `project_extend`
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='项目扩展'; COLLATE = utf8mb4_general_ci COMMENT ='项目扩展';
CREATE TABLE `project_version` CREATE TABLE IF NOT EXISTS `project_version`
( (
`id` VARCHAR(50) NOT NULL COMMENT '版本ID', `id` VARCHAR(50) NOT NULL COMMENT '版本ID',
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID', `project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',

View File

@ -53,7 +53,7 @@ public class LoginController {
return null; return null;
} }
@PostMapping(value = "/signin") @PostMapping(value = "/login")
public ResultHolder login(@RequestBody LoginRequest request) { public ResultHolder login(@RequestBody LoginRequest request) {
SessionUser sessionUser = SessionUtils.getUser(); SessionUser sessionUser = SessionUtils.getUser();
if (sessionUser != null) { if (sessionUser != null) {

View File

@ -8,8 +8,8 @@ public class FilterChainUtils {
public static Map<String, String> loadBaseFilterChain() { public static Map<String, String> loadBaseFilterChain() {
Map<String, String> filterChainDefinitionMap = new HashMap<>(); Map<String, String> filterChainDefinitionMap = new HashMap<>();
filterChainDefinitionMap.put("/*.html", "anon"); filterChainDefinitionMap.put("/*.html", "anon");
filterChainDefinitionMap.put("/signin", "anon"); filterChainDefinitionMap.put("/login", "anon");
filterChainDefinitionMap.put("/ldap/signin", "anon"); filterChainDefinitionMap.put("/ldap/login", "anon");
filterChainDefinitionMap.put("/ldap/open", "anon"); filterChainDefinitionMap.put("/ldap/open", "anon");
filterChainDefinitionMap.put("/signout", "anon"); filterChainDefinitionMap.put("/signout", "anon");
filterChainDefinitionMap.put("/is-login", "anon"); filterChainDefinitionMap.put("/is-login", "anon");

View File

@ -50,7 +50,7 @@ public class ApiDefinitionControllerTests {
@Test @Test
@Order(0) @Order(0)
public void login() throws Exception { public void login() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/signin") MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/login")
.content("{\"username\":\"admin\",\"password\":\"metersphere\"}") .content("{\"username\":\"admin\",\"password\":\"metersphere\"}")
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()) .andExpect(status().isOk())

View File

@ -35,7 +35,7 @@ public class CaseReviewControllerTests {
@Test @Test
@Order(0) @Order(0)
public void login() throws Exception { public void login() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/signin") MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/login")
.content("{\"username\":\"admin\",\"password\":\"metersphere\"}") .content("{\"username\":\"admin\",\"password\":\"metersphere\"}")
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()) .andExpect(status().isOk())

View File

@ -37,7 +37,7 @@ public class IssueControllerTest {
@Test @Test
@Order(0) @Order(0)
public void login() throws Exception { public void login() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/signin") MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/login")
.content("{\"username\":\"admin\",\"password\":\"metersphere\"}") .content("{\"username\":\"admin\",\"password\":\"metersphere\"}")
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()) .andExpect(status().isOk())

View File

@ -32,7 +32,7 @@ public class ProjectApplicationControllerTests {
@Test @Test
@Order(0) @Order(0)
public void login() throws Exception { public void login() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/signin") MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/login")
.content("{\"username\":\"admin\",\"password\":\"metersphere\"}") .content("{\"username\":\"admin\",\"password\":\"metersphere\"}")
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()) .andExpect(status().isOk())

View File

@ -36,7 +36,7 @@ public class ProjectControllerTests {
@Test @Test
@Order(0) @Order(0)
public void login() throws Exception { public void login() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/signin") MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/login")
.content("{\"username\":\"admin\",\"password\":\"metersphere\"}") .content("{\"username\":\"admin\",\"password\":\"metersphere\"}")
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()) .andExpect(status().isOk())

View File

@ -34,7 +34,7 @@ public class UserControllerTests {
@Test @Test
@Order(0) @Order(0)
public void login() throws Exception { public void login() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/signin") MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/login")
.content("{\"username\":\"admin\",\"password\":\"metersphere\"}") .content("{\"username\":\"admin\",\"password\":\"metersphere\"}")
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()) .andExpect(status().isOk())

View File

@ -46,7 +46,7 @@ public class TestPlanApiCaseControllerTests {
@Test @Test
@Order(0) @Order(0)
public void login() throws Exception { public void login() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/signin") MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/login")
.content("{\"username\":\"admin\",\"password\":\"metersphere\"}") .content("{\"username\":\"admin\",\"password\":\"metersphere\"}")
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()) .andExpect(status().isOk())

View File

@ -53,7 +53,7 @@ public class TestPlanControllerTests {
@Test @Test
@Order(0) @Order(0)
public void login() throws Exception { public void login() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/signin") MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/login")
.content("{\"username\":\"admin\",\"password\":\"metersphere\"}") .content("{\"username\":\"admin\",\"password\":\"metersphere\"}")
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()) .andExpect(status().isOk())