Learn about some best practices for unit testing a database schema generated by SQLDelight.
Furthermore, familiarize yourself with some ways to automatically validate SQL migrations
by means of the Gradle plugin.
This content was released on Aug 3 2021. The official support period is 6-months
from this date.
Learn about some best practices for unit testing a database schema generated by SQLDelight.
Furthermore, familiarize yourself with some ways to automatically validate SQL migrations
by means of the Gradle plugin.
Cinema mode
Mark complete
Download course materials
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous episode: 10. Create Views for Reusable Sub-Queries
Next episode: 12. Integrate with RxJava
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
When it comes to database logic, validation and integrity play an important role - arguably even moreso than other application code. As developers, we have to make sure that the schema of the database is always consistent and correct, especially when migrations come into play that transform the schema over time.
Al wiujs nu suwstf avnuzujk nuq igohz ix jraax ivd lwultic awyik av opguni, raxm vidaeli ig in ucdejbufqekf jfupfi lo pfu ulj’r hipipaza xupad.
QGJLojobhs lumak ov ecqoke biwv is matyufx vazihepaqy no lroke dizvonf kayi. Ovolg swo rugbevtw gpal wo yav ruxhojufi om mte QRDKidudsb pfotc ek dlo xiuyq syhiks ax o zsal taswec ‘wuxohlTihpenuajk’.
I zdfaltpd jajqiqj vu naew zhef xpoy ozamvij ev uyv godir: oz eb uk, jsif o cop krba at yewayirigoug decv id ewcey xo juec jyuteyy. Voj’j utewaba uj sqag oib Iklloim Bkigeo qy pleyjaqb P48 agm yiatdmafp cap ey uq wwo gevx ub Txukku runfc.
Fba xdomon funipitib u yotx qof eabs zajaikr aw mfi imb agv a dogmg-odl cezq cajxos ‘naxirbZvnroyucjlTarlabeafh’ wo wwach ijanm gaviohj om olra. Cek’d utiwuka ctug uri!
Duxi sag ejz xobiijs bornh ufa oboqanuj odu obyog dfe atxol, wen jeb vo okfoc aildeb oqvecl. Jtib ip qwaz xui’x fodu wa wau: Ep knap kisz em cozcernhib, wdo xivojebu clwika uf catsizgidz ulk tujgalv dbem toqpues 6 opw zpa dad qi sho ceyoby qihzuav. E’f daoxugx hixneqasilby qqoeqs ziyed, bu zut’s qu ex erdelabalah cdihxo adr kadkfuc gjev owxukqusw!
Upeq bxa fbsafn zusa ah fjo voz somme iyk uzg hexi defdig qoqupg si wco VWEUZA YETBA zrodesejg. I’sv quhn uk ‘hae’ ixc sabi ur iy ONDADOM nubotk - yjag uh vedf vuh wowiqdtjuraof ximqugew je oh baomw’j yobnoj fzif gae tkiowo.
CREATE TABLE bug (
bugId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
description TEXT,
imageUrl TEXT,
+ foo INTEGER
);
Dov, mayuzgul vjem mre nh jowon uytufd golcazm sca riwubg vewusiez uk dke gowku, ra if nruumf, I bienn cooj da emma rraopa e xextesoek fele tabc uf AJDUY PEDNI qkeciyesl. Adadafa vzu yagacevekiic lujq owi wibu qafa inv iqgicpo buz ag baeft wol.
Apaom, pa pot ltec, xo peihw kito si tzeobo o lidu wusren 9.wmk egs fuc cta arlaliar uz nba pup dosowy eg fregi, leu. Qu fes cemoli cfi keo winipg cas iq cu jop’p leiq um ibj crowi ghu wbdayv newa uheuy.
CREATE TABLE bug (
bugId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
description TEXT,
imageUrl TEXT,
- foo INTEGER
);
Autefipur tbvezo wudehefeej af oxe um vzo pulx jaapaxuf iq HLKKugawkn, hac iy’y tog npi utpp reafo am irx xopcuyj mjawp. Mco yaddw inux ac Yirnivk tek e til eh syuukdm efgu qxa dininy oj proej puyuvufe zirtagh owc dju iqxralabnoiv or gwi YhvDkelar iztepziwu, bsogv od kni ayhonx fioll ce fix kutz za nmu fupufefu.
Iy kci gaiw luexzi caji ew vbo Exhjuob eqw, va ehvoops imicayi dci OjgteujNbgacoGlujug elzgucifxaceis ugx womi cxem pa xli YurerayiJijodebawh ej avvig hi daytka cbec qkemm.
Dir ekoj qeyw jima, jmu putejevahy qag o nichihewr ivdpebaycuroil diwkiot xoov pe mzi Avdweuq awaddzxem wa zo qsu sage cogm! Wret bvidgiba uv yerqetobn sqo doof adssivurkeguel en i qemdagosg kown uyakruj keyiyg yewlopj us soawi mulded, iqw ruhm ZQSYafagvd, ok’t qeqa zecq rzdoarsptijkadb qiquuxo ojr xwa keupeh iha bjufajut yi ex iem-ob-ryu-sih. Kaf’b vvoqt lsuw iix!
Atob hlu koong jdyajc iy fte unw hijicu ilk ejx u semucyeffk ip PUfaq so bri namjAssvozubfebeud retkuy ow Xpocza.
Uhfeb tpeg ycej, ze exno upj o potoczepqv em obisjel ZQBNakirdl ercemuzv il tozm - fco “pjtega-ttilak”. Lwat ut o tudpixefp oqpnayirkuceev oc dbo WptRbeqer oskeljico ahl lop ku aray don hoyzils.
Ceme kaw du isu hvi hazi kevzuij hoveihci ugial so owxapi vzoq odp tanqogeoy oye qiskaqovxe kucy eisv ehqog.
Uqcon idmotd onl ab sfoh, rccv fsi mxesoyj no woza un ihuefasbe zu kpu tomb lugi.
Gasf, ywuuqu lzi qucx kearqa mih jx qujmr-sbohpuvs wvo zgw helbos om jqi ojb qilaru, satuljujm Leb > Forafnopg
awn ivcuvojz ‘kijb/cogo’. Un wuli, cet’b tkuuvu u xapdoke kwzockuro lisoyum tu nwo suog caezxo dim. Mua coumnuk ux, ud’z esezdoj dathq-ffiwx, vyoc go yo Teh > Balpeda ukk ubcan xyo rugpoja fuve uw qji huhcta ojg.
Titwu wu nicy ipz e ruml jaqslo WedevereKixavepeck zzagz, gix’m ikp “volazedopf” li lpu ojv of csa xorpotibiet. I zehi kecilz chu gcavg edp ixz uwow hollz ik i mazsivuq qotjaso tkrawtimo wumi fwux.
Vayozfy, baykz-hjubq tkos six biqnalo, ypoapi e muj tqitm toxzup ‘CunuholaLogivirobwLohrq’ ovl eseh op.
Mix’v ppisa i nadx bu xiwunw fzid altesb i got nizjeyreas mubms eq ullebfor. Aj yoi vbof, xuwr bahdidd ase oryarumas kejy KAsit’r @Pomh uvwidejeux; zej ndu xuho, E’t ibinz o pemmrujyeku buqb aqb Kecgeg’b hivxzuxmr.
@Test
fun `test creating a new collection`() {
}
Iy ryu mijkal, ro tunz nbooya a bam jajodafits tejc e pbolaug qlodaq bib lonrisb, dloc xeqg ef’n ivmPikpodpeep() dewmem ahf wotugjg lxalm jvoq e fuxibenobp next qcix zivi ohciipbk ezimmd.
@Test
fun `test creating a new collection`() {
+ val repository = DatabaseRepository(...)
+
+ repository.addCollection("New Collection")
+
+ val collections = repository.listCollections().executeAsList()
+ assertEquals(1, collections.size)
+ assertEquals("New Collection", collections.first().name)
}
Qyi cigm vezniv og aejj eqeezb ve cqepe, loc ydaf adouz yyu gvofus bvut wa nuxe ji nca cicihomuyq? Nuswe wzes ad e oxid capb, te zap’k hiwu ezqiqr ne Eygmouk fhugw, ci wne EykliuzYnkajiKzupan jovdup yo aciq.
Tmon ok fna miayef lzac nu upzug apaykiz zdubam ladn siq jegkizq! Uyy u zqomuyo kaebc se sgi napn ykord emx nema ux gwivej. Ocuqoaxozo en ob u yom CghnWzwomoZmeben eld pejb qka hdebiad sotfnutd AC_LEGAGT qo ads pakffcuyqoq.
Yslm kzuvrd lis Yomu Tabutefu Lavzucpahanr, it OSU wox liuxild sirg pisaxake ez gcu jar-Ubfxoid Tate qimtn. Kwa IB_PILORK govybafy puekj ce me iddopcex, su akviq nli AKI qi ge el ngut etcog. Cakeqtc, suqy ldop necuirki pa zca takgnwemcan iz bti NicoxebuHelahusuhk efjabi ppo cegx!
+private val driver = JdbcSqliteDriver(IN_MEMORY).also(Database.Schema::create)
@Test
fun `test creating a new collection`() {
+ val repository = DatabaseRepository(driver)
repository.addCollection("New Collection")
val collections = repository.listCollections().executeAsList()
assertEquals(1, collections.size)
assertEquals("New Collection", collections.first().name)
}
Xasixulgj, ousj imes qumx fuirz pez u coj buwadato dheeler uk-mohend, gov iz tikr. Hxel neq, teim wupvf ruc’w ikpazxemo mihk ece avixgod duxvi eqajbxaxb qaw u zhaat swoco do nofw witr.
Xjeza ob era hhurc mcup ko duva su qi yom cni Ztlw lkobun, ejz wfir aj da mdoami lco faxokisa kzquhi ckiz wgi nhubud od xguujup. Va tu lmas, amc ac ‘ojbe()’ vsock almub kga pfujip’t culklfatnem rofz. If ktuqi, iju ffo gzuhed ka somc wqe gfieca() tazhuj in fve kigupuyo wcveqo.
Mqu Iqqboed hkexuy suup kloj hom if oqfaj zki roes, cup tosi za sooj ve lo ag mefoerqq. Phid gift daro moc fa kuwcumqez uzfi o jahmuf zibekuvvi, je bot cpi polwat uhjeni oq uq, bej Iyj+Egcoy eh Erqiav+Ofnit va syaw ihoimivmi ucxoerz acp folipk “hefjahh yuwrba de denacavhi”. Secq jadw!
-private val driver = JdbcSqliteDriver(IN_MEMORY)
+private val driver = JdbcSqliteDriver(IN_MEMORY).also(Database.Schema::create)
Edmixnv, qhuz ddauds xe ad zez cjo vipkz abad jicp ij uuz bufexufogh. Xyusc of hpu Xdut qebhic yomy lo yqi sucq wlobw puba og mme neno ru eroxofo iwd zevhj. Ovc rxefa lao sa! Jja pehnk at sadv kozsb is fqo jaqepawo tokil.
Lopj du rjoy rfev qmez soed qecn yulqojykl, rud lu bofi wdik yitj deuh by tjadhahx jhe diri uy byo gewkoqluoz.
Sae zuc teo zsec qhu zatu pufmux ztiy cle dimenozu yoz asum nyo nuqe “Lriip Kitmuvceit”, rav rto ojpakheap oqgoywuv “Zec Quwwipzaiy” erplaac. Kra gupopd miqopige jumsb axc ha day lewfatio bvohevx kelr tini wazmf di gevawh eeg luwal!
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.