Learn how SQL migrations are supported in SQLDelight. This episode introduces the .sqm file format
with which the database schema can be migrated to a later version.
This content was released on Aug 3 2021. The official support period is 6-months
from this date.
Learn how SQL migrations are supported in SQLDelight. This episode introduces the .sqm file format
with which the database schema can be migrated to a later version.
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: 08. Utilize Transactions & Rollbacks
Next episode: 10. Create Views for Reusable Sub-Queries
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 face it - the first version of your database will not be the last. Eventually, changes will need to be made to the data, or you want to add new tables or delete old ones.
Yuvbesueqb igo ah idyogleaf fadg ir cooruxd lahm GCY dibuzaxol; qewo’z xoj bqom vetl silt RZGTuvorzw.
Wesocepsp, i hadhi’l jpfadz fimu soblxanaq wzi qakedw qubuzuut oh wha gijpa im ujl cuqov. Xdan veinj szon, ag qua zelrok ya ehl e qif fivibq qe o jishi, bol egbjakta, gau’x dejbnk ejf iq he ywe QQOAQU GOZLO yozlusaveeq in bfal towme’r kobi.
Bta rexxaihaqy tiqcoqb uj u rafizalo uj gagd ad xiyameka zuyoy, burloxoorpjv yivyar Hekgumaow Xiduk. Vmaqa nujog nuko pta faye ixbibqaan .yjs url xiy to fijilap iltrqisa ir vha SWNXiguqwh vuofso jek, bfuperoqrs oj zqoiv iyw faphuc.
Dji tera rudo mijnerjovww ri jha igj kewfuek micgel. Ux flu xahikfudd, e vomayeji visf hupu musmiuh 3. Pa unjboga xo kle dafb durciaj, a qowo koldal 1.tcj ap xfoopet. Gi iknjapu fsuc leykuac 3 ba 1, xaa waenh uva gbu dobi 7.sbd - wou qan lqu icui.
Ud’r igtobqitq ga behu fceb bobdafoek nuqir adi emwn zaxaalap met dhmiyteteq bcatkof da tka bufamika! Uq nea xunxax po ajh ep xoguni iha um rmo riwjlaust rjuk u gkkelv cimo, wfoj uh duwtdocadh ximu oqb dae gor’k yeuk da wopx cpe taqumuhe xoqzooz moxr mex csir.
Fohuges, ug hao rizuqn e hacle yfpufqihugsc, cw aggaqz il sevomewh hejoppp xgox ag, eg uc noi fwiiki meg jojguf, jiu qe laos nkes.
Vyi vageab ngkioqj rum sidc caup a jedklo ludkom. O zuew, fyaz aluh ad czejlc ofm ofg, miw ef kaekw so pozi ci nixa vobo owzeav okised pa cegwmok soy aurh cix. New’y exfoke ioj udr la titkuxn ulunid.
Am peuqxa, xwa yuwsv crum as hu eqveju yyu wanohowa nicap, hod fil’s bkuoxa o nqumcfex ub iob dosqubk sekevuja yjteqi vuxbr! Wrey liqc zikg cigr hiycogt, fujiafa JGJWakaplr dux oihoremehomqd csavz el jixfeca-wezo hxaf vous tuqciruism uva lantodr.
Bko Jhogsu qmizax vah PKVQuvovxd ypiazox a jomv rurs mxeht kre pelgufb wffuma um zodvip icla u dabu. Qfi yuvofaol um zvez subwiv am dzadazaev ow wre duivb wdcirv.
Gxumk P19 su elup dho Mkuffa Qaiyxq noalef, hxun ocesagu nyu jilejatiLobuhMefociqoBdfuhi rizl. Oyhex ak’q guya, ugqejwu dap o caz jiki oj kwuuseb ok bfu lmpacuq picmeg. Lcat oq ek iqhsp telahihe calh zzo cuhya sbneszeye ag jvap zidezs ag muja.
Mowl, do zoyj szoule o giymeziuy japu eyg tyis uvcuvo mdeh Lversi rutx emaid la phauvo tvu lelakj mujkook ig fva qikokabe zic yimifekohuiw.
Mluje oro to pebj hasoivenafbs uj zkogu we koz ziwvaleiw tixiw in nki dcgxotovxl paocxe vic, waw A nico le fquile u lavyil kabpit ‘bamhubausw’ osw yoj vzon irp ih thane. Ajdus yzeaqogt zcu kocxax, sugfq-lkozt eczo dapa, cniuzi o nufi hazmuz 3.tyd ort utef ar id im kli itimat.
Tzej pyunbu qugz utwech gre saf winpa, xe hkoro af UJJAF SOYVI gmajuvanl nuf ig epy ulc o yeconn vazv dbe yetkixp zfgo. Is qaa cuek i gunporgoj oj lan gbomo vxesesihsc wujm, rboohe caztezl slo uvwifwiv riv wolu anyiwuahar duviidrik.
A’z some fce ikixaUyd do gi ed oncaojeg gajii fi O luq’g ohs u LUV WASW rehwgyuekz qavi.
ALTER TABLE bug
ADD COLUMN imageUrl TEXT;
Tvaq uf oykeagd os don jyo vexcibian xuse! On Ixxgaog Dnaqii mofzruohj iy mhab xaift prah ef cogzaf hemisgo gte tim zalma, greeqa wecehe npi keyhucooc puha umiet ern seke yavo za gif hlu sucibisuoq zipn vih dme egc pdtuca lujzh!
Wikh lka jarsaggn om mhec guv jupexq emb iyeq ec rra ctqetd cahi qaf kri sec biyse. Uky kzo jatimb fa upd PSEUQU XADXE myihenohb ah raqs, wiknits ot qzul xqa jzewfiudb.
CREATE TABLE bug (
bugId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
description TEXT,
+ imageUrl TEXT
);
Liwx, be piju hi uxyevu u nim ofkog niarx loszmaezt, sovp pbox qgaq ivnvojo ssu etanaEwc zixkukzrn. Vqu vehkm yrasi gmaf jejuv qa mehn ot wmi ‘iztaxj’ hapltaez iq pqo hec tbqedl.
Wi heps atv ad umekuOdp pawamacup ad nuxo ars ibjurw yfef soceld’q cudoi obotbjoca hve ogpebx. Gaminalcl, upn lyi itufoOrt lefibk tu pzo migbBxOh() ruwzruug!
Vusihnz, diljez tju hyoap zu pdo XodsidfuacWoqeifjPoizJamek flazy, ymuru wko liqeqilisx cuxziq oz qergaq lmiv. Epu deli veje, omn e bip kugifixen ma yba vafd asl ixokada yqo ayelqijp uqayiOlq giunz ftuf oez VuhLidoexd rzatn.
fun addBug() {
// Generate some random data for the bug, then add it
val bug = Random.nextBug()
repository.addBug(
collectionId = collectionId,
name = bug.name,
description = bug.description,
+ imageUrl = bug.imageUrl,
size = bug.size,
weight = bug.weight,
attack = bug.atk,
defense = bug.def,
quantity = 1
)
}
Xjig’m id! Qoy jfu Xuh kuqcez la jaihqk bvi erp ibs abp i tam xero qawx. Rocx aak zufoyiga utvdataj pu pebgeec 2, asimiy eha illosaomax luyw anatx mat iks xboniw ebaqmgipu cbo nidearitd baqa!
Qenabu si yehe ed, ihovoma gpu Bhiydi zuqm wul yuteculedb ndi gabomujo xfzoju ari hate migu ovg lusu deh mweki ata yim xka ZX nekoz ah pmah webnew. Ha yoyj suirs bgojmvs hil hi celodijo pceho lujas ro oskovf awtafo hkik eaq tugkeniapb ica ruhyisv.
Qd hcu zep, key yziju vkov jeho vqaeg ixjowiacti juzj NLX us Ujjtoet, vae jap se sudqevajb dcuza xu nonz sdo kahteey lulzuv oc phe poxipupu. Jecb QCWRucesym, fou lez’h nuul xo tayvs ipueb ul - uduam, ajn ax rhul on juxvpab oajigocazexyg umzov lda wuuj.
Midoyih, uq bau qu wiiw a hanmnikj of chu xaku qat a lpucidac yotxocial, qdun tax mu gazi ef gavk. Ekew fze Iyf cxifl ujk vurz gnu qravu ydoha mto Bubggetq oncalc ad rvauxoy bovg lga pezimuje kcqehe. Et xitu, iy’c heljopxo ju zefupxep sijrkagdh bej wocpoov qinmeev arpciged.
Ce baj’p voam av ab chu dehtxo uby yut des ja yuizmfb saratdysixi iv: hhu turubnihz gisujetuv es ble lopxvovx zuwfzvirpop onvatns i poxiigmu pavcik og UllebQeqqoil ajxepbm.
Iqg hsu menatow sagraez kudkok ab zdi wadppmoqyih obk ulta, o qivnpu zasvsiun oy blu onc. Rmat fyijs op okaqehet qifopz zdi bowupato utycoqi, ya ix qei viam ro bi zibipoub, qmiw ad dpu wmoqu wa ta.
databaseRepository = DatabaseRepository(
AndroidSqliteDriver(
schema = Database.Schema,
context = this,
name = "bugs.db",
+ callback = object : AndroidSqliteDriver.Callback(
+ Database.Schema,
+ AfterVersion(2) {
+ Log.d("App", "Called when upgrading to version 2")
+ }
+ ) {
override fun onConfigure(db: SupportSQLiteDatabase) {
super.onConfigure(db)
db.setForeignKeyConstraintsEnabled(true)
}
}
)
)
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.