Showing posts with label Studio. Show all posts
Showing posts with label Studio. Show all posts

Wednesday, February 4, 2026

Committing code changes (2 of 5) Getting started with GitHub

on this episode of Visual Studio toolbox
we're continuing our mini series on
getting started with GitHub we're going
to see what happens when you actually
write code
[Music]
hi welcome to visual studio toolbox I'm
your host Robert Greene and this is
episode 2 in our five part miniseries on
getting started with GitHub in the
previous episode we looked at how to
create a project in visual studio and
then we created a GitHub repository with
that code and in this episode we're
going to start writing some code and see
how we work with GitHub
so I created a simple console
application we have a simple line of
code here let's make a change to it so
I'm going to change the greeting to
hello Visual Studio toolbox
now get is watching locally and I can
see that we have a change so if I come
down here to the lower right and I look
at this little pencil in the status bar
it says one telling me I have one change
I click that and I go to the get changes
window where I can see all of the
changes I've made and I can see that
program.cs has been modified well from
here I can undo the changes if I want I
can also stage these or stash them which
means I'm not ready to commit now but
I'll commit them later on but in this
case I think I'm ready to go so I'm
going to enter a message which is
required when I do a commit I have to
enter a message which is a good thing so
I'll just say changed greeting
and then I have some choices I can
commit all commit them to my local
repository which does not send them to
GitHub I might do that if I want to uh
if I'm done working for the day and I
want to make sure that I've kind of
backed up that code committed it to the
repository locally in my machine and
then when I'm ready to send it up to
GitHub I'll do a push so I'm going to do
this right now this is one of my
favorite features you have to save your
files before you commit I almost never
remember to so like Visual Studio warns
me so I'll save this and commit it and
what that's going to do is copy these
changes up to the master branch in
GitHub so successfully pushed so not
presumably we can pop over to GitHub
and look in the code and look in program
and there's the change I made very cool
now what we can also do in GitHub is
click on this changed greeting and see
what the changes were oh I changed it
from world to visual studio toolbox very
nice
now if I come back into Visual Studio I
know I have this change here what I can
do is again go to our Branch history and
see that I changed the greeting so again
Robert is me locally Robert Green are
any changes I make on GitHub
representing another developer or me on
a different machine and then I change
this locally and if I double click on
this I can see the changes so this is
the code that was this is the code that
is I can switch around from side by side
mode to inline mode whichever one works
best for you
okay
so now
I'm not the only one working on this
application turns out
so
maybe the other developer also decides
to change the greeting and I'm going to
do this in GitHub just to keep it simple
typically you'd probably do this in
Visual Studio or Visual Studio code but
rather than have multiple visual Studios
floating around I'm just going to make
all my changes in GitHub
so I'm going to change this to visual
studio developers I mean commit the
changes
commit message defaults to update
program name and extended description
I'll type changed greeting and I'll
commit this to the master branch
okay so another developer is made a
change
now back in Visual Studio
I'm told hey somebody changed your code
now I've got a couple choices I can do a
pull which will bring down those changes
in overwrote what I wrote but maybe I
want to see what the changes are ahead
of time so I can do a Fetch and what a
fetch will do is bring down from GitHub
the latest version of the master branch
and store it in my repository history
but not overwrite my version
so now I can see what the differences
are so if I click here I see I have one
incoming
and I can see that
program.cs was updated by somebody on
the server I double click on that and I
can see
the code that I have Visual Studio
toolbox and the code it was changed to
visual studio developers and I'll decide
okay that's fine I'll take that so now I
can do a git pull and copy down the
remote version to my local version
and now if I go look at my program.cs
I've got the latest version so this is
how I can keep my local version of the
repository in sync with the remote
version up in GitHub which will be sort
of our official version and then if I
come into the history and do a refresh
here I see that I changed the greeting
locally somebody else changed it on the
server I did a poll to bring everything
down and now my version of the code
locally is in sync with the version of
the code remotely that's basically how
we're going to have multiple people
changing code and everybody then pushes
it up into the remote repository which
is the official version and then by
polling we can keep our local copy in
sync
so what we've seen in this episode is
what happens when we start making
changes to code so we made a change we
pushed it up to GitHub somebody else
made a change they pushed it up to
GitHub so we saw you can have multiple
developers or you working on multiple
machines or multiple versions of Visual
Studio it all works how we can keep our
local repository in sync with the remote
repository which is essentially the
official version of the code
if you're watching on YouTube and you
like this please like us share with your
friends and come back for episode three
in our mini series we're going to look
at working with branches and see what
pull requests are used for
we'll see you next time on Visual Studio
toolbox
foreign
[Music]

Create a Pull Request in Visual Studio

with the new create PR feature in Visual
Studio I can go ahead and create a new
branch
here I'm basing it off of my development
branch
I can go ahead and make a change
in this scenario I'm doing a simple
rename but it's going to affect a couple
different files
and when I stage and add my commit
message
I'll be ready to commit
and then push
and now this link instead of taking me
out into the browser
takes me to the new pull request window
where I can click between my changes
edit or add my title
and I can also add a description
here I'm going to use the feature search
to find the description item that I want
to reference
and when I create this PR this will be
linked to that item
I can view my pull request in the
browser afterwards
and I can also leave feedback which you
really need to help improve this feature
thanks for watching

Creating Games with Unity and Visual Studio

>> You know Visual Studio Toolbox,
it's all fun and games.
We always have fun.
Today, we're going to
see with Visual Studio in Unity.
That you can build
games like this.
Hi, welcome to Visual Studio
Toolbox. I'm your host
Robert Greene, and
joining me today is
Arturo Núñez. Hey Arturo.
>> Hey Robert, how are you?
>> Good. Arturo works with Unity,
and so we're going to talk today
a little bit about gaming.
>> Yes.
>> Unity and Visual Studio have
gotten along very well
together for quite some time.
It only gets better.
>> Yeah.
>> So, you're going
to show us some of
the new things in the latest
version in Unity,
latest version Visual Studio,
you're going to turn me
into a game writer in
less than 20 minutes. This
is going to be awesome.
>> Possible, yeah.
>> Cool.
>> Yeah.
>> So, let me talk to
you about Unity first.
>> Okay.
>> So, of the audience who
doesn't know what Unity is.
Unity, it started
as a game engine.
But now, we call it
a creation engine.
Basically, you can
create games but you can
also create interactive
applications for VR,
AR in 3D, 2D.
>> Right.
>> So, that's what we are doing.
>> So, if you do
HoloLens, there's Unity.
If you do mixed reality
there's Unity.
>> Right. So, we support
30 plus platforms.
So, basically, if you want to
deploy your project to
any platform that's out there,
you can with Unity.
>> Yeah.
>> Cool.
>> Yeah. So, the tool
is pretty easy to use.
So, if you're an artist,
you can grab Unity,
you can create something cool
without having to program.
If you're a programmer, you have
complete control over
what you want to do.
Like, if you want to
program the graphics,
you can do that.
If you want to program
the behavior of
your characters or the
things that's there,
you can absolutely
do that using C#.
>> Right.
>> As a language we support.
>> So, you create the graphics,
the UI if you will in Unity.
>> Yeah.
>> Which has its own IDE,
and then in Visual Studio,
you do the scripting.
>> Right.
>> You can do in C#
and other languages
to actually control what happens.
>> Right. So, Unity takes care of
everything like the rendering,
the audio, all of
those things for you.
So, you just need to focus
on the behavior specific
for your project.
>> Okay.
>> That's how it works.
It's C#, we support
other languages
but the best experience
is, it's using C#.
>> Right.
>> Yeah, that's what Unity is.
Yeah. So, let me show you.
>> All right.
>> A demo using Unity.
So, this example is
called AngryBots,
something like six years ago,
at the same demo, now with
the new newest features of Unity,
we're showing the same project
but with a newest
graphics addition.
>> Okay,.
>> This is how Unity works.
It's an editor, it's software,
so you can basically drag
and drop stuff into your project.
So, in this case, I created
these spider robot
in another program.
These are 3D models, the textures
were made in another program.
I bring those into Unity,
and I simply can position them
whenever, whatever I want.
>> So, you need to have this
type of graphics capability?
I need to be able to
draw floors and robots?
>> That's a good question.
Usually, you can you if
you have the ability
to make them.
However, we have something
called the Asset Store.
>> Okay.
>> So basically, if you
just want to focus on
the coding part,
you can go there,
grab some stuff
that it's premade,
some animations are premade,
and just use them
for your project.
>> Right, and then you can
edit those if you want to?
>> Yeah, absolutely.
>> Okay.
>> If you like this spider
but you want another color.
>> Right.
>> Or are you trying to
make some more changes,.
>> More legs or fewer legs.
>> Right, that's possible.
>> Okay.
>> So, that's how
you create your-
>> Okay.
>> - world. You can have
a 2D or 3D project
and the only thing you
have to do is simply,
click "Play" to start
the simulation of
your project and you can
start playing right away.
>> Okay.
>> So, Unity also takes
care of all the input.
So, if you're playing
on a PC or an Xbox One,
or whatever Unity will
translate that input
into whatever you
were working on.
So, it's a really simple game,
a shooter, that space marine.
We have a lot of tools inside
Unity to create these things.
However, the powerful thing
here is that you,
as a programmer,
can add behavior on
top of everything that
Unity offers you,
either on the runtime
or on the editor.
Unity is fully extensible.
So, if there is something
that Unity doesn't
have right now,
you could go there and
extend the Unity Editor.
So, yeah that's in
a nutshell what Unity is.
>> So, the creatures that
bought the space marine
that comes with
some built-in behaviors,
like the ability to go
forwards and backwards,
and left and right
and jump, et cetera?
>> Yeah.
>> Then, you program
additional stuff?
>> Right. So, some
of these objects already
come with built-in behavior.
>> Okay.
>> So, if you want to start
prototyping or doing
some of those things,
we offer you a collection of
assets that you can
simply drag and drop,
and start having something
like a camera that moves around.
>> Okay.
>> Or a character
that walks around.
But as you progress
during your development,
maybe you want to
code the specifics
for that project you want.
>> Okay.
>> That's where.
>> Because I think that if
you're just starting out,
you'd want to reuse stuff
that's already made.
>> Yeah.
>> You get the feel
for how it works.
>> Yes.
>> Then, get better and
better in terms of creating
your own assets, et cetera.
>> Right. So, yeah.
That's the idea that used to get,
started using Unity real quick.
But if you are an advanced user,
you can do whatever you want.
>> Okay.
>> Yeah, that's it.
So, this is the editor of Unity
and the best idea ID for
editing your C# code,
and I'm saying these
truly, it's Visual Studio.
>> Yeah.
>> I've been using
Visual Studio for forever.
Every time, we are working
closely with Microsoft,
so the experience gets
better and better.
>> All right.
>> So, now, we have
the ability to
debug your Unity projects
in Visual Studio
and the workflow,
it's so clean, it's so fast.
That's one of the things
that I'm super excited.
>> Cool.
>> So, yeah. This is a
basic C# script for Unity.
Basically, if you want to respond
to Unity's built-in messages,
you need to extend
MonoBehavior class.
>> Okay.
>> But you already know C#,
I will say, you are
like on the other side.
>> Right.
>> You already know most of
the things you need
to do to start.
>> So, it brings up
an interesting question.
Unity is on the Mono runtime.
>> Yes.
>> Right? So, what version of C#,
what version or equivalent
version of .NET if
I come in here?
>> Yeah.
>> How much of what I'm used to,
would I be able to
actually run inside here?
>> Right. So, we're
revamping that.
A couple of years
ago, we were still
using old versions
of C# and Mono.
Right now, we offer support
for the equivalent of 4.2.
>> Okay.
>> 4.X runtime.
C#, currently we support C# 6.
>> Okay.
>> But with the newest
version of Unity,
we're going to
support C# 7 feature.
>> Okay,.
>> So, we're trying to get there
to provide the latest tools
that are out there.
>> Right.
>> Yeah.
>> Then, that gives
you the ability not
only to do basic C#,
but call into
various frameworks stuff,
talk to Azure if you want to
store information up on
the cloud or whatever.
>> Yeah.
>> Because it's.NET.
>> Yeah.
>> Right.
>> Absolutely.
>> Cool.
>> So, yeah. That's something
that you can absolutely do.
Also on the performance side,
now with these upgrades
of the runtimes,
recurring performance boosts,
also some bugs have
been fixed now.
>> Yeah.
>> So, it's pretty.
>> Okay.
>> Yeah. So, yeah,
I just want to show you.
>> Yeah.
>> A couple of things of
how the workflow works.
If you are using
Visual Studio and
Unity, so for instance,
as you have seen here,
Unity comes with
a project window.
>> Right.
>> So, this part of window
has all the assets
in your project.
So, from textures, sounds,
scripts, videos, everything.
If you're a programmer,
you might not
necessarily care
about these assets.
You just want the code,
you just want to have
the scripts somewhere at hand.
So, with Visual Studio,
if you go to "View" window,
there is a new "Unity
Project Explorer",
and this tool allows you just
to see the scripts
in your project.
>> Okay.
>> So, if I'm just focusing
on programming right now,
I don't need to worry about
clicking other assets
that I don't care about.
Another cool thing, and this is
if you know already C# but
you don't necessarily know
the specifics of the Unity API.
>> Right.
>> You can go to the documentation,
do things like that.
But if you just want to to
get up to speed with this,
there's an awesome feature.
>> Then, I see the screwdriver.
There, you see your full
support for Roslyn.
>> Yeah. So, yeah.
>> Or at least, much support.
>> Yeah. So, yeah.
>> All right.
>> So, there's an option if
you click "Ctrl+Shift+M",
the Implement Unity
Messages option appears.
So, all the messages
you can see here
are messages that
any MonoBehavior
can be seen from the engine.
So, every time you click "Play",
Unity calls start on
all the objects that
are on the scene.
So yeah, sometimes, we
have a lot of them.
>>Yeah.
>> So, maybe you don't
know all of them,
this feature, it's pretty useful.
So, in case I want to say,
"I'm pleased Visual Studio."
Define sorry- The "On Trigger"
enter message, right?
If I want to listen to
whenever two objects
collide with each other,
then Unity is going to notify me.
Okay, something collided here.
I didn't have to go to
a browser to search
how it's their correct signature
for this method,
so it's pretty quick.
I also want to show you
how easy it is to debug.
This is very important because in
the previous IDE Unity used
or what's it shipping with;
it was hard to do the bombing.
So, developers ended up just
printing everything
to the console.
It's difficult to do that.
That's not the best tool to that.
Within Visual Studio, you can
simply add your breakpoints,
as you do if you already know
how to use Visual Studio.
In this case, this
breakpoint will be called
every time I shoot a projectile.
>> Okay.
>> Within Unity, I can simply
"Attach to Unity and Play".
So, I don't need to be switching
between Unity and Visual Studio
so I can simply say,
Visual Studio, launch Unity,
while you connect
to that process.
So, I can now start
debugging my project here.
So, as soon as I shoot,
Visual Studio
captures that event,
and I can inspect as you
already do in Visual Studio.
>> Very cool.
>> Yeah, it's pretty cool
tools for developers.
Also important because Unity
is now used by
the other industries.
People making interactive
applications, so yeah,
most people are new to
programming so having
these tools at hand,
Visual studio is very
important for us.
>> So, new to programming.
What if you've been doing
.NET for a while, C#,
web apps, line of business apps,
and now you want to
try it here at gaming?
>> Yes.
>> So, the part where you write
C# code in Visual Studio
is pretty familiar.
You can go to
the asset store and get
a bunch of assets, but
how hard is it for somebody
that's just used to
writing regular line of
business apps to come over and
learn the world of gaming and-
>> Right, and the graphics
and things like that.
>> -and graphics?
>> Yeah. So, there are a lot of
resources on the web
on how to learn
using Unity either by
the community but we also
have official documentation.
I think it's fun
to work on these,
because if you are trying
to follow a tutorial,
you're making a game, right?
>> Right.
>> So, you get excited
about shooting a star,
about collecting points
and things like that.
So, there's a lot of
documentation on that.
One thing I always recommend
people on doing is at
least knowing the basics
of graphics or math.
It's not required, but I
think you can have
more fun if you do.
>> Right. Yeah. Well, you have
to understand
the underlying platform.
Like if you say alarms,
use Xamarin and
write mobile apps,
because Xamarin is just C#.
>> Right.
>> You get over there and
the code you write is similar,
but if you don't
really understand
the iOS runtime or
the Android runtime,
how great an app can you write?
If you come over
into Unity and you
know C# and you know
a few things we don't
really understand what
that engine is doing,
how great a game can you write?
So, you do ultimately
need to get pretty good
at that kind of stuff.
>> Yeah, absolutely.
Another thing that is-
>> But you don't want
to have to wait to
master that before you can
create your first game
where somebody runs
backwards and forwards
and jumps, right?
>> Yeah. So, yeah,
definitely you do need to know
the underlying platform
you're running,
the hardware you're
running because
you're writing a mobile game.
But it's too process intensive,
it's going to drain the battery
in a couple of minutes, right?
So, you don't want
that experience for your user.
One thing that Unity
already takes care of is
trying to write
the optimized code
for each platform
towards port two.
However, you still need to know,
as you said, the underlying
platform you're targeting.
>> So, how does that part work?
You want this game to
run on PCs, on Macs,
on various phones, obviously
the code behind is the same-
>> Yes.
>> -any has the ability to
compile into those platforms,
but you have to do
the UI differently?
>> That's an interesting
question. You don't.
We provide you tools,
you define your UI,
for instance, in a certain way,
and then Unity will
take care of scaling,
and managing all those things.
As you said the code that
you write is the same,
Unity will take care of compiling
to the specific platform.
The only thing you
need to do basically
most of the time is
just tell Unity;
Okay, I want you to build
two Xbox One, for instance.
>> Okay.
>> In this case, I don't
have the component loaded.
I need to go to the Internet
and install it, okay?
>> Okay.
>> But it's super
simple to do that.
>> Okay. Cool. Then you
may decide that your game is too
busy for smaller form factor-
Yeah.
>> -and then you might
have to adjust it that
way if the scaling doesn't
take care of it for you.
>> Yeah. Another thing is given
the hardware differences between
devices like if I'm burning here,
I might not care about
my computer draining the battery
because I can plug in,
but if I'm on
the cell phone, I am. So-
>> Sure.
>> -yeah, you need to take
care of those things.
There are a lot of
other components that
you can understand if you want,
if you're interested into that,
but some of the other things
you don't have to.
You just want to have
a lighting source,
you put a light
there, it will work,
and you don't have to worry
about that. So, yeah.
>> Cool.
>> So, you can grab Unity for
free, if you're starting.
There is a personal edition
if you want to try it out.
Everything is unlocked, meaning
that you can do whatever,
that engine is not locked
with any features for
pro customers or anything
so that you can just
play around with that.
Also, I know the audience
it's interested
in like open source platforms,
or open source projects.
Unity itself is not open source.
However, we are opening
many of Unity's components.
So, the UI is open source,
the networking is open source,
many of Uniti's components
are open source.
>> Cool.
>> You can collaborate, you can
receive what's
underlying the platform.
>> Right.
>> That's possible.
>> If you wanted to you could use
Visual Studio Code to do
the scripting as well, obviously?
>> Yeah, you could.
>> You just don't get
the nice tie in from IDE to IDE.
>> Right. So, yeah. Those
are our C# scripts, so-
>> Right.
>> -you can edit them anywhere.
>> Okay, cool.
>> But If you want to have
all the speed of development.
>> Right.
>> That's it. Unity is
available on Mac for-
>> Okay.
>> -for authoring. So, if you
have Visual Studio on the Mac,
the experience is
going to be the same.
>> Okay. So,
Visual Studio for Mac
also ties in just as nice.
>> Yeah, it works great.
So, it's important because
before if you were
developing on PC and then
you had to switch to
Mac to do iOS development
or something,
you had to switch
your environment,
but now you can have
the same stuff running
on both platforms.
>> Awesome.
>> Yeah. So, also we're
announcing this partnership
with Unity and Visual Studio.
There's going to be
a bundle out there,
so you can save a couple of
$100 if you get Unity
and Visual Studio.
>> Okay. So, if you already have
Visual Studio you can just get
Unity user for free
and then at some point
you have to pay,
probably if you're now
selling games and whatnot,
I would imagine, right?
>> Yeah. Well, so, our licensing
it's pretty good I think.
You don't have to pay
us anything if you make
less than $100,000 per year.
>> Oh, okay.
>> You can even make money
out of your projects,
you don't have to pay after
you passed that amount,
you have to-
>> We get to the point where I'm
making six figures on a game,
I'm probably pretty happy to pay.
>> Yeah.
>> I think it's fair.
>> Yeah, correct.
>> No danger of that
happening any time soon.
>> Yeah, we don't
charge royalties.
>> Okay.
>> So, if you become
a super millionaire out
of Unity of your game,
you just pay your license-
>> Okay.
>> -and you don't have to
pay us every now and then.
>> Okay.
>> I think it's important.
>> And then the bundle
is the ability to buy
Visual Studio and Unity?
>> Yes.
>> Okay.
>> That's the bundle.
That's what you save.
>> Cool. All right.
So we'll have links to
that in the show notes.
We'll put some links to
some tutorials and
some getting started.
Earlier today, you did
some getting started videos
is really good stuff
on the Unity website,
for how you might get
started doing this.
Like anything, start small.
>> Right.
>> Do something simple and
then learn bit by bit.
But there's a lot of fun and-
>> It is. It is a lot of fun.
>> It can be a nice change
of pace from writing,
the same old desktop
and web apps.
>> Yeah, definitely.
It's a fun world.
>> Cool.
>> Yeah.
>> Thanks for coming
and showing that to us.
>> Thank you very much.
>> All right. Hope enjoyed that,
and we will see you next time
on Visual Studio Toolbox.

Customize the toolbars in Visual Studio

Customizing the toolbars in Visual Studio 
for your workflow and personal preference  
can have a great impact on your productivity. 
Best of all, it takes no time to do.
Now I've been using Visual Studio 
for years, and I know the keyboard  
shortcuts for the most common commands; so 
I don't need them visible on the toolbar.
I start by opening the add and remove buttons menu 
located on the right hand side of all toolbars.  
Now I can start unchecking the 
commands I don't want to be visible.
I use a lot of extensions, so I'd like to add the 
Manage Extensions command so I simply check it.  
Now my toolbar is a lot more my style,  
but I want to add a command that 
wasn't in the menu we just saw.
To do that, I'll click the customize button 
to open the Customize Commands dialog.  
Here, I can easily add any 
command to any toolbar or menu.
I simply navigate around the menu system  
to find the command I want - it's listed in 
alphabetical order and I want the options command.  
I click OK and it's inserted 
into my toolbar - it's that easy.

Customize tool windows and documents

Did you know that Visual Studio has some great 
features for managing documents and tool windows?
Check it out
You can move any tool window 
in Visual Studio by simply by  
grabbing it and dragging it 
to the location you want it.
You can use the UI to make it 
dock to a specific location.
To float a tool window, simply drag it and 
let it go wherever you want it on screen.
To dock it again, hold down the CTRL 
key while double-clicking to move it  
from last known floating location 
to the last known docking location.
And to rearrange tool windows that are docked 
together, simply drag and drop the tabs.
There are many ways you can snap 
and dock too. windows together.
To create a vertical split, you 
can drag and drop tool windows  
on top of each other using the drop 
zones to create a nice, stacked layout.
This is great for certain monitor configurations,  
and it really allows you to get 
the most out of your screen setup.
To split a document, pull down the 
split control in the upper right corner.
You now have to windows you can 
scroll independently and edit in both.
When you're done, grab the divider 
and move it all the way to the top.
To split the tabs themselves, you can 
create a new horizontal document group.
You can drag and drop documents between 
any document groups very easily.
And if you wan to get them all back into one,  
simply right-click and select 
"Move to Previous Document Group".
Instead of splitting horizontally, you 
can also create a vertical document group.
This is really good for wide screen monitors 
and, especially, the ultrawide monitors.
And again, you can drag and drop 
between the document groups.
By holding down the CTRL key,  
you can select multiple documents at the 
same time and drag them all together.
You can even float a document group 
and place it on a secondary monitor  
to really spread out and get the 
most out of your monitor setup.
If you found this video helpful and would 
like to see more of the same type of content  
in the future, make sure to like the video and 
subscribe to the YouTube channel down below.
Happy coding!

Database DevOps with Redgate Data Tools

hi welcome Visual Studio toolbox I'm
your host Robert Greene and joining me
today from bill that the beautiful
Washington State Convention Center is
Steve Jones from red gate thank you and
today special guest co-host mr. Scott
Klein renko's remember we are going to
be talking about data today and
specifically database DevOps yes red
gate provides some database DevOps
tools inside Visual Studio Enterprise so
we're going to talk about those you're
going to do some demos yes but we're
going to start off by explaining this
concept of database DevOps
all right we talked about DevOps all the
time continuous integration continuous
deployment pipelines fast cadence you
know lots of quick releases and we
talked about it from code but apparently
it applies to databases as well no we
don't you know ready to spend a lot of
time in the last five six seven years
evolving our tools to try to support
more rapid database development you know
as much as we've studied the DevOps
movement that continuous delivery stuff
the things that Mountain Martin Fowler
talked about they always leave the
database out because the database is a
challenge the database has to maintain
state from time to time to time right
unlike code where we could just replace
a DLL or an XE in the database I can't
just drop those tables I mean my life
would be easy if I could write life
would be great but you can't just invent
a new engine to dry it out a B testing
did people actually want a person class
in this application well some do some
don't so we'll we'll cut that out it's
easy in code right it's been yeah for
developers but for the database people
it's more difficult and I think that's
led to the hesitation from database
people to move faster but certainly all
the application developers you've got to
move fast you've got to deploy code I've
got to deploy enhancements and then
often means I need a place to store some
of that data so Red Gate is working to
try to get the database to move just as
fast as the application so give us an
example a real-world example of what
that might look like how is it database
changing so here's a great example we
all know security is a big deal right
never seen data breaches every week
we've got all these problems all the
time
there are plenty of customers that are
starting to do things like implement
encryption into their system so I want
to implement always encrypted on to a
database platform so over you know
PayPal whatever ecommerce I'm doing so
I've got to field that story and perhaps
credit card numbers or emails or
something else and I want to implement
that quickly well it takes time it's
difficult to do encryption so one of the
things I might do is I might add a new
column that will support that encryption
so I will do encrypted data there but my
application has to run 24/7 right so
what I do is I build a view on top of
this table that contains the old column
that's still there and I put a case
statement in there some type of switch
that says if I have encrypted data we'll
send that back and the client will deal
with the encryption and always encrypted
but if I haven't got encryption because
one of my applications isn't there let's
send the old column back that isn't
encrypted okay so in a 24/7 environment
I can evolve my database quickly using a
devops process keep it running at the
same time meet the new requirements that
I have for security for anything else
cool so it's not like you're inventing
entirely new tables changing the basic
structure but it's more incremental
changes to support incremental
functionality your needs exactly you
know in the database DBAs have been
hesitant to make changes because I've
been a DBA in my career and we're
responsible for stability and
availability and performance and so we
get nervous about changes not that and
you don't write good code but every once
in a while it's a little freaky so we
get hesitant which means we try to delay
deployments we try to stack things
together get lots of changes right which
increases my risk yeah and it means I've
got to make a bunch of changes at once
and that's the opposite what we want to
do in DevOps right you developers we
want to deploy often I want to be able
to make a new branch write some code do
a pull request have somebody prove it
deploy that next week or deploy that
tomorrow and we want the database to
follow along and so I've done that a lot
of my career and Red Gate has really
spent a lot of time to try to help do
that as well mm-hmm could we back up
just a second because you and I were
asking about this I'm like if DevOps is
understood I think primarily by
developers right right but if I'm a
sequel person you know what is this very
very simple what is
and what does that mean to me for no
good because I really how many how many
sequel people really understand what is
what it means yeah what about
I mean DevOps is kind of amorphous like
the cloud there isn't necessarily this
definite definition what it is it's
adhering to these principles that I
followed for most of my career when I've
done Six Sigma or ISO Tiger software I
want to learn and I want to become
better every time I want to keep my risk
to a minimum and I want to adapt process
around what I do all right a lot of what
we do in DevOps when we do continuous
integration continuous delivery we do
instrumentation telemetry is we're
adding process but we're doing in a very
lightweight non intrusive way so we're
trying to do a database as well so that
you can make your changes you can deploy
them out in smaller increments and have
them work with less risk now there's no
magic right there's no magic to making
database changes all we're doing with
DevOps is we're really automating the
things you would normally do yep in
trying to wrap them in a process so
they're reliable and repeatable because
ultimately we as humans we're not
reliable repeatable we're very creative
we get paid to solve problems and
compose solutions but we have to do the
same thing over and over and over again
okay we're bad and what we're trying to
do with DevOps is try to implement some
process that makes it repeatable and
reliable yeah cool all right yeah we see
some things happen absolutely demo time
demo time so I've got Visual Studio
Enterprise on my machine and in the box
Red Gate is shifting is shipping a ready
roll core product and ready roll is one
way of performing database development
and we built it as a project that's a
first-class project just like the
database projects that are in SSD T and
so when you implement this it's very
similar to that project now ready roll
works in what's called the migrations
based development framework where we
track every changes so if I look over
here I've got all these migration
scripts and each one of these is just a
different set of data scripts that I
would run in development as a developer
database developer or a full-stack
developer I would just kind of make some
of these changes and what ready roll is
doing is kind of tracking them as we go
along and so that when we deploy them we
execute them the same way mm-hmm now
it's just it's it's kind of
philosophically different from SSD T or
some of the other Red Gate products and
that those work in a state based world
where we can
the state of the database the state of
the development at and we come up with
the script yeah right so this is kind of
tracking one by one yeah let's spend a
little bit more time on that because
there are the sequel server database
tools yeah the Redgate tools which ship
in the box because although you do they
don't just install by default but you
can go to the individual components and
get out the work there they are
so talk to us a little bit more about
this state versus migration approach in
the state but I complementary or they
you don't know the other they're kind of
opposite you know Redgate got started
with sequel compare which is a schema
comparison that tool that is very
similar to what's an SSD to and in the
state based world we make a bunch of
changes just like I might do in c-sharp
or Java or something else and then I
take those changes and I compare those
changes with what my production database
looks okay and then I develop a script
kind of in real time a dynamic script so
kind of like with things we would do an
application program it's kind of like
run time versus design time okay so in
the state based world you do that and
that's fine and it works great for so
many people people use read gates to
compare to do that they use SSD to do
that and it's great the problem is
there's a domain of problems that you
can't solve with the state-based
comparison so if I rename something how
do I know I renamed it is it a drop-in
ad or a rename I'd if I add a not know
column there's data manipulation
involved I can't solve that problem so
there's a class of problems that
state-based comparison doesn't solve
right in SSD T people use pre post
scripts to get around them with red gate
OU's will use one called migration
scripts to get around it but it's just
one way of development again in my past
I've worked in Oracle db2 world and a
lot of those larger systems older
systems have worked in migrations world
where they go every script you write
every change you make the database we
track that so when I go to upgrade I run
script one and then two and then three
and then four and then 56 or 57 to 58
and it's a bulletproof way of doing
deployment but it can be cumbersome and
time consuming because the other thing
is if I add a column to a table drop a
comment table add a different column all
three of those things run in production
on my development database with ten rows
data who care
my production database with the billion
Reza data slightly problematic yeah so
neither one is perfect they both have
pros and cons they're just different
ways of working at the world and
throughout my career I've been working a
sequencer for 25 years now what I find
is that people fundamentally fall into
one of two camps either like state-based
like SS PT and sequel compare or they
liked migrations like ready roll or
liquid-based Flyway DB DB up various
frameworks antenna is this a kind of a
thought shift as we you know you've been
talking about database compare you know
schema compare an SSD teen things like
that I is this a shift and how I think
about working with databases now from a
you know because because we have all
these people like yep no schema compare
I know SSD T but now we're you know
ready roll and I'm like how do we get
people you know start thinking down
those I think just philosophically you
decide you I'm going to develop one way
or the other
okay it's kind of like saying you know
do i mix functional programming an
object-oriented I don't I kind of choose
one or the other and I have either some
philosophical leaning or I have some
requirement that says we should go one
way the other in the database world it's
the same thing it's just neither one is
better than the other one they both have
pros and cons they both have workaround
yep and but it is one more of a best
practice type of thing no I mean there's
advantage so one of the things we love
when I've worked in like Oracle
financials with large ERP systems is
that when I do migrations based of LMA I
can take any birds in the database and
upgrade it to any other version because
I have all the scripts obviously all
right so if I have clients at version 2
and version 3 and version 4 I can give
them the same set of scripts and get to
version 5 and that's easy in the SSD tea
world I need custom scripts for every
version right ok so there's pros and
cons the other side is I'm tracking all
these scraps right ok
some developers hate this correct and
some some don't like the state based
thing because they're not confident that
will actually develop all the changes
employed right so it it's not really a
shift it's an option so ready roles are
giving us an option for people that
prefer this it's how we actually think
about things you got actually okay all
right so let me make a couple changes so
we were in Visual Studio ready roll is a
part of Visual Studio it ships in the
box
for enterprise there's various things
you might want to do some people like to
work in Visual Studio so no it doesn't
like that let's see if it'll work this
time
let's forget let's do it this way
because I'm a code guy so I don't mind
writing code so let's create a new table
we'll call it channel 9 and I'm here
with Robert
he's an inn in Scott he's a would make
you a masquerade of Archer yeah but back
to your max all right so I can I have a
reliable type if I can run it very kind
of on a path and you're just fly deeper
yes so you're there I can't anyway I'm
getting from this you know I've got this
I've got this table here that's got a
feeds in it let's add a new feed so it
feeds into one of the things we also
subdivisions to enterprises is single
prompt core which is our intellisense
version and it's pretty good so we'll
add another feed in there and then
because we know some people like to work
in management studio we can always work
in management studio as well so I can
pick up changes here so let's pick
something in my development database
here and let's pick some stored
procedure in here and let's just pick
this one so here's a stored procedure
and here's one of the other things about
sequel code that makes it life difficult
is this code is fundamentally different
from the code I used to build a sore
procedure right because I would actually
have to have a create here to build the
stored procedure but instead I need an
alter mm-hmm right when I build a class
in c-sharp when I say you know public
void class yeah that code always looks
like that I mean yeah right whether I
add or subtract the code fundamentally
the same in here it's different but in
this case let's change something let's
actually do a best practice and we'll
just pick up some of these columns and
rather than the select star we'll do
this and I'll execute this so I've made
a bunch of changes here now so in ready
roll one of the things we do is we've
added a pane here and what this does is
allows me to kind of
for any of the changes that I've made
and once I've done them you'll see it's
detected number of changes and when I
import these it's actually going to add
them to the project and so what we'll
actually get I'll refresh it to make
sure everything is added we've added
some different scripts here so those
migrations are records it's a record of
changes that you have made in the
database that are ultimately going to
need to be propagated or published or
whatever look exactly - so this script
a17 here is my insert right we've added
that in there and my script 16 is that
well either table I think was somewhere
else maybe it's in here stole but I've
added these scripts in here and so they
exist as part of my project they're
under source control so exactly and so
we're trying to do is treat this exactly
like our code so in this case I've
actually just got new code here that
I've added right so I can like anything
else I can add it so added channel them
and I can do what I want to do just like
I might do in Visual Studio is I've got
my board here and visuals media where
I'm tracking work so I can I can use
this pound syntax to actually add commit
and push my changes so part of what
we're trying to do is ready roll is
implement the database just like we did
any other code and actually track this
stuff and I think that's that sort of
answers the question that we asked at
the beginning what does it mean to be
database DevOps is it just as you make
changes to an application in code and
you want to be able to manage those
efficiently you make changes to the
database right I want to treat that the
same ways right so we want to add those
in there and so one of the things I've
also done here is that we're actually
running a build in the background so
I've actually got a Visual Studio agent
running on its machine it's actually
running a build right now so just like
we would do with our c-sharp code or
vb.net code when we submit it in we want
visual studio team services to actually
be running and if I look here I should
see my build just succeeded I think
and I've got all the information in here
that looks at like what I would expect
I've got test coverage running and you
can zoom ibly break the build because
you made database changes that are that
are violating some rule or didn't quite
work out or something right I mean one
of the things we want to do with DevOps
is we're trying to pull all of our code
together and determine very quickly if
we've made a mistake right because
that's a risk issue so here I can pull
this in I can run my build and if I look
at the definition this is just a visual
studio build task there's nothing
special about what this is right
I could I could have this building
c-sharp as well if I was doing it and
then I run tests in this case I'm using
the Microsoft test framework to actually
run tests like a what does the building
test actually do didn't like take those
scripts to a like a sample database and
run those and say yep that's exactly
what the old will actually rerun those
scripts against a temporary database and
determine if they're valid sequel all my
object reference I resolve all the
things like that the test is just a test
like you would run for anything else
right there's the written T sequel but
but I set up a test and I say you know
check this value run this query see if
the results match right and go from
there
and so once I do that I just output an
artifact and just like any other code
I've done that okay in this case I've
actually I'm committing out to a release
process as well so we're doing
continuous delivery so one of the things
that we want to do here and I want to
say my build it succeeded a minute ago
so I should see up here a release to
integration that just ran and so if I
were to actually go back over here and
let's change the integration database
and let's say I've got that feed that we
just added and I didn't change that in
this database or I didn't do anything
else and as a matter of fact let me go
further let's pop over here to QA and
let's look at QA now if that doesn't
exist yet but let's make it exist so
here I have the ability I have these
downstream releases as well and Scott
will let you Scott watch me so I'm not
going to use the keyboard as well all
right we'll put the keyboard away and
the creative release
and I'm going to say release this and so
without using the keyboard at all we're
going to see this database change deploy
to another database right look ma no
hands nothing out of my videos if in a
second this will be run yeah and as a
matter of fact let's come over here
we'll execute this
I think it's deploying right now and we
should see that data changed actually in
here and we would see the other change
as well if we wanted to go through that
right click we're in the process there
it is so here we are in the QA database
right you saw me I didn't touch the
keyboard a topaz at all and we've
deployed this in the same way that we do
all our code and again when I look at
this release definition this looks like
I would deploy a asp.net web app to
Azure or a mobile application anything
else in this case I've got multiple
environments that I'm deploying to I've
got these tasks that I put in here in
these case these are tasks from red
gates that allow you to do that and just
deploy all my code what's the what's the
set up time for if I wanted to set
everything you showed what's the setup
time that would take me to you know
properly set up a DevOps environment
properly so that would benefit yep so to
set up the entire environment
technically from the technical
standpoint we could do it in less than
an hour as a matter of fact I do talks
all the time where we'll take we'll go
from scratch and we'll import a database
into a project and we'll set up C I will
commit it to version control setup CD
and we'll do it the cultural changes are
hard to write because everybody has to
get used to understand so I'll discuss
from the technical standpoint I think
the the other aspect you know the now
getting me to use this process is the
not the hour it's right it's every month
because we don't realize I think
sometimes all the little steps that we
make as humans when we're trying to
deploy code okay and we see this when
I'm trying to deploy to Azure if we take
the sample apps and I deploy asp.net
j''r now I can use yeoman or something
and be done in ten minutes right but in
terms of getting all my code out there
and realizing well I really need to make
sure that I've setup firewalling and
that I'm actually deploying this extra
bit of code that's side to my project
and I've got to config that all those
little
changes are what take time but that's
part of DevOps because we're learning as
we go and so we start to make those
changes right right so where would
somebody go to learn more about database
DevOps so we do a lot of work at Red
Gate I run sequel server central we do
some work there where we're publishing
information and then I'm working on a
course for MS learning right now and
hopefully we'll be done in June on my
travel schedule but at open EDX
Microsoft com
Microsoft is publishing a huge series on
DevOps and AD and all sorts of languages
platforms different things and we hope
in June have a database DevOps course
out there that will give you more
information about how you can work with
state-based with migration based with
open source platforms or sequel server
with whatever you want okay so the the
tooling that ships in Visual Studio
Enterprise is it a trial is it a no it's
a harder version it's a real deal
yeah it's an untimed version what we
have there is a Visual Studio Enterprise
contains ready role core and sequel
prompt core and sequel source 3 red gate
products ok the sequel prompt and the
ready role cores have a few less
features than we have in our full
product and but you can upgrade out
there they're not trials they're full
versions that will allow you to do this
deployment and development you know as
much as you want so can't visual studio
enterprise and then what is sequel
search so sequel search is just a full
search product that lets you go
throughout your database and find
objects in a more intuitive and flexible
way than what ships in management studio
ok all right I'll be honest how many
people know that these products are in
because I had no idea sounds to connect
so if you were paying attention
thanks for calling that out Robert well
it's amazing visuals did you have 2017
that there's all these different
workloads and you don't realize
sometimes that you know if you don't get
that mobile workload you don't get
xamarin in there and if yeah the data
workload you don't get ready roll and
and there's various workloads so you
should definitely look at the visual
studio installer and look at all the
different workloads that route 58 vision
mm 15 and 17 just 17 just say okay
that's dozens that's why because I
haven't looked in 17 yet and 15 okay so
17 only said Isis has changed okay I
feel redeemed now yeah one last thing I
just wanted to talk to you about briefly
one of the things that developers always
want to do is we we want more data we
want to work on real data right because
it helps us do an application and often
if we just use the ten rows of data that
I feel like typing that day yeah I don't
get a good feel for whether my
application works with the data is in
production or its scale or anything else
so red gates been working on a product
that we just released called sequel
clone that allows me to make copies of
full-size databases and use very little
space so if I jump over to my screen
real quick one of the things we'll see
is I've got a production database here
and it's got three hundred Meg's so it's
not big but you know for my laptop
that's decent size but I built these
clones and these are real copies of that
300 Meg but each one is only using 48
megabytes of disk space and that 48
megabytes is fairly constant even if
this was a terabyte database yeah and
and I have the ability to quickly create
a clone so on this machine I can create
a clone and I'll say we'll call this
Scott because Scott's my friend and I'm
going to create that 300 megabyte mark
here in an eye out five six seven
seconds I've got a copy database and if
I look it over here in my management
studio we've got the Scott database how
big how big was it 40 Meg's so I've got
all my rows actually let's take that top
out of there I try not to break things
too often but so I've got thousand rows
in here yeah and if we look at this
Scott it is a full-blown database full
database so if I look at the properties
database this says it's 270 Meg and 60
Meg okay but on disk this has only taken
48 Meg of space Wow Wow
so I could we can do right now at the
two terabytes because we're using VHD
files but very soon we'll have up to the
64 terabytes VHDX files but we can make
copies of those databases with you know
roughly 50 70 Meg on your laptop and
allow you to get access to that full
size database and then what are you
impressing that how you getting there
know is that the secret sauce you can't
there's definitely a secret sauce it's a
little bit magic and unicorn dust on
there but really what we do is we take a
point in time snapshot of our database
and then we have a central copy of that
and we're all reading from ok and so
it's a similar data virtualization
technology company - ok but Redgate has
brought it to the sequel server platform
at a very low cost and it allows you to
give every developer copies of the real
database and if I don't like this
database I can delete it in seconds and
I can create a new one now if I've
updated the data and I want to do
something else I can do a new one in
about where we say 7 seconds and we'll
call this one Robert and I'll build
another database on seconds and then I
can just go ahead and work with that and
be ready to go that is very cool cool
well thanks so much for coming on thank
you very much for having me so we've
seen a good overview of what I need a
base DevOps is I've learned a lot this
tool that you can that shipping
Enterprise go to go back into the
Installer and go into the individual
components tab and find them there there
they are playing around with it and
learn yeah that's your homework
assignment everybody yeah give it a try
yep thanks hope you enjoyed that and we
will see you next time on visual studio
toolbox

Database DevOps with Redgate ReadyRoll

hi welcome Visual Studio toolbox I'm
your host Robert Greene and joining me
today is Steve Jones from red gate hi
Steve is here to talk about database
DevOps that's right and we we chatted it
build I we did a show it build and we
covered some of this stuff then but
we're gonna do it in a bit of a more
deep dive and get a little bit more into
the meat behind it okay ah right yeah
absolutely
so we're gonna talk about two things
we're gonna talk about two different
ways of doing the database DevOps first
that we're going to cover today is
migrations and then the second one is
database compare right data compare have
you ever done migrations when you've
developed yes yep do you like migrations
do I like migrations it's a to doing
stuff gets done so I like I like stuff
that works but I don't have a passion
one way or another for it let's go that
way yeah I find a lot of people don't
either do it don't like migrations I
I've done a lot of migrations more in
the Oracle and db2 world where you know
large ERP systems often just track all
the scripts there hundreds of developers
right and then we run them all in order
and it always works but it can be really
slow sometimes okay so some people don't
like migrations but I prefer it you know
and I work for regular software we we
support both ways of doing database
development well so whatever works for
you that's fine and maybe you'll pick
one or the other after this but at least
I'll learn how they both work right the
exact wording it said at the end of
these two parts all right all right
migrations first so migrations first
let's back up a step okay we dive in
what are we doing so I'm a database
person I've been a sequel server a
person for most of my career I've
actually been working sequel server for
26 years now so more than half my life
has been spent working with databases
right so it's kind of amazing that
throughout that time I've developed
software in a number of different ways
as a DBA and developer and so I've tried
to work through these different ways of
efficiently getting database changes to
action making sure that I'm not
interrupting an application I'm not
causing downtime unnecessarily
certainly I'm not causing any data
integrity issues or losing anything
along the way right so you know you make
code changes all the time but you're
saying that how often do people make
database changes not as much as code
changes obviously not as much as code
changes right the database because we
have to maintain that state of our data
mmm like unlike an application right I
can drop a class I can add a method I
can make these changes and I kind of
just replace different versions of right
maxi's dll's assemblies resources
whatever it is I can do that with some
of my code in the database world my
views my procedures things like that but
my tables I have to keep around so I'm
always kind of evolving them okay and
because I have to do that especially as
my database grows larger I want to be
careful how often I make those changes
okay renaming a table is disruptive
because unlike renaming something in
Visual Studio the compiler can find all
the references or the IDE can find all
the references and do that for database
I am xions coming from various
places and I don't know what's happening
right so I think it depends on a lot of
times the maturity of your application
if you're starting out you may make more
database changes than later yeah right
okay as I grow I get a lot of technical
debt kind of in my database world
because of all those connections to
other applications reports ETL systems
all right so I'm hesitant to make this
changes okay now there are people that
do a lot of additive changes where they
just add things to the tables they add
systems to the objects to the database
so that they don't hopefully don't
disrupt those applications all right and
they can continue to add features and
functionality throughout the lifetime of
their application ok so one of the
things that you know I've been doing
really for most of my life is a lot of
things we call DevOps when I trying to
have lightweight processes that work
that helped me make changes in an
efficient manner without causing
problems and at last 3 or 4 years all of
a sudden we have a name we call it
Devil's we DevOps all the things now I
think that's Donovan Brown might say
yeah so so maybe I show you some things
here I work for red gate software and we
have ready role as included in Visual
Studio Enterprise yeah so that's part of
what's there and I have a little ready
role toolbar here that comes up and
that's a pain in Visual Studio and my
project in ready role is just like any
other project so if I were to create a
new project here and since we don't want
to run through everything ready role
appears just like my database project
would for SSD T or for a c-sharp or any
other type of application we have in
Visual Studio in this case the ready
role project builds off of a database
project which is slow to come up but you
can see that there's database projects
like we would do and for SSD teeth for
Daniel's or I've got ready role projects
here and the difference is the database
project works as tracking all the
changes and then it does a comparison
with sequel package and you'll deploy
those changes mm-hmm I kind of package
everything I'm a backpack and ready roll
we have what we call migrations
so in this existing projects I've made a
bunch of changes over time you can see
I've got all these scripts and each one
of these is just a change that I made to
my database as I was performing
development so in this case I'm altering
the table obviously I can't you wrote
the scripts and then saved them in the
project right yep I actually have a
couple ways of doing it I can import
those changes if I've made this in
management studio or another developer
made changes so I can
ensure that I'm capturing all the
changes or I could write the script
directly okay so ready roll what it does
is it takes the burden off of you of
trying to manually grab every script
make sure you've caught all the changes
giving it a name saving it off right
okay so I can do that so over time I
just collect these different changes
that could be DDL changes they could be
DML changes there's just a series of
things that I'm doing to my database I'm
creating objects I'm altering objects
whatever is appropriate for my
application so in this case this is a
common pattern that in the SSD T world
or in a state-based comparison world is
difficult to handle I've got to add a
notnot column I'm gonna I've got data in
my table right so I can't add it not no
column right I have to add a no column
update some data and then add a not null
right
so that's a complex change they still
haven't changed that that way forever
right yeah I mean there are ways around
there I could add a default I could do
some things but for a lot of systems
I've worked with a lot of developers
this is a problematic item because I
don't want to default value what I need
to do is populate that appropriately
with some value that matters for that
room okay so ready roll makes these
types of changes much more robust and
resilient so where's the migration ID
come from there so let me show you how
this is done will create a migration
script now so if I want to create a new
script I could certainly just right
click and add like anything else mm-hmm
I could certainly add a stored procedure
or a table or anything that I want to do
so when I do my development is the
migration ID that gets created when you
create the script that gets created a
great degree okay so it gives me a
unique way of identifying this script
and tracking whether it's been deployed
in the environment okay no so we do that
so let me create a little procedure here
that I want to do and I'll just give me
something that I can run okay and I can
certainly run this if I want I have a
variety of options like I would in any
other database development that I'm
doing that I can just mark my code run
it test it to everything that need to do
here yep this has been executed on a
local instance it actually exists there
so I can run any my application against
it I have all the ability to do the work
that I do normally as a database
developer mm-hm and then you know
periodically what I want to do is I want
to make sure that I've deployed
everything in my project so I can click
here and it'll do a build in Visual
Studio like anything else so I know that
popped quickly up there but I actually
have conflict and something failed
already an object name get 10 yeah yeah
okay cool so it thinks it's still there
I don't think that's the case let's just
check I'm more comfortable you gonna
believe Who am I gonna believe it does
exist
I think cuz I ran it and then I said it
was deployed let's deploy it again into
a build because I'm a developer I'm
human I make mistakes right things
happen as I'm going let's see it
deployed it succeeded everything
at all so I can kind of see what's going
on in my project as I'm performing
development because I have the code in
scripts I could certainly check the
database against this
I've got everything like I would
normally have this migration ID is is
how the framework will actually check if
this script has been run okay so inside
of my database we actually track that so
if I pop over here and let's just check
it from here there's migration log and
we can see here that this contains all
of the migrations that have been run so
there's this good that we have there's a
checksum make sure that the script I
think Iran is the correct script right I
haven't edited or changed it and I have
the file name and then various other
metadata that lets me know what's going
on so this ensures that my scripts in
essence will only run once so I can't do
something like add data in a script and
then worry about it being added again
right duplicate data recreating tables
that kind of thing so so far as I go
through database development it's
similar to what I might do in c-sharp or
any other language right right that I'm
just kind of working with my project and
make your changes and like any other
change this kind of appears as part of
my team Explorer right I've hooked up to
version control which is one of those
things that I find so many database
developers don't do right they don't
track their DDF right you've deployed
this to the database already my
development database all right so I'm
working with an in development database
and I've got this change out there
mm-hmm
okay and I and I can certainly make
other changes and let me show you
something else cuz do you find there's a
lot of developers that like to work in
managed studio still because it's a
comfortable way of working and it's
quick so let me add a piece of data here
to this table and if I look at what's in
here I've got some data in there so I
just add in row number five so one of
the things ready roll also allows to do
is track reference data or static data
that I might want to include as I deploy
this further mm-hmm so here's here's a
value that I want to include well once
I've done that and ready roll what I
want appear like to do is check if I as
anybody made any changes
Visual Studio certainly I could have
just done run a query on Visual Studio
as well that did that same insert we can
see here that I've actually detected
there's a data change here and in fact
this one row that was inserted so I can
add this as another script and this will
come in as another migration script
this is script 32 it's got a different
migration ID which you'll have to trust
me that's the case we won't compare the
height but Randy Rahal has built me an
insert statement it could build me an
update statement it could build me a
delete statement whatever would be
appropriate here and again that's here
inside of the change team explorers
whoo-hoo so all of this is my local
development as the database developer my
laptop my workstation I'm doing my thing
right so are you committing this to
version control as a way of keeping
track of the history because these you
changed the database right it's a little
bit different than writing code it's a
little bit isn't it it's a little
different right because certainly
anything I do to a table or to data has
to is kind of this evolutionary change
of thing that I'm moving from one state
to the next constantly I'm tracking it
in version control a because I make
mistakes sometimes I have to go
backwards okay just the way the world
sometimes I will misinterpret
requirement the business person will
tell me the wrong requirement and we
will write code and realize it doesn't
work we can roll back the database
changes well we can certainly find out
what we changed I can go back I can
certainly go to version control and grab
those changes
rolling back database changes is not
always easy yeah cause it's not like the
data's in source control the history the
data it's not go back to a snapshot
right now for stored procedures and
functions of use I can just grab that
previous cousin right cuz those are just
code those are just yes okay for tables
I haven't come across a tool yet Norway
I think would I trust my job to a tool
to roll back my date right change
exactly right because if that if there's
been data added to the table I need to
decide what to do with that day
right if I've dropped a column which is
a very dangerous thing I need to have
prepared for that advance because
nothing is rolling bringing me that
table change back right right okay so
those are different but as much as
possible I'm trying to treat all my
database code like application code mhm
okay and part of this is that I want to
use this code to move forward to do CI
and do CDJ like I would do with an
application okay so let me commit this
you'll see this out there actually
before I commit this let's just go look
I've got a project out here in visual
studio team services which i think is
fantastic by the way
mm-hm I think you're right it is this is
maybe the best developer tool I've seen
Microsoft ever build
now the visual studio team service is
just amazing really is and I use it all
the time so I've got you know a board
like I would have for anything else and
I can track all my database work yeah
and I've got my codes here as well and
I've got my project so I've got my main
database project my test project because
I want to test things you know in
various items and if I flipped down in
here and look at my migrations and my
last change was this morning right a
little while ago we were checking things
out let's go ahead and commit this
change so we'll say channel 9 Robert
I'll call it one let's commit and push
that so once I do that this will
actually push up into the Microsoft the
first time I looked closely at that
drop-down and saw that commit and push
you could do all the ones instead of
committing and then going and finding
push this that might be like the one
thing I wish existed instead of a
drop-down it would just give me the
option to remember that would that be
even better right yeah but if I let's
refresh this so that I see what's out
there
I should see we just pushed out two
changes okay so it tracked to new
scripts yep and now I have a history of
what's going on because in a migrations
world I'm tracking all these scripts
over time so that's an interesting best
practice you've got two changes in one
comment so given that you're all the
rest of your comments are pretty
descript
give would you then typically just
commit one script at a time it depends
on the work that I'm doing at that you
know III that's kind of a devil of a
developer philosophical question right
do I include multiple changes into one
commit mm-hmm I would have that option
just like I do with anything in Visual
Studio I could pair and choose what
commits in this case if I was if that
data change was associated with the
stored procedure change I would probably
commit them together with the work item
in a better description of Christ right
not a great comment but if they were
separate items as is the case sometimes
in database world mm-hmm I would make
two separate commits okay and and that's
one that's one of those things that
comes along with you being a developer
learning how to commit in batches or
singly as appropriate yeah that takes
your experience there okay so we can
make our changes here and commit them
but we want to go farther right because
this is a great safety net in version
control but it's not helping me build
software faster mm-hmm it's not help me
build software better right so I want to
make sure that I'm actually building
things as well and the build system
visual studio team services fantastic as
well I mean I've watched people build
all kinds of stuff here mmm that from
from Java to Python to c-sharp to
database everything right it's just
amazing and we can see here we've
actually just built a new building so
when you created that build was there a
built-in template that you got to select
or did you have to build it from scratch
I actually built it from scratch now
those of you haven't used Visual Studio
Team Services give it a try
but it's a very simple project yeah just
like you would do for c-sharp I'm doing
a visual studio build and this is just
the standard Visual Studio build tasks
so okay so you named that my name right
so I can I can change the name right and
right here in the display okay this is
the standard Visual Studio build task
okay so if there were if I was doing
c-sharp in the same solution right let's
not restart now that's not to go
so if I were doing a c-sharp project in
the same solution I could build it here
I could have two Visual Studio builds
this intended each project separately
whatever is appropriate for my system
but you know I'm doing the same solution
build you know I've specified the name
I've got the MS build arguments just
like I would normally have okay
ready roll wants to build against
another database a target database where
I'm going to deploy to so I give it a
parameter station where am I going to
deploy so here's a question so when you
wrote the script you deployed it so you
already changed the database correct now
you've got a continuous integration
build what is that doing so what it's
doing is is going through and
re-evaluating the entire script to make
sure that everything's correct it's
looking against a downstream environment
that I would want to send it to you to
evaluate which of these changes maybe
you just changed the like a development
database yes confirm that it all works
and now you're using the CI process to
update the production database or
further downstream database I'm doing a
downstream data so I never I always like
to work in multiple environments in
these days with containers of
virtualization and VMs I always try to
have at least three environments if not
more so in this case I've actually got
five so one of the things I want to do
is I'll make my changes but you want to
be able to see my changes right or we
want to see all of our code together
just like we would in a c-sharp project
and web app so in this build what I'm
actually doing is I'm building and I'm
running my tests mm-hmm so I'm seeing
I've got the Microsoft unit testing
project as part of this so I'm running
tests in there against my database so
i'm doing sequel server unit test and
I'm doing my artifacts and if I pop back
to the summary of what's going on and
we'll look at that there were actually
results of that build that just ran and
we'll find it you know it took a few
seconds my test ran successfully I could
see you know the commits that are going
against it any warnings anything that
I've got going on in this case because
it looked at that next environment over
here on the right I see which
migrations weren't applied to my next
database yeah okay so that gives me an
integration place and in a matter of
fact you can see that there it knows
which stored procedure was changed there
right so it's kind of read through some
of the metadata I could see what's going
on and as a further step out of this
build I'm actually trigger to release as
well and where do you specify what
database it's going to is that part of
the build definition that is part of the
build definition so when I pop over here
that is a parameter visual studio like I
would add any other parameter and you'll
see here that I've said this build
integration database that's where I'm
gonna talk I next got it so that's
giving me kind of intermediate
environment nicely and if I pop over to
my visual studio let's sorry my
management studio let's grab this query
right here let's copy this and this is
my integration database okay okay so we
didn't touch this database you know I've
got a different coloring on it but my
row number five has been added
and my stored procedure here should run
cool right so cool right now as I've
done the process that I would normally
do a c-sharp and that I take my code
like everybody else's code put it
together generate an artifact and we can
then see if that is what we actually
want so you your continuous integration
there is actually a deployment as well
it is to another environment because in
the database world I I kind of need a
place to go look at that right so I've
actually moved this from one environment
to the neck so let me zoom in slightly
here I started right here in this
development area so this is where I made
the change and this is environment two
right here we just sent that change
okay and what I want to do then is of
course I've got QA yeah I've got this
staging and I've got production as well
okay so I want to kind of make sure my
code flows obviously testing at each
point in time run an application against
it having other developers QA people etc
look at what's going on right leading
businesspeople
I want to make sure that my code is
being deployed so let me grab let's
grab all this code real quick and let me
just look at my Qi environment all right
so if I run this now that stored
procedure doesn't exist
yep right neither does that Rover
because your bill definition only sent
it to the first database yeah my build
definition then actually kicked off this
release process as part of continuous
delivery so this release process says
once I built if I built successfully
mm-hmm and if I passed my tests whatever
is appropriate for myself what I'm going
to do is I'm going to do supply this
package out to a database and in this
case I'm sending it to my integration
environment oh so the build doesn't
actually do the deploying no no in this
case oh okay let me pop to the older
this new editors gotten slightly odd for
me but when I look at this build process
I'm sorry this release process this is
set as the option where they moved go
back to the first here click on one
phase one task that's where it is yeah
yeah so here I'm actually having this
kick off as per once the build a
successful okay it triggers this release
okay yeah so just like I want to do is I
want to have kind of an organized
process that makes sense
mm-hmm outside of the path in and the
parameters we could set this up in a
couple of minutes okay we would have to
go through the path you make sure we
haven't made anything incorrect there
but I have the ability to do that but
I've also got other release processes in
place in this case I've got a downstream
process as well which will push it to
those other environments okay so I have
the ability to make releases in a
consistent reliable fashion in a way
that as a DBA various times my career
have struggled with because as somebody
sends me a script I have to look at it
have to hope all the objects are
included mm-hmm
I have to hope that I've actually
remembered to correct connect to the
correct server right send it down there
right all the minutiae that just slows
down development right it just becomes
complexity just like deploying an
asp.net website or c-sharp too thick
client you know there I have to make
sure I go through all the process
correctly I have to remember that I need
to copy to these folders to these
servers mm-hmm right those things are
just they're kind of tedious things that
we don't want in general to do so having
this stuff happen automatically in a
lightweight process like visual studio
team services makes it really easy to
move this changes forward yep and see
what works and so this release is
created it's probably run by now because
usually they run fairly quickly and if I
come back over here and let's rerun this
code actually works this nice I've moved
it to QA yeah we could certainly repeat
that a forward to the other environments
as well right so cool trying to build
some of that DevOps process in here's
that I I make the process a definition
that is always handled in the same way
so we execute the same manner and then
if I find issues or if they find new
requirements I can slowly modify that
but I'm not dependent on a human to do
right and it gives you the ability to
not necessarily be the only one making
changes to the database just like in
coding you're not the only one coding
right right but things about the
continuous integration is I make changes
on my machine I run my tests everything
works you make changes on your machine
run your tests everything works marry
the code together the stuff doesn't work
anymore exactly right the CI will do
that I check in my code you check in
your code all the unit tests run we're
told immediately you can apply the same
process here I make changes the database
works on my machine you make changes
works on your machine and then you marry
them together and it all then goes
downstream and hopefully works right but
if hold of course and if it doesn't then
in process breaks but we now you know
why right so I've got a cool visual
studio team services gives me all
instrumentation to say what was deploy
what's included
so I don't have to dig through the
entire database I know in this case
there's two files that broke so if my
code doesn't work with your code yeah we
know which files I committed to go look
at and this isn't that hard to learn how
to do it's pretty easy to set up it is
pretty easy to set up yeah even even if
the UI changes it is I mean visual
studio team service I was amazed how
easy it is to actually do a build after
working in something like Jenkins which
works great but it's not the easiest
thing we work with yeah so visual stereo
team services and all the extensions
have made this a smooth process very
cool all right all right we learned
something you like migrations and
database development now I love it yeah
right well I love the fact that that you
can that DevOps and see ICD continuous
integration continuous deployment
pipelines are for databases too it's not
just for code right and you can just as
easily set one up for your database
stuff as you can for your code I love
that yeah yeah and I think that's one of
those things that will really help
improve the quality of our database
applications yeah oh absolutely cool so
that's part 1 part 1 part 2 part 2 we'll
do this again but we'll do it
innocent in a comparison method where
we're not going to try to track every
change right figure it out later
okay cool we'll see you next time on
visual studio toolbox
[Music]