Managing your schema

Video in TIB AV-Portal: Managing your schema

Formal Metadata

Managing your schema
Using migrations for consistency, repeatability, and sanity
Title of Series
Number of Parts
CC Attribution - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license.
Release Date
Production Place
Ottawa, Canada

Content Metadata

Subject Area
Keeping track of changes in your database schema can be challenging. In this talk I will discuss the advantages of using Flyway to effectively manage this issue. Migrations are an essential tool for both developers and administrators. Developers can quickly recreate a database from scratch and incrementally modify their development database along with their code and tests. Similarly, administrators can determine the current state of any database and easily migrate to a newer one. Most importantly, schema and data changes can be thoroughly reviewed and tested before going to production. In this talk, I will discuss the benefits of using Flyway to manage migrations. Specifically, I will: - Show why migrations are useful - Introduce Flyway and how to use it - Focus on using Flyway from the command line using migrations written in sql - Help you determine which changes should be in your migrations - Discuss how to create a base migration from your existing database - Cover strategies for dealing with global objects - Show how to integrate Flyway with Jenkins

Related Material

Area Slide rule Scheduling (computing) Logical constant Software engineering Information Consistency Software developer Software developer Equaliser (mathematics) Mereology Mereology Human migration Website Quicksort Remote procedure call
Workstation <Musikinstrument> Computer animation Software Multiplication sign Universe (mathematics) File archiver Website Database Information Table (information) Resultant
Building State of matter INTEGRAL Java applet Multiplication sign View (database) Execution unit Price index Run-time system Mathematics Type theory Different (Kate Ryan album) Synchronization Cuboid Endliche Modelltheorie Data conversion Physical system Metropolitan area network Cross-platform Software developer Stress (mechanics) Sound effect Bit Open set Type theory Process (computing) Order (biology) System programming Software testing Quicksort Physical system Row (database) Laptop Point (geometry) Server (computing) Table (information) Link (knot theory) Open source Observational study Software developer Line (geometry) Disintegration Control flow Continuous integration Product (business) Revision control Internetworking Software Software testing Computing platform Operations research Standard deviation Interface (computing) Expression State of matter Java applet Code Database Directory service SQL Server Human migration Subject indexing Word Inversion (music) Computer animation Software Revision control Table (information) Window Oracle Library (computing)
Computer file Java applet Line (geometry) Directory service Parameter (computer programming) Run-time system Replication (computing) Computer programming Number Product (business) Set (mathematics) Gastropod shell Scripting language Area Metropolitan area network Default (computer science) Sine Java applet Parameter (computer programming) Bit Database Connected space Uniform resource locator Process (computing) Computer animation Configuration space Window Local ring Library (computing)
Meta element Ferry Corsten Interior (topology) State of matter Equaliser (mathematics) Multiplication sign Water vapor Function (mathematics) Mereology Formal language Neuroinformatik Medical imaging Order (biology) Mathematics Radio-frequency identification Set (mathematics) Error message Descriptive statistics Area Metropolitan area network File format Computer file Rollback (data management) Stress (mechanics) Electronic mailing list Database transaction Mereology Port scanner Control flow Process (computing) Raster graphics Telecommunication Order (biology) Right angle Moving average Quicksort Spacetime Row (database) Point (geometry) Slide rule Trail Server (computing) Regulärer Ausdruck <Textverarbeitung> Service (economics) Table (information) Sequel Computer file Distance Value-added network Power (physics) Number Element (mathematics) Product (business) Revision control Flow separation Subject indexing Data structure Data type Default (computer science) Multiplication Java applet Database Division (mathematics) Directory service Density of states Human migration Word Computer animation Personal digital assistant Revision control Table (information) Integer
Server (computing) Table (information) Computer file State of matter Content (media) Water vapor Metadata Product (business) Revision control Human migration Mathematics Type theory Computer animation Personal digital assistant Universe (mathematics) Revision control Reduction of order Software testing Table (information) Descriptive statistics
Overhead (computing) Table (information) Computer file Sequel Multiplication sign Source code Bit rate Parameter (computer programming) Neuroinformatik Revision control Programmschleife Information Data conversion Descriptive statistics Metropolitan area network Serial port Information Information systems Software developer System administrator State of matter Database Directory service Human migration Computer animation Personal digital assistant Password Revision control Software testing Data Encryption Standard Quicksort Table (information)
Point (geometry) Table (information) Computer file Code Numbering scheme Bit rate Product (business) Revision control Internetworking Cuboid Software testing Information Data conversion Identity management Form (programming) Metropolitan area network Serial port Information Software developer System administrator State of matter Database transaction Human migration Subject indexing Computer animation Personal digital assistant Revision control Aerodynamics Software testing Right angle Quicksort Table (information)
Group action Randomization Multiplication sign Numbering scheme Set (mathematics) Bit rate Mereology Food energy Subset Coefficient of determination Type theory Hypermedia Damping Information Extension (kinesiology) Scripting language Metropolitan area network Theory of relativity Information systems Repetition Software developer Structural load System administrator Stress (mechanics) Drop (liquid) Special unitary group Bit Type theory Data management Process (computing) Order (biology) output Self-organization Right angle Quicksort Point (geometry) Table (information) Sequel Real number Similarity (geometry) Electronic mailing list Drop (liquid) Metadata Smith chart Value-added network 2 (number) Product (business) Revision control Flow separation Natural number Operator (mathematics) String (computer science) Reduction of order Gastropod shell Software testing Traffic reporting Task (computing) Mobile Web Default (computer science) Addition Dot product Information State of matter Database Cartesian coordinate system System call Human migration Word Computer animation Personal digital assistant Revision control Free variables and bound variables Data Encryption Standard Iteration Bus (computing) Object (grammar) Table (information) Reference data Window
Scheduling (computing) Building Direction (geometry) Mathematical singularity Source code 1 (number) Arm Order of magnitude Mathematics Different (Kate Ryan album) Metropolitan area network Computer icon Drop (liquid) Bit Control flow Order (biology) Software testing Right angle Summierbarkeit Quicksort Cycle (graph theory) Point (geometry) Server (computing) Functional (mathematics) Disintegration Gene cluster Continuous integration Rule of inference Field (computer science) Value-added network Number Revision control Subject indexing Representation (politics) Software testing Loop (music) Data type Information Content (media) Code Database Density of states Cartesian coordinate system Human migration Mathematics Computer animation Password Revision control Video game Iteration Table (information)
Complex (psychology) Existential quantification Computer file State of matter Code Multiplication sign Real number Disintegration Bit rate Mereology Food energy Event horizon Product (business) Revision control Mathematics Reduction of order Energy level Software testing Scripting language Projective plane State of matter Electronic mailing list Database Directory service Cartesian coordinate system Flow separation System call Human migration Performance appraisal Word Uniform resource locator Arithmetic mean Radius Process (computing) Computer animation Software Software testing Right angle Cycle (graph theory) Object (grammar) Writing Directed graph
this thing is started people triclinic next few minutes so I for satisfying to you it's what's your Iran high you would use migration before if you look at the very you wanted to appear at top me who wanted to have an area slightly for no nothing so clustered reason something more than 1 answer I have the of current migrations before I get half issues so let's get going OK I so I might injuries method at the site is about managing your skin care regimen here again and that's to talk about using migrations about me and I don't see a software engineer and sort of about equal parts developer DDA although my title and my boasts a software engineer so because some of those 51 % software engineer on my back exon Geoscience travel around the world but instruments and in remote places in an intuitive and stuff like that now I work from home and don't get out too much anymore and the migration from 7 years of my contact information making the slides will be up on the on the schedule in itself like iterative and and
I work for a company called you know which is it's mostly funded by the National Science Foundation announced nonprofits consortia of of mostly universities and some institutions and our goal is to facilitate geoscience research in research and education so as a result of what it what it would basically means that we don't really do a lot of research ourselves and we use facility of other people doing research and geosciences and 1 way we do that is by installing and maintaining an archived data for on large networks of of the geodetic instruments this gives a high precision GPS monument that we have have a couple thousand of these around the west coast in Alaska and
we use postgraduate 10 years and we store all kinds of stuff lots of lots of times entices data in there and then just more stuff about the answer as we know it a lot of detail about where instrument all are and so on what what exactly that site and stuff like that you our primary databases about 500 tables operating which so lots more than on people have put public begins on a lot of tables probably probably what what it was and we were used to this graphic is just from RGB high precision GPS instruments which get petition about the lesson sub-millimeter precision and you can figure out the complete tectonic motion it's 1 of the things we we we do have a small requirement things figuring out place moving around this is held to the west coast of the US is moving around the so will outline my talk
today 1st while she's migrations and then a bit of introduction to fly away in particular which is a particular migration tool and then how to use it and then so this wording effect migrations at this time at the end I like to tightly integrate with Jenkins which is that of automatic build tool so 1st a little other the problem so this is sort of a typical of scenario it in of implicit also software you have your developers of those 3 guys and they each have their own development data is probably on their laptop were you know he want other box that which is probably a scaled-down version which production what mental state or something like that they're they're all developing software might be developing the same thing may be developing something different but the soft in order to implement the software only to make changes to their their database and somehow those changes need to get into the continuous integration do this and to test database and then into the production this is eventually and up is also the problem of the hotfixes interests so you have deviated size over some problems in the production in ways that we need fix and so how does that affect trickle back up the system back into the development boxes so I we keep the databases in sync with each other you even if we're talking about we we also talk about the same database but we are well on our development version had test version and things like that I'm highly synchronizer software releases with these various changes and and how we figure out what changes have been applied to each of these different databases you know we need to figure out that if it has a hot fixed been applied to a local development and this is something that I'm and then another sort of really point is how do we create a new development or testing and again you develop onboard here she needs a laptop itching into the box with with the with the database on I they feel free ask questions whenever the stuff is sort of so that the free expression so I I think a good answer to this is migrations which is simply version changes to the schema of so every change of wooden houses as in particular version that would have a really simple thing here is a version 1 of the database you might want to get a version 1 you create a table called users inversion to you would alter that table somehow 3 grand index on version for the green on the table 2 so each of these changes has a particular version associated with that what that
does that burgeoning gives you a simple things it gives you that version will be stored somewhere in the database of migration tools that somehow out and you can see the current version only consider conversion you know exactly which what's been applied to a database of and it also gives you a clear upgrade path forward from so if your furniture database you know that we how get a version for a few version 2 units have been added to version 3 or version for the migration there are simply a little bit to code that should be kept in version control and when you can keep your your your database changes inversion growth control if you cool things you can go back and you can figure out of blame breaks or you can add up you can easily share your changes the other developers and the standard in the deviates and also gives you of integration with the building and the testing tools so you check something and you can have build tools automatically build stuff for you as so the particular on migration tool that I like my view study of migration tools for about 7 years and 1st we sort of all around the and there there are a few other so there is really has 1 that's really popular things go Active Record migrations with that a Siegel alchemy with has 1 2 3 0 known as something to Africa but I I happen like fly nor these tools are fairly simple overall but that the concept isn't isn't isn't groundbreaking but it's it's a very useful tools and to find of documentation tool it's open source it's about 5 years old now but this cross-platform little work on the windows maximum x and stuff like that but it's written in Java but you don't need to know we don't need to know job at all to use it you can use job if you want to so it has a bunch of different interfaces to this tool on the command line 1 which is the 1 I'll talk about mostly here but I simply just type on the command line and Dutch Immigration for you and there's little tools does but it can also put into a Java API or if you're building already with something like great made and you can now you can interface straight that so that your builders sort all altogether if you're if you're using those tools and support for stress and a bunch of other databases to enlist them all there with pretty much all the popular databases so will support as so the command line profiling and this is for users who don't use a GBM model when use the filter also agreed on the internet but it can it can come with chairing the Java runtime environment income with that for you can use the system job is that 1 is bundled with the Jerries nice but if you're on 1 platform you can check the holdings version and just use that if you if you not like I know my development boxes American then I take no Linux server them and build on link server side is checking the flowers of user-system is at that particular about stuff that comes with all the libraries it needs to run so is check and that the the butterfly with stuff there and this link to break new from 1 again this is the basic directory
structure of of the following is not too complicated but basically there's the live folder which assesses the job libraries over the replicant and configuration which has a configuration file and going to that of a bit more the drivers a comes with JDBC drivers for a number of databases including resource and then you put your migrations news jars and sickle folderol quantity 1 of the areas there if you download the Java runtime environment and then use the natural executables following up command for Windows workers filing for everything else it's just a shell script which calls that the the job of it call the java program that in there somewhere so
flyway itself is very configurable but it has really good default so in practice you don't need to configure too much on the main thing you need to configure is the connection brandishing to give it the the JDBC URL and as examples inside the configuration file to help you figure that out so you know really JDBC going to such lush and then the path the hostname things in the database and you can set all the all the configuration parameters and both the configuration file or or the command line everything so the command line will overriding things that the configuration that's useful if if I say that the amount number ways to do this but if you want to just leave it as local host and you're configuration file you can you can dominant migrations there has been no cost and for production you could just over in are in the command line parameters you could change it to connect to production and that so that actually create
migrations and fly away and it's really really simple they stay as 1 file format per migration the migrations can be is plain sequel just a file with a sequel on from Oregon writer John immigration and then the job migration 74 if you really reinstated changes something that we really hard to calculate and sequel somebody's accommodation for everything else in practice I 7 years and never on 5 years and 7 using far away and never used the job and migration and and the 2 of and there is no special images Rex and all those other migration tools require those acquired sort of I'm emphasize the role of language for for uh for doing for creating tables and things like that and 1 is tagged with Ruby on Rails which has its own special thing there was packages sequel alchemy which has its own way of creating tables and things like that so this is just for people is 1 right points equal distance just plain files in order to get
fired understand which works how that water your migrations you need to the way does it is through the file name basically and you can you name the file element in a special way to do this so that the start of the V 4 4 version and then there's some number of numbers of them and then the which makes the versions in this case is version 0 0 2 . 0 0 that so you can you can break up the version into multiple parts of many parts as you want to there to other stories that ensures there's the between 0 and that the word fix every after that is the description of that migration and you can but you do underscores the between word it into spaces are like in this course of then the the suffix which by fault single so this that that self-adapt you wouldn't do it so little all parts that version number at the beginning and you can have version 0 0 2 . 0 0 0 0 0 2 . 2 0 1 0 and so on and so my recommendation for versioning by the computers made 0 0 0 1 and the examples of a you other fly documentation they put a 0 the beginning at the bottom 0 service when you're looking at the directory of of migration so the the sort of more than what's going on the order of merit to break it up but I'm still minor versions and that to so it helps you break apart large migrations were just adds more things that excessive the background a flight any questions so far that people so the so the question is so you have multiple people from checking stuff and then I'll check in the same version of the question that serve that bacteria problems so you do as a somebody should notice that and and you can change you need to change your wanted to their along something like that or the United States and communication there's nothing wrong with that as later but it's not something wrong with if you're working on something that's not in production for a long time and are currently at version 2 or something that was only 1 with saying I know myself not going back to voluntarily only mine version 5 or 6 attendant like that skip a bunch of numbers so that you are constantly reordering awards that to later to be you can move was another question division of this that make sense I mean does take some communication that there's no automatic way to resolve because somebody's inside which 1 has to come 1st but also to apply the migration and you write migration you put it in the in the right folder and then 4 is run this command called migrate intervals it searches for any migrations have not yet been applied and it in the run each migration from transaction and then of failure all right rollback that transaction and all also equipped with the inner quota of non-zero exit status so you'll actually get a genuine error so and that's helpful for the efforts of their ability to the yes the powers of determined that water as the file name structure that that that that that on the last slide that the of the version number of and this this this rollback feature works really well oppose stressed does work as well with with some other days of databases book PostgreSQL resulted DDL changes can be rolled back so and you basically it says this migration to that can apply and here's the areas that pose crescent back on me although databases if the if you wrote a migration that 1 actually run that has narrative and you'll be in some sort of indeterminate state because it will you can't roll back all the deal changes for you automatically so it'll say there is an error of this transaction with this migration but we can't entirely during so take Samenwerken output stress so and basically what what it's doing so the 1st time you run migrate it creates this table called schema version by default that you can change that to and so as I said it's not magic it's for a simple thing but may artillery that but but the basic idea is that it keeps the stable and has a virgin and the Torah they installed in and then who install them you know when and how long it took to do it of them and wasn't successful and so this is the way that the fire it keeps track of what is done in the studio uh yeah so the question is if you're service the replicated to someone else it's just sending commands to to be server and using JDBC so as long as you know any other GDL command will be replicated somewhere else then it should be replicated it's just fine to the to the downstream server that is as much a decay of subdirectories with and that's a good record but I don't think so I don't think you can thinking is just 1 of the long list of files moving as fast as double
bond options for the migrate had the URL of course carried out a contractor server and you can set a target which is very useful so if if you had other cases where we talked about before were somebody had said the universe their version 3 there was a reduction and then somewhere in version 5 10 that's that's way out in the future you can set target to state and just go to version 2 you don't keep going beyond that and then there's another version which is which is newly set to true but a false which is valid migrants so what it's saying I'm going to check all the other medicines of Odin applied to make sure they haven't changed at all before I apply new migrations and so it it checks the contents of the file name all that stuff make sure nothing has changed since since you are applied that migration to the ego when and someone makes a change in some old migration already in production of complained that so that's how I use all
that this is pretty well in resolving it within 5 is pretty easy you need to figure out why so many that change of course but there there's a command called on that things come with repair which saying I I didn't mean to make that change so to go and fix that in the in the in the metadata table university so it will update endophytes some than the description and all that stuff it won't be water on migration also you know that that's a left up to you if you actually did intended to change something that was already applied yeah yeah I see that
want to tragic within so this is on the fly away directory here i have adjusted a toll in the database other so in this sequel directed there everyone migration the finally comes of this text file or in those places go migration tear-duct text this migration is a variable that creates create this table so I can run while immigrate here in an essentially indigenous so it's saying validated migration because they had never applied for development and then it creates since it never been run before and to create this times conversion table but amended that successfully applied this 1 migration and in this next command of the will of it is called bio info which shows you where answering our saying it's saying OK now applied this some work version 1 and that was successful when I applied at the end of a description which came from the from the file name in question I it yes get can be in this case at isomers have to trust the source not just a matter but but are not yet because of precedent in the computer yeah I don't appear about yes you can set the password is 1 of the yeah so that his request the question is how can you go back so the next exploration was static along can you on that column and some of the other of migration tools do support that I think that but think bold roles 1 in the sequel muon balls will support that that sort of version of of downgrading flyway does not and they they make a pretty convincing argument 1 that you you you can't know you can always go backwards unless you're actually testing each time that you can go backwards and you can always do it so what I would do that cases where another migration to remove but thing adjusted to version 3 loops that you are actually like almost as political center in Ottawa lecture overhead in a database creating on the moon called but but sort of know where you are the surviving it back to you that this
problem if you add up all you want to say all buyers on him while at work and so we should have stepped based on this yes so all yes yes so so yes so the question is can you just sort of avoids if doing much stuff and then undoing much stuff can you just to start from this later point that has some some sort of non-state and eventually you always wonder this is because eventually you'll you'll have thousands of files in that table if we don't do this at some point to some point you'll you'll say and I identity this whatever and I'm upgrading a major version of posters of all old to say OK we have this whole scheme and there was just dump all that Internet and 1 and then so why this conversion table and start this so that the flower info command is is that is rendered that shows you what the principle that little table what migration have been applied in what on and shows if it's successful at all I mean the government will be in the form of a lot of the problems of this of stuff by right to use a group of In the code was so questions can you can you not run inside of a transaction and that because or something like that of the great and this concurrently which accounts connection and as far as I know you I don't think there's a would not run into production cost I mean in a case like that if you really need to get around it you could I mean you would you would basically do that by putting a migration that would that would create an index for everybody else on their development boxes and stuff like that you would do that great next concurrently on your on your box and then see what you do and then if you would have to tell to skip that migration 1 of 1 of applying it to production yes of the really useful thing about file info as they can use it as a test for a fervor remission that best target from option for migrate to tell it not go beyond a certain point and did not apply all migrations there you can use this as a test and it'll it'll show you what I can show you so
think of migration OK so now it as part of new migration into a the sequel folder info that's so it'll say this this 1 this is an altar table the use of time but said this migration is is pending vicinity well in this way so say so of the target the accusatory options thing and encourages 0 0 0 1 1 0 0 which is the 1st migration it will say this is greater than target so don't worry about that so it's a good way to test before you actually apply these migrations to production or or even their dogs this if you don't go beyond certain version and it does so that info 1st and then 1 year later using the same target option that and then this
1 which I do expect some discussion about so if you apply migration so say you're under development database you apply migration is a migration isn't really right so what action is right no migration which fixes that that all the other up option is to start from scratch again and I and was generated as drop a database and and we create a database from scratch or and away has Tacis command called clean which old and try to drop all the objects in the schema that that it's the flowers are controlling jobs and never on this reduction and uh this is a schemas options to fly resources or what what scheme it is managing when you run clean you know clean up all the schemas as manager and used to miss some stuff and inputs Russell used used to miss user-defined types and stuff like that it's got a little better the problem is that it only has focused on shore schema-like things not cluster-wide or database like thinks it doesn't really do well at all extensions of if there's some work-arounds to to to deal with extensions of that wasn't thing there was solar somewhere there and where can get around it but you know that I still tended just drop the database and the great interest and this sun I should use a few seconds ago and so validate is just which run by default now we try to migrate it checks all the stuff that's already been run and nature hasn't changed and repair is something that says of I did actually mean to change so so go and update manages to bad so that that I basically if resigned from a pool in the database which know knowledge people have that luxury that you can just start version 1 and go from there to starting with stuff in a database with most of us are so but it takes a bit more work but I and still think it's worth it Mr. what you do is sort with this crap earlier in the greater base version from the existing production database we don't have the entire schema and you don't have any reference data that you think all the developers will need and then you sort of combined this massages and the 1 based version 1 big of version 1 and they are in the strangle finally baseline on production database which will this create that the schema version table that metadata table the I users but it also you give it some options so knows what to call the 1st version Windows skip that 1st version was actually want when you are on flight migrate for real on the production database and then new right you start your next Magritte your next migration of version 2 or whatever you wanna call so that's that's the basics of Floer this so I 6 commands most of which you don't really use it mostly used and migrate invoke part that the media of what what are you going to use of their questions on fly away with 10 thousand iterations yet yeah so the question is what if you have 10 thousand migrations to apply the every answer is yes if you if you really do have another migrations that you created over years or no maybe really pass on immigration random and whatever years about that and then yes you would have to do it this way is to start from 0 and then apply them all somewhere like get tired of that and you can you can start with that scheme we have developed that scheme they get the and word about whatever you have against scheme and maybe some data but that you put in all those migrations and then I want that all your other migrations and just set that scheme as version 1 and start from just the rest of the might has almost left this definition based on the actions and you got here you were on the set of all In this case we have a very small part of group of directors of the face of the data earth around that you know that there were no yeah pursuant to some create that baseline similarities is everything you applied in those organizations at some point of fact yet at some point it takes this starts with the subset signal on run almost applying more more migrations and and it is good and and generally as I said do that basically when whenever we're operating for stress major version that energy that is because we're doing a lot of stuff that time anyway mobility more than any other questions In the 1st order as the questions are there 0 branches and say the the 1st set so so so if you want to test if a text span that which out of order applied and so if if I were to load testing for dose will lay currently doing is you have to have some sort of thing that which was tested and it could be a shell script could be you know of Piast welcome and or something like that that which wouldn't really be migration and this is not fundamentally ganja into production data and the way to do is is you are on flight with the target comment so to you you sort of written this thing to work out a specific version of the schema you run fly with the with the target commented to get Europe schema to that version and then you run your data loading command or whatever and then you fire fire migrate again with no target on applied everything else so sort of yeah so that that that is a common thing loading of data and for decades to use and that the best me was found that the best way to handle it was to get yourself to a specific version that you've written you're you're in jail importers report and then and then apply some day you don't have to be also equal of the the 1st same versions of it yes it was a task of yeah yeah so so so that other was accused of immigration which and that what they could have what melodic and 1 that will finally also as placeholders in that which you can uh specify the command line you know to take some some creativity that to use that you know you can you can put in place placeholder for for production offer Denver something like that and again you know optionally do stuff that the the migrations would would know it would be scary place that that string inside your migrations there I think this is like a it's like a placeholder dots and the name a placeholder equals something like that equals the string it so that was the most important thing that should be is so that's the nature of the problem of the of the addition of relations that we want to use the goal gene that was of the of the of yeah that is true if and if you can if you have if you can put your data in through your your application that's the point we to do it if you are you have you know sort or on where they can be in stuff and not modifying along where to deal with the database changes the discriminative right so this was like
good you but good migration is and what should be in them and what should not be in them but you get whatever the merits of asthma during your data is not an immigration but what what
content is still under and as the answer what entries you guys think should be migration it's very obvious once the deal obviously it's making a little yeah some some some representative data data in a very small tables they think everybody would be found in order to you only a different databases and accounts of what all but so fill out a new column within and outside a couple things obviously that we said that all the DDL stuff and it's it's really critical that it that this this all is taken literally you can't you can't be going and we can go 1 direction iterates interchange stuff there and expect migrations to still working applied in all of the structural changes the field to be in in Europe migration of so everything you know increasing the existence of at that you know there are some some places where you might have to carefully work around that but a really from all the changes this sort of a business rule is in practice and his we implemented the other changes would go on to the migration of references and will always users and little question mark there similar what was the problem with dealing with the user's information there in migration yeah yeah that's that's very close to my knowledge of you that uses everyone's password but by so the thing is so fireworks on schemas but users are not schema specific right the clusters was of the cluster which takes a bit more sir finansowania creating research if you run flyway clean and it will remove any users because they in the schema the in a cluster so if you're trying to keep the user's information across the different databases which is unified on all the users and their bellies your application uses a reaffirmation roles or something like that you want to build a assignment to different from the 1 assigned a permission steered tables and things like that it's not that trivial is not trivial solution but you know here's once it's nicer we sort of came up with more our world if you only have 1 database per cluster it's a lot easier and basically you would have find ways this this concept of callbacks where you can sort of look into a different points in life cycle the migration of nodes and so say after after who runs a clean goes through and delete all the users and then you have a 1 year migrations would create order users when you buy your 1st magnitude would create and then so if you only when there is requested with a pretty good solution unless you don't want to give away the password the pointed the sum of the tests that I've come across running migrations and show others lot to do with this but I don't even small single ingredient of so that 1st version 1 is going to be huge presence all the schema but if you're writing you're you're you're upgrades might even smaller to break things up you user and the minor versions there to break up of bigger migration it's more things you can write your for your tables 1 iteration creative using functions and whatever Bricmont of migration so that you have to do that story to have put in it as a central feel free to skip some numbers of your stuff like anyone reaction for 1 has a government has stopped watching consist of people use Jenkins here for a pretty good so as it's widely used even in this room but it's used a lot for automating builds from and from continuous integration tests so this this is server that sits there and you configure it to to build project or something like that but generally the way it ones is that they can use it to build project on a certain schedule or build something whenever so it whenever you have a source code changes which applied more frequently how to run up and so
that setting objectives product work would fly away and if you're using flyway along with developing a software is the use of Jane it's up to what Bolter file directory and yourself or directories for any from changes in the checks in a inches can tell it how often the check and things like that but I like to use it with a separate schools separate cluster Jenkins project certainly not uh it's not necessary but it just makes a little easier and I I also like to create a project that will certain additional project beyond our software projects this they just look some of the file directory and just runs that but just once the fire in the fire clean them migrate whenever anything checked in the way if something checks and something that doesn't work the Mittelfeld medially 4 does work than they can trigger the downstream build which I actually do something more complex events and test but I just have 1 they'll just make sure that runs but I like to have my project parameterized and as an option right at the top of the list of options and Indians and I give that to the the DVD hosted in there is poor the baby's name of an energy to several simple database you can use the finally queen and basically you can start operating a databases like this you they run fly away that the workspace is a variable that you get with Jenkins this word checked out all your code to the run flyway given the URL of the details 14 inch rankling migrate metal plate or whatever was there and and then migrate you up to date with history last but yes the question is is assuming that that In migrations are changing why would why would you need to clean 1st to the thing medications can change if if find actively developing software of all all of your your migrations which is not been applied reduction can change so if I'm actively developing software already known actively developing my changes to the database and all have migration think work and then you know the next cycle uh as then you know shouldn't 80 shards of 40 workers so that that and I James migration and is going to go backwards and versions of is 1 the queen and start and of from surrounding the clean you can I use POS crystals you can drop it in this the only receptor users and create a new database and things like that but this is where I talked about earlier if you need to know if you need to load data you can run with a specific target and then you would like your data at a script if your if you can't stop what it with your application and then you could run the the last migrate here without the target just to get to supply all the rest migration so this just to summarize some of the main reasons a great tool of keeping our databases and think it's uh it's also a really great way to show the current state of the database you get a version of the database is that you know exactly what changes have been applied to a database and allows you to test your database changes the single moms straight into your you're on Mac builds things that I I think finally is is a great migration was survive only 1 there was 1 I know best and is the 1 that I would recommend but and and the time and should be tied to it somehow and that's that's a pretty simple tool all doing is applying the migrations in a specific order and and it can do a few other things with us this the mean of it and by most people greater could write something pretty similar but the phi would as well and the cost violated with Jenkins together to run 1 in many schema changes is restricted and as far reminder that all research agendas must be migration just go the whole concept of breaks down if the start just adding stuff changing stuff from production without pre-migration any questions yes databases that are at the level of real data is the radius of the things that can use half of the year the and what was that because of the length of of yes so something's sink kind of away from the migration droningly yeah there you drop at the start of it OK 1 of most of the the so it it all that so this is so there is little check the mind the base of the text of migration so better than that equal folder of the job but it won't it won't go schema and write check anything there but you know make sure that the bills text files were just following have not changed at all but that's that's that's all evaluation of you can still use all of the there's questions because you run callbacks part of my great so that potentially would and ensure you could found in the call that's already that migration cycle we can run before after cleaning before migrate after my after each migration and things like that so that are at the end of the year to yellow somehow you have to tell it to not run production and matches exactly how to do that but yet in a judiciary could figure it out somehow because all of the the problems that you want to work on this and this and I will work on a timely to all if you feel free to ask more questions of of here but I think you