How to use source control with apex?
-
Upload
oliver-lemm -
Category
Data & Analytics
-
view
1.123 -
download
1
Transcript of How to use source control with apex?
How to use Version
Control in APEX projects?
Oliver Lemm
APEX Connect
26.04.2016
Facts & Figures
Independent Technology House
with Cross-Industry Expertise
Headquarter
Ratingen
(North Rhine – Westphalia)
240
Employees
Founded
1994
Branches
Dortmund, Cologne,
Frankfurt
Top Company
for Trainees &
Students
Privately-
Owned
Corporation
Oracle
Platinum
Partner
24 Mio. Euro
Revenue
2
about me
Oliver Lemm
since february 2007 working for MT AG in Ratingen
Competence Center Leader APEX & Service Center Leader APEX
Diploma applied computer science at the university of Duisburg-Essen
Projectleader, IT-Architect and Developer
working with Oracle Databases and Oracle Application Express since 2007
Blog http://oliverlemm.blogspot.de
Twitter https://twitter.com/OliverLemm
3
Agenda
1. Motivation
2. Version Control
3. Versioning APEX Application
4. Versioning Database Objects
5. Versioning external Files
4
Motivation
5
Motivation
„make it visible what has changed, who changed it and when was the change“
„create a snapshot of the whole scripts of a delivered software“
„define a central repository for the code“
„make it possible to automate testing and deployment“
6
Version Control
Version Control
Revision Control
Numbers
Source Control
Files
Source Code Management
„SCM“ Software ConfigurationManagement
7
Version Control
proprietary and local
PVCS since 1985
Open Source & Client Server
CVS since 1986
Subversion / SVN since 2000
Distributed
Git since 2005
GitHub – web-based Git repository
8
software history
Version Control
you need a repository server
direct commit into repository
revision and version central
version history only on server
Central approach supports security and rights management
9
Subversion
working directory
repository
Source Control
10
keywords
commit merge diff update
trunk tag branch
Version Control
there is no repository server
all operations are locally
sync mechanism for distributed systems
11
Git
working directory
staging area
repository
Source Control
12
keywords
pull push clone rebase
staging Remote dirty
Version Control
Subversion
TortoiseSVN (Windows) Cornerstone (MAC)https://tortoisesvn.net/ http://www.zennaware.com/cornerstone/
Git
Sourcetree (Windows & Mac)
https://www.sourcetreeapp.com/
13
client tools
Versioning APEX Applications
f100.sql
14
one or many?
Sharedcomponents
Navigation
• Breadcrumbs
• Tabs
User Interface
• lov
• templates
• themes
• shortcuts
Security
• authorization
• authentication
Plugins
• dynamic action
• Item
• Process
• region
Pages
Versioning APEX Application
15
single vs multiple
single file multiple files
web based Export & Import Divide into multiple by using APEXExportSplitter
one big file including static files better usable with version control
bring a single change to other instance
all changes encapsulated dependency tracking by developers
changes always replace – no update scripts
Versioning APEX Applications
export your application as often as you have done changes
commit the application changes together with database changes
commit single file AND splitted files (by automation)
deliver single file for installation
use splitted file for identifying changes
16
conclusion
Ordered?
17
Versioning Database Objects
• Reference Data
• Metadata
• Data Migration
• Grants & Synonyms
• Installation Scripts
• Package
• View
• Trigger
• Type
• Table
• Sequence
• Alter Objects
DDL PLSQL
DMLother
18
Versioning != Versioning
19
Frontend Backend
Versioning Database Objects
divide files by Schema
don‘t use schemanames in script
don‘t mix up DML, DDL and PLSQL
single script for every object
use force in types and views
20
preconditions
Versioning Database Object
create a file for every schema combination for grants
one file for synonyms
Include a check in every DDL and DML
21
optional
folder structure
trunk/objects in development
tags/Every release gets a subfolder in tags
branches/objects in parallel development
objects for hotfixes in old releases
22
level 1
/trunk/
/tags/
/branches/
folder structure
one folder per release as subfolder
every releasehas the same structureas the trunk
23
level 2 – tags & branches/tags
/1_40_1
/1_40
/…
/1_1
/branches/
/1_40
/1_30
folder structure
Windows -> batch
Linux -> shell
Scripts with instance parameters
Scripts usable with CI/CD or
standalone
No SQL or PL/SQL
24
level 2 – trunk/batch or trunk/shell
/trunk
/batch
/shell
/config
/doc
/logs
/app
/schema_main
/schema_export
/schema_import
/scripts
/static-files
/db-model
folder structure
25
level 2 – trunk/config
config one file for every target instance
Database-IP
Database-Port
Database-Servicename
Schema and Password
Tablespaces
Datafiles
Release
Additional Parameter
Based on security restrictions parametersnot included dba / datapump / sys
/trunk
/batch
/shell
/config
/doc
/logs
/app
/schema_main
/schema_export
/schema_import
/scripts
/static-files
/db-model
folder structure
26
level 2 – trunk/doc
Release Notes
Documentation
Installation Notes
PL/DOC
/trunk
/batch
/shell
/config
/doc
/logs
/app
/schema_main
/schema_export
/schema_import
/scripts
/static-files
/db-model
folder structure
27
level 2 – trunk/logs
One Installations/Patchlogsfolder per Instance
Foldername based on Servicename
Serveraddress
Example:/ORCL.DEV-COSMOS.DE
Every installation creates a new entry in /tags/version
If not installing by automationplace logs from installation by hand
/trunk
/batch
/shell
/config
/doc
/logs
/app
/schema_main
/schema_export
/schema_import
/scripts
/static-files
/db-model
folder structure
Place your APEX APP here
28
level 2 – trunk/app
/trunk
/batch
/shell
/config
/doc
/logs
/app
/schema_main
/schema_export
/schema_import
/scripts
/static-files
/db-model
folder structure
one subfolder per schema
use schema_<name>easier with parameter
human readable
Higher security when runningscripts from one schema separated
29
level 2 – trunk/schema_xxx
/trunk
/batch
/shell
/config
/doc
/logs
/app
/schema_main
/schema_export
/schema_import
/scripts
/static-files
/db-model
folder structure
30
level 2 – trunk/scripts
Scripts for the installation processGenerated installationscripts
Recompile
Checking for invalide objects
Pre-Patchchecks
Updating to the new version
Every Script is called byshell or batch script
/trunk
/batch
/shell
/config
/doc
/logs
/app
/schema_main
/schema_export
/schema_import
/scripts
/static-files
/db-model
folder structure
Subfolders
/img
Grafiken der Webanwendung png / jpg / gif …
/js
JavaScript Dateien/libraries *.js
/css
Stylesheet Datei einer Webanwendung *.css
31
level 2 – trunk/static-files
/trunk
/batch
/shell
/config
/doc
/logs
/app
/schema_main
/schema_export
/schema_import
/scripts
/static-files
/db-model
folder structure
save your SQL DataModeler
optional additional subfolder per schema
divide schema-SQL files
32
level 2 – trunk/db-model
/trunk
/batch
/shell
/config
/doc
/logs
/app
/schema_main
/schema_export
/schema_import
/scripts
/static-files
/db-model
folder structure
33
level 2 – trunk/schema_main/apex
View/Package layer for every APEX Page
One subfolder per Page or Page group
easier to handle
page layer gets invalide when related objects change
/trunk/schema_main
/apex
/p0100
/p0200
/p0300
…
/ddl
/dml
/plsql
folder structure
34
level 2 – trunk/schema_main/ddl
Only scripts which are ddl.
No „create or replace“
additional subfolders
/tbl - tables
/seq - sequences
„alter“ Scripts saved in ddl
/trunk/schema_main
/apex
/ddl
/tbl
/seq
/dml
/plsql
folder structure
35
level 2 – trunk/schema_main/dml
Only DML
no subfolders
/trunk/schema_main
/apex
/ddl
/dml
/plsql
folder structure
36
level 2 – trunk/schema_main/plsql
/plsql/
Only scripts with „create or replace“
additional subfolders
/pkg - Packages
/trg - Trigger
/typ - Types
/vw - Views
/trunk/schema_main
/apex
/ddl
/dml
/plsql
/pkg
/trg
/typ
/vw
Bild mit Durchblick, Erkenntnis, Freude
37
38
Presentations by MT AG
Dienstag, 26. April Mittwoch, 17. April Donnerstag, 28. April
14.00 Uhr | Music Hall 1
Echtzeitvisualisierung von Twitter und Co.
| Kai Donato & Oliver Lemm
16.15 Uhr | Music Hall 2
12.00 Uhr | Soul
14.00 Uhr | Music Hall 3
14.00 Uhr | Jazz 1
16.15 Uhr | Music Hall 1
11.00 Uhr | Music Hall 1
11.00 Uhr | Music Hall 3
14.00 Uhr | Music Hall 2
Universal Theme vs. APEX mobile vs.
MAF
| Davide Groppuso & Steven Grzbielok
WebSocket my APEX!
| Kai Donato
Single Sign-On für alle!
| Niels de Bruijn
Workshop: Einstieg in die aktuelle Version
von Oracle Application Express
| Oliver Lemm
Wie versioniere ich in APEX?
| Oliver Lemm
Interactive Reports Downloads Reloaded
| Moritz Klein
Zeitreisen mit PL/SQL
| Daniel Dyla
APEX for mobile only. Gewusst wie!
| Alexej Schneider
@OliverLemm
http://oliverlemm.blogspot.de/
http://de.linkedin.com/in/OliverLemm
https://www.xing.com/profile/Oliver_Lemm
Thanks!