Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Aral Balkan
@aral@mastodon.ar.al  ·  activity timestamp last week

So this is what one possible database migration scenario looks like in Kitten when you’re storing JavaScript objects (instances of JavaScript classes) in your database.

(In this case, I’m moving a VerifiedAccounts collection comprising VerifiedAccount instances to an Accounts collection comprising Account instances, which introduces an inVerified boolean to the model.)

See the Database App Modules Kitten tutorial for more:
https://kitten.small-web.org/tutorials/database-app-modules/

#Kitten #SmallWeb #GazaVerified #code #database #migrations

Kitten: Tutorials

Screenshot of code:

Highlighted area:

  // Migrate verified accounts collection with VerifiedAccount instances to
  // accounts collection with Account instances.
  if (db.verifiedAccounts !== undefined) {
    db.verifiedAccounts.forEach(verifiedAccount => {
      const account = new Account()
      account.url = verifiedAccount.url
      account.data = verifiedAccount.data
      account.isVerified = true
      db.accounts.add(account)
    })
 }

Full listing exceeds Mastodons 1,000 character limit for Alt Text.
Screenshot of code: Highlighted area: // Migrate verified accounts collection with VerifiedAccount instances to // accounts collection with Account instances. if (db.verifiedAccounts !== undefined) { db.verifiedAccounts.forEach(verifiedAccount => { const account = new Account() account.url = verifiedAccount.url account.data = verifiedAccount.data account.isVerified = true db.accounts.add(account) }) } Full listing exceeds Mastodons 1,000 character limit for Alt Text.
Screenshot of code: Highlighted area: // Migrate verified accounts collection with VerifiedAccount instances to // accounts collection with Account instances. if (db.verifiedAccounts !== undefined) { db.verifiedAccounts.forEach(verifiedAccount => { const account = new Account() account.url = verifiedAccount.url account.data = verifiedAccount.data account.isVerified = true db.accounts.add(account) }) } Full listing exceeds Mastodons 1,000 character limit for Alt Text.
  • Copy link
  • Flag this post
  • Block
Aral Balkan
@aral@mastodon.ar.al replied  ·  activity timestamp last week

Also, if you forget to await db.verifiedAccounts.__table__.delete() to delete the verified accounts table like I did after the forEach loop, you’ll end up running the migration every time not just once.

(Caught it before deploying.) :)

  • Copy link
  • Flag this comment
  • Block
Eslam Family🕊️❤️
@eslamradwan1_D_5@mastodon.social replied  ·  activity timestamp last week

@aral Please, we in Gaza cannot sleep. Please, I need you to check on me.🙏🙏🫂🕊️

  • Copy link
  • Flag this comment
  • Block
Doaa Madhoun
@doaamadhoun@mastodon.social replied  ·  activity timestamp last week

@aral I was displaced to the southern Gaza Strip on foot for 6 hours without anything. I am carrying my children. Now I am sitting in the street without shelter, food, clothes or treatment. We have nothing. Please and I beg you to donate to my family to buy a tent and food.I am tired😭😭
https://gofund.me/7fc0e346

  • Copy link
  • Flag this comment
  • Block
Doaa Ayyad
@doaaayyad@mastodon.social replied  ·  activity timestamp last week

@aral Flour cost 267$

For sure we can't buy it

We fight every day for a loaf of bread

I have two little girls and they need some bread

I really don't know what to feed my little ones

Flour is expensive, milk is expensive, no fruit, you need miracle to buy a vegetable

Sorry, no caption provided by author
Sorry, no caption provided by author
Sorry, no caption provided by author
  • Copy link
  • Flag this comment
  • Block
Doaa Ayyad
@doaaayyad@mastodon.social replied  ·  activity timestamp last week

@aral Hello 👋
I am [Duaa], the mother of Malak, who has Down syndrome. I am writing to you today with a heart full of hope and optimism, hoping to find a helping hand from you.
Malak faces numerous health challenges that require continuous care and specialized treatment. Unfortunately, her living conditions have become more difficult due to the high prices resulting from the difficult circumstances we live in in Gaza.

  • Copy link
  • Flag this comment
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0-rc.3.13 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login