, , , , , - , . , , .
5 , , . , - , . . , , ( ) , , , , , .
, . , .
- , prod, , . , , , .
- , prod - ? , - ? . . , dev prod. dev prod?
- , , ? - , ? alter? create? , alter.
- , dev-, test . , , . . dev test.
( )
- , - . - , . . . ?
- , prod? , . ? prod ? ? , , - - .
- , , ( )? ? insert merge ? , , ? ?
- , , , ! , , . (sharding). ? , ? - , , memory optimized tables , , , test- .
, , memory optimized tables 20 , prod , .
- , , ? , , SQL Server ?
, SQL Server, . . -.
- , , .
, , , .
, :
- :
A. . - .
, . . . , - . ( 6), .
B. : , (persistent, ).
, ( ). , - enum . , , , / , deploy' (2) .
C. ( ). , -. , .
. , , .
D. .
, service broker ( sql dependency), change tracking ( ), read_committed_snapshot, user , , memory optimized tables. , , , . code review, . , , .
E. SQL Server , , , , ( ).
, prod, . .
, , , . SQL- .
- : prod ( ! , , ), (prod-test, dev-test), , .
A. , , , , , .
, -, prod, . - .
B. , , (, ), , - , etc. , memory optimized tables, .
C. , , . .
, , publish- app.config Visual Studio app config transformation. - .
D. . , prod/prod-test , . memory optimized tables prod , .
E prod .
( memory optimized tables), , , , , .
- , :
A. , prod, prod ( ) .
, , , . - , , prod.
2bc, , , , .
B. - (, ).
, . , . // , . , . , / , . 3 ( ) .
C. , git checkout . , , ( ) .
- ( ) , .
A. (continuous integration) , ( , redgate, devart) ( Jailer).
, . .
- - , , .
. .
.
A. , , SQL- ( ).
B. code review. alter create table ( diff ), , . diff .
- . shared db ( 2) ( ), , .
:
- 1 2 ;
- 3a;
- 3b , ;
- 4 , , , TDD;
- 5 ;
- 6 , ;
- , .
, 3b 4.
, :
- -.
- ( ) .
- () SQL-.
- SQL-, .
.
- https://habrahabr.ru/post/121265/ 2, 3. , , . , 1000 , , ( - ). , (5).
- https://habrahabr.ru/post/258005/ 3 1 redgate SQL Source Control redgate SQL Compare. ( , Atlassian) , , , DB QA, prod.
- https://habrahabr.ru/post/312970/ , . CI, QA, - prod. , . .
, . . continuous integration (, TeamCity JetBrains Jenkins). , - .
1 -
Redgate SQL Compare. http://compalex.net/, php. .
prod dev -.
- -. - , , , ( , ) . , , - , , . . , - Management Studio ( GUI ) . . , , ( ) diff-, , .
- , sql. - ( , ).
- ( , , , ).
- , (2).
- - prod. , , ( --, ?). , . , , .
- - , -. , - , prod, -, - .
- , . , . , . , ( , ).
diff-, , .
- . , (, ) - . .
- :
( ),
.
- SQL Server'.
- - - -, deploy .
- , prod .
- , redgate SQL Compare . , .
- 1b , SQL Data Compare; 1c; 1d; 1e.
- 2 . , .
- 3a , . deploy . , . . - .gitignore.
- 6 , .
2 C ( )
, , . . , , , . , .
- , , (, ). , , diff-, code review, .
, , SQL Server.
3 () SQL-
flyway db. , (https://github.com/lecaillon/Evolve , , , - ).
. . sql- , , . , . , . , , . , .
Qiwi. , . , . QA-, git , , , , , prod.
- , . , , . , .
- ( ) . .
- (1b), (1c), , SQL Server (1de).
- - (3b).
- , (2a).
- , alter , .
- , .
- , :
. , , . ( 4).
deploy , , - , , ( ).
- . , alter, , . , . , . , , - , bat, , , 4.
4 SQL-,
liquibase. , (redgate SQL Source Control, https://www.quora.com/What-are-the-alternatives-to-LiquiBase , ).
, , . , . , , , , , . , - , , , . , , , ( , , / - ) .
create (changeset) alter create index - . changeset, .
/// , . , changeset , alter (, SQL Server create or alter). changeset , .
deploy bat-(-), . deploy bat.
, ( changeset ) . .gitignore.
:
< >
core
.
, .
< > :
- (create database, alter database , , )
create_db.sql
- (-) , SQL Server (sp_configure, sp_add_job , sysmail_add_account_sp , alter database etc). .
config_db.sql
- . includeAll , , , .
tables.xml
- . , .
views.xml
- . .
migrations.xml
- . 1 2 , CLR_Objects, Tables (, tables.xml), Types, Functions, Views (, views.xml), Stored_Procedures, Triggers . , .
master_Scheme.xml
- . , // ( Migration_Scripts, , migrations.xml)
master.xml
, / , , . includeAll , .
bat-, , deploy_local_scheme.bat, deploy_local_full.bat, deploy_prod_scheme.bat, deploy_prod_full.bat, deploy_.bat etc. 18 , , .
, bat- connection string .
:
- update. changeset.
- status. , changeset .
- udpateSQL. sql-, changeset.
- changelogSync. changeset , . , . .
:
> %outputfilename% 2>&1
Changeset :
- runOnChange
=true
changeset ( =false
, changeset' changeset );
- runAlways changeset deploy.
, , - , (, , , -), alter sp_rename , , . , , , changeset . changelogSync, , md5- .
- ( ) . 3.
- 2, code review, .
- (2bcde) . bat- , , , changese label, .
- (4).
- . . -changeset , .
- , , changeset alter table. changeset. 2 ( create), 3 .
- . . . , , .
3b. .
https://habrahabr.ru/post/330662/