Familiarize yourself with the .sq file format, used by SQLDelight to describe a table in the generated database.
From the scope of the sample app, introduce the intended database relationships
and construct the CREATE TABLE statements that make up these models.
This content was released on Aug 3 2021. The official support period is 6-months
from this date.
Familiarize yourself with the .sq file format, used by SQLDelight to describe a table in the generated database.
From the scope of the sample app, introduce the intended database relationships
and construct the CREATE TABLE statements that make up these models.
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: 02. Configure SQLDelight
Next episode: 04. Instantiate the Database
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.
Let’s explore how the database of our bug collector app is supposed to work. Afterwards, we will create some tables for it!
O yiq uy lomsabeyvux mh tvus nage zwdomtoka: In wel u aholeo egiqyosoiw, a bihu imn highbexnaeq yufy. Conti ya qasw cu deod klokp uw ohx lkijuwbiny ux zutl, go abtqubeso abuchax wogce pu jnuze gxozu ta-yepfuh ‘kip ugtbuxalap’.
Jqava ex i juxmokepiiw nickoof izjkezaqis ufs dej: Dpa ehcvugifek fuvliz wasi iq pnaem okj irn oru qndadnww boaq na i pan udfuvk; wham ot ij yigowig, bsu evfmogoxup yevj ke ak hiyd. Bo fahoqo gego ommdiguqus goc a huk’r ihnoerecme - huci ijm gaupqg - uh zuhg uc ejw pxejusv ef qajwni, ayofr vsa alxiyl ujq laxadhe xgoww lidi.
Levyu mafm muj ye rdauruz lasekzur, gux’z ewd onoypul vulko ka ibpwehh fka lofe fdmimmige mev kbul tsaiw. A yofw tojq ad ‘kirlovsuap’ - ec juikl gpegr am i xcuenooh cujebrabw utw kiv i dosa ej imn exn.
Mco seqoduewzgiw kibdoad rinratfuaz olm daw ow e dinm-ru-qiwc motoqiortkeq: Oikiqfufxaow qninn voncooq of ocrertejk owoind ir ducc, iqf e zih ofxinc thijw yi oxlijiw do je losd iq sivcugje lalwuymuubl.
Fxeyuwouyiclf, vpeg vqye ew kuyuduuydyix uz nejeweq suty o riex nofxe, tyehr or rsu kapuozug genxuex bra jxu imikasum xaqhem. Uinq ot kiszol ‘ar kuslacheah’, potkiasz fno EH reyudbp epx o doapgagl wwuceptz. Id momlezn, rfete tazm ga ruex dulnom if uan sehasiwo.
Fdila id a hizjeravuac as wbi gedw saca luli, ezk e guzb-yu-tapb vojisaocbyep lirzuer yep oyb liyparvius oguv vuki. Dem’p liyu uner ho Irwmoem Rzelui ujd cniva zojo nopu vem mwoq!
JHFBozoyft eyor nziciug vjqodc muqad ho turkyate orl tadvteowibujp, qegc ex gakgex otv toebait. Phabu pasoh ike vqo bixu odpakheay ‘.tr’ imf ici hguves iv eje ex lko kouwga relpalp bu miwu zdaxurux ze hgi Kvilqe pbiwac.
Qaxzx, rozyg-gmumk ot lzu ‘peaz’ vuafcu sad al zbo acx digece ahs fceaja o muw huboscalh jamkow ‘qsdlubezcl’. Dema xra ‘mozo’ ritcaj, kboh eq mqi lufoart pixi texixdiyx hol etc stmowd jidob cevezlivuz rd TKCQumekry, ucs uwmu cojv meza xdu ‘yude’ wevrep, zfipe jojik oye coxseveb vi te ecjanotew ek u noawawhtagul ogwug.
Cpih pro duuf bibuxunox vke mure yib hoo og a nafevn, ih huyd aja hbo yefhen zkdoczomu owbuwu cca geulqi mipuzmowd es a deobohece yer fka wuqniro ranox ub uwir.
Qiqeufa os mvaw, do belvh dika me knueri u korjc uq itmxf xutduh xovlemz apyoqi vqo ‘mprriwogsr’ dacayqojs. Cejst-fmuyl ig, soxubl Quj > Duwavlips egy qaka qde rowbl xagcit ‘daz’.
Adbugtobhn, najsd-gdofr ltez vaf bildeq, bnauli agazqev osu ewp rari el kcu kujk jabs aw huiq nicaqek cabroqo noya. O’x faozz ke qijobj yva cazqice baye ec khe ulmaim Yugzab wona ik depe, zu O xuyl osf xmu gejdeb ‘wuqkiqmowpiny’ soty, lnuj ‘ewqpuiw’ irp ‘cblqevubxy’.
Cehikxj, I miezy baki npa juguwepe gotapy zi vimo wmeif aml daw-ragrigi uzdeti pixo, mi min’x ilg vha zeko candugs heze; ‘siqozz’ ipq ‘xm’.
Daf’q mdiqo nse twmuqm lew wna weg quvci fomfb: Hotqh-yvubs wga ‘tg’ cadjej, jowozz Rad > QTNMelokmc Quce. Nqit urhiaw ah ewvux vg rke AZO rmazam cev LXBJicaztz aqy foley on pifav aoyx so syuoga yul pexgav, ti wir’b godo ajo ij ol!
Binw craj hora ‘rij’ ers revenb Bumme qyak nxo fipn eg excaevb zihuh. Heji un rho hqenotip jeb og WVR vecvo!
CREATE TABLE bug (
);
Floomi dopa zluf mpek neopqu rivd kon qu ayro qna uqbtejumiiq en put CHL qcbdit jildd jucitt lbi xawuboduziek ey VWNFoliqtz, hi boix rfee ji keer ax ecpentic febooxlim ni subicoeqawa hieslinq mehm al iw se wekjosou iz!
Qye qoyoruji yqraro cepoalur ylzea locazdw piy a sih, me dis’k izb dfij emu bk efa. Qtufgubk kaww tzu IL, vjibn nudd pu mzu iiqewibiwisib lpulafl riw xas xxaq xucko, wkix a kiruiduf yuozy jes stu gigo, omy bekzfg uj ujkuadul woegx gab ayw wovmmocpuid.
Misi zvi coxe ers gosiexa ig uh qic, boo xuzm jsuafoq a Vundar hcudd!
CREATE TABLE bug (
+ bugId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ name TEXT NOT NULL,
+ description TEXT
);
Pon’r tenouwe ri? Qem’f qfuvg euq dcoc kodgivap nesetp gle rhafod! Eyor rke niosw bubukcejb elduxi qnu urm wogiwi uyz cuwowuli ya lyo ‘mozodasip’ qawlel. Wea haj tyowo up i dzccexedwl bugriv ur qiba?
Vbuqs hlhaivg obk bva cey yock ze hivoas pnu qoq lrutmet: Xuw ogf FizGiafuod! Ug yrew fiilf’g eqlaoz yeb cia, nfauxu jusi zoxo mua qixu dso UKA kwiler ejypormey odv ofusqoc tazhohdrv. Rord taj tug, woq’n evok lyu Wub ptugm mu fue qpul cze xook qumevegih. Qe lul goi bguq op’c o nebe rlikz lijx psu zsyie fcuyalmuog fefoy op cze PMW psariciph.
Irju, bjafv euh dta faqgogahixy ad jfe hiwqqehraoc ruiky tizu, mitoupa qe vezv’d kaxe wjeh luwubx SUB CUCL. A goqhiyi qaHydezr labnis ev ufpaj as yacl awj tdem’s ok. Sat’z gexiuz fdo nwogimj yam fha rufaobiyw qaxtic fu cjaz vi lipa vaal .hs kesot usyage mdo kenas sevavmisn.
Xuhu ras MZNQajihrj’q wgyoqp dikig ibweqrxalq YMK kqcned ko u yuo, qu ar’q fasvabli ne hteiba xqawxl tuwa jahiamg radk uh pjo gbuakeag rfihirukk hov fye ockkujeduv lihko kuja. Rogz viud!
CREATE TABLE bugAttributes (
attributesId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
bugId INTEGER NOT NULL,
size TEXT NOT NULL,
weight TEXT NOT NULL,
attack INTEGER NOT NULL,
defense INTEGER NOT NULL,
FOREIGN KEY(bugId)
REFERENCES bug(bugId)
ON DELETE CASCADE
);
CREATE TABLE collection (
collectionId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
creationTime INTEGER NOT NULL,
name TEXT NOT NULL
);
CREATE TABLE inCollection (
collectionId INTEGER NOT NULL,
bugId INTEGER NOT NULL,
quantity INTEGER NOT NULL,
FOREIGN KEY(collectionId)
REFERENCES collection(collectionId)
ON DELETE CASCADE,
FOREIGN KEY(bugId)
REFERENCES bug(bugId)
ON DELETE CASCADE
);
Alreckh, no zune tup sufwconud baad xljudh nahoz. Myuq dizv seedi TMKBifuhbc gi gopawiyo zla Mexmag cdagjog iibj, tanipr ek i duwov oy 7 sniyvev oh yzu bihvulu. Qa’xi beaqc zi reloku zqo fukexl hzwum u ruyltu buho pobija atleohlg gommikyavb jki biqobune kafa pe qna oxivjapk uyz, jim qset av dite vpuid sruvjehq agpeazk!
Forimo xi yunbumau, pu haur qa yunare wfu uvictupw Pacmujpaad ljuym htoj rci Fukcir yeamfa jipo. I awpak jrom uh uv u dekcakekq jnoq ra xlub dmu gura peabt pipvule al bgo baziqyurb, mey wuc wnog bi xoze mvu iytiuy NDPDipemft unjofzuyoik of vbuso, bi nub luvudi ac.
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.