当前位置:网站首页>Flyway's SaaS multi tenant implementation scheme
Flyway's SaaS multi tenant implementation scheme
2022-07-19 02:48:00 【dragonpeng2008】
One 、 Preface
The previous chapters have been implemented mysql、MongoDB、redis and Activiti Implementation scheme of multi tenant switch , This chapter will continue to learn Flyway Multi data source implementation scheme of database version management tool .Flyway It is a database version management tool that is independent of database application management and tracks database changes . Use Flyway Can be like Git Manage code like that sql Script , Can achieve different environments sql Script auto update , Developers submit as they submit code sql Update script , The database script is automatically updated when the program is published , It saves the trouble of operation and maintenance personnel collecting and deploying scripts , Development environment validation script , Deployed in the test environment, it can be upgraded automatically . And the update process can be traced , at present Flyway Support a lot of databases , common MySQL、MariaDB、Oracle All support .
If it is just a script upgrade of a database , This use Flyway It's simple , But if you want to upgrade multiple databases of multi tenancy , We need help from Springboot Of AbstractRoutingDataSource, When the program starts, connect the databases of different tenants to upgrade the database scripts .
Two 、 Implementation scheme
The implementation is simple , All we need to do is Flyway When configuring, use our customized data source .
1、 First of all, because we already have MySQL Multi data source support for ,Flyway The data source can be reused
2、 because Flyway When initializing, you need to pass in a data source , We can MySQL The data source of .
3、 Finally, traverse all data sources , perform Flyway Of migrate Operation completes the upgrade function of database script .
3、 ... and 、 Get ready
To demonstrate simplicity , We need to prepare some database upgrades sql Script , The first is the script file that each tenant needs to upgrade , Then the tenant tenant_one and tenant_two Their own upgrade script files .
Script files to be executed by each tenant V1.1__create_test_table.sql, Create a test surface :
边栏推荐
猜你喜欢

shell脚本接收和返回参数
![[unity Editor Extension] displays the memory size of all files in the resource directory](/img/2a/6142d07d2857bbdeaf06a9eb5f2cbb.png)
[unity Editor Extension] displays the memory size of all files in the resource directory

Dynamic display of digital tube stopwatch of single chip microcomputer

Use JMeter to test services based on websocket protocol

Flask template injection

服务账户service account在kubernetes1.24中的变化

HCIA总结

Lamp platform deployment and Application

Shell script integer value comparison, logic test, if statement, extract performance monitoring indicators

多层数据包结构及TCP三次握手
随机推荐
三层交换机配置VLAN和使用OSPF协议
[hsjframework] unity time management timemanger timer
MySQL数据库安装
Chapter 1 - multi agent system
regular expression
JMeter response time test component & multi interface concurrency
Leetcode 70:Climbing Stairs
安装软件提示无法定位程序输入点AddDllDirectory于动态链接库Kernel32.dll上(文末有下载地址)
Usage instructions for MDK keil/arm printf
Longest ascending subsequence - Optimization
squid代理服务部署
DNS domain name resolution
Understanding of array and bubbling
[unity Editor Extension] displays the memory size of all files in the resource directory
Reflection and Discussion on time management methods
Shell script case branch statement, pick the max address of anonymous login FTP
Lamp platform deployment and Application
Shell脚本for、while循环语句、猜价格小游戏
[unity development tips] unity mixer mixer controls global volume
Response assertion of JMeter interface test