TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed!...

19
Agilex www.agilex.com Topics in Database Version Control Dominic Delmolino

Transcript of TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed!...

Page 1: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Topics  in  Database  Version  Control

Dominic  Delmolino  

Page 2: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Dominic  Delmolino !  Oracle  database  technologist  /  engineer  since  1990  !  Former  

!  Member  of  Oracle’s  System  Performance  Group  !  CTO  of  Savant  CorporaDon  !  Director  of  Database  Engineering  at  Network  SoluDons  

!  Current  !  Member  of  OakTable  !  Oracle  Ace  !  Vice  President  of  Database  Architecture  and  Engineering,  Agilex  Technologies  

!  Social  !  Blog  at  OracleMusings.com  (infrequently)  !  @ddelmoli  on  TwiSer  

!  Author  !  Strategies  and  Techniques  for  Oracle  ReplicaDon  (1995)  !  Chapter  on  Parallel  PL/SQL  programming  in  Expert  PL/SQL  PracDces  

!  CerDficaDons  !  Oracle  Exadata  CerDfied  ImplementaDon  Specialist  !  Cloudera  CerDfied  Developer  for  Apache  Hadoop  

Page 3: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Sync  vs.  Directed  Applica:on

!   Sync  –  Uses  a  reference  model  and  diff  process  

!   Directed  ApplicaDon  –  Uses  a  changeset  model  and  directed  scripDng    

Page 4: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Central  vs.  Distributed

!   Central  Database  –  all  developers  work  against  a  single  instance  

!   Distributed  –  all  developers  work  against  a  private  “database”  

!   Hybrid  !   Private  schemas  !   Private  Pluggable  Databases  (12c)  

Page 5: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Reference  and  Volume  Data  Management

!   Reference  Data  !   Similar  to  Sync  vs.  Directed  ApplicaDon  problem  

!   Data  Volume  !   StaDsDcs,  plans,  good  queries  vs.  bad  queries  

Page 6: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Trends  in  SCM  /  CI

! Git  vs.  Subversion  !   Code  Reversion  !   TDD  

Page 7: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Shared  (Central)  vs.  Private  (Distributed)

!   Central  !   Pros  

!   Easy  to  share  load  and  reference  data  !   “Immediate”  integraDon  J  !   Visibility  by  DBAs  into  poor  code  

!   Cons  !   Locking  !   PotenDally  deferred  SCM  !   Breakage  

Page 8: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Shared  (Central)  vs.  Private  (Distributed)

!   Distributed  !   Pros  

!   Private  sandbox  for  tesDng  !   No  locking  !   Same  connecDon  string  for  all  developers  

!   Cons  !   Need  good  CI  /  SCM  process  !   Limited  data  !   Limited  oversight  /  guidance  capability  

Page 9: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Shared  (Central)  vs.  Private  (Distributed)

!   Private  Schemas  !   Pros  

!   Private  sandbox  for  tesDng  !   No  locking  !   Oversight  capability  

!   Cons  !   Different  connecDon  strings  for  each  developer  !   Need  good  CI  !   Limited  data  !   Schema  name  proliferaDon  may  limit  branching  capabiliDes  

Page 10: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Shared  (Central)  vs.  Private  (Distributed)

!   Pluggable  Databases  !   Pros  

!   Private  sandbox  for  tesDng  !   No  locking  !   Oversight  capability  

!   Cons  !   Different  connecDon  strings  for  each  developer  (but  schema  names  can  be  the  same)  

!   Need  good  CI  !   Limited  data  

Page 11: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Sync  vs.  Directed  Applica:on

!   Sync  !   Comments  

!   Based  on  “diff’ing”  reference  model  with  current  model  !   Some  ORM  tools  do  this  (i.e.,  Hibernate  verify)  

!   Pros  !   Good  tooling  based  on  exisDng  schema  diff  tools  (i.e.,  Schema  Compare  for  Oracle,  Source  Code  Control  for  Oracle)  

!   Easy  to  create  /  maintain  a  reference  PDM  !   Cons  

!   Limited  control  over  how  to  apply  changes  !   Limited  rollback  capabiliDes  

Page 12: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Directed  Applica:on

!   Directed  ApplicaDon  !   Comments  

!   Developers  write  code  to  apply  changes  to  a  schema  !   Called  changesets  (liquibase),  migraDons  (ruby)  or  refactoring  scripts  

!   Pros  !   Good  for  tracking  who  did  what  when  and  why  !   More  opDons  for  rollback  !   More  control  over  how  change  is  applied  !   Slightly  beSer  integraDon  with  CI  tools  

!   Cons  !   Hard  to  maintain  a  reference  PDM  !   Not  as  good  for  full  rebuilds  !   Limited,  unfamiliar  tooling  

Page 13: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Trends  in  SCM

!   My  background  is  with  SCCS  and  older  tools  !   SVN  !   Git  

!   GitHub  /  Bitbucket  popularity  !   Rise  of  distributed  version  control  !   Local  workspaces  

!   Full  stack  copy  of  environment  for  every  developer  

!   Local  repository  

Page 14: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Reference  Data

!   Data  as  Code  !   Controlled  via  SCM  !   Would  be  nice  if  dbDoc  type  generators  could  produce  reference  data  output  as  well  

Page 15: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Reversion

!   How  do  we  revert  database  code?  !   More  importantly,  how  do  we  test  DDL  changes  before  deploying  them?  

Page 16: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

TDD

!   Can  DDL  be  TDD’d?  !   Rule  asserDons  like  those  in  SQL  Developer  Data  Modeler  

!   Naming  standards?  !   Standard  abbreviaDon  list?  

Page 17: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Branching

!   Can  this  be  used  to  do  TDD?  !   Local  vs.  origin  vs.  master?  !   Schema_Name[suffix]  

!   MulDple  copies  of  the  schema  !   Suffix  maps  to  a  branch  name?  !   Reference  schema  from  ERD  Model?  !   Local  work  schema  !   “Official”  schema  

 

Page 18: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

Building

!   CI  process  that  produces  success  /  failure  indicators  

!   Temporary  build  workspaces  and  arDfacts  !   JPA  generaDon?  camelCase  vs.  column  name  vs.  standard  abbreviaDons?  

Page 19: TopicsinDatabaseVersionControl€¦ · Agilex Centralvs.Distributed! Central’Database’–all’developers’work’ againstasingle’instance’! Distributed’–all’developers’work

Agilex www.agilex.com

QuesDons?    Dominic  Delmolino  [email protected]  @ddelmoli