Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Scott Lott
    @ClickSimply
    Seems like it might make sense to do a Logux server plugin, wouldn’t make sense to do anything on the client side though.
    Yeah this doesn’t do many things I’d like to setup...
    Can Rau
    @CanRau
    looking forward to where nanoSQL is going 👍 thanks for your time and insides 🙏 really appreciated, I'll see what I end up with and keep an eye on nSQL, have a good evening 🙌
    Scott Lott
    @ClickSimply
    You too.
    Can Rau
    @CanRau
    🙏
    Chris Michael
    @ChrisMichaelPerezSantiago

    Hello friends,

    I have the problem of when I build a project in production with electron + nanosql the DB data does not load in electron.
    Any way to solve the problem?

    Scott Lott
    @ClickSimply
    Wich mode/adapter are you using?
    Chris Michael
    @ChrisMichaelPerezSantiago
    This message was deleted
    const nSQL = require('@nano-sql/core').nSQL;
    
    nSQL().createDatabase({
      id: 'animeflydb',
      model: 'PERM',
      tables: [{}] //models omited for this chat
    });
    Scott Lott
    @ClickSimply
    Is this nSQL running in the main or render process?
    Chris Michael
    @ChrisMichaelPerezSantiago
    I have defined require('./ db / models / index'); in the main.js of vuejs.
    Chris Michael
    @ChrisMichaelPerezSantiago
    I have a version that shows me the data on the web from here https://animefly.chrismichael.now.sh/
    The electron app version does not show me the data.
    Scott Lott
    @ClickSimply
    Hmm, looks like you’re running in the render process. I wonder if there’s an issue with it detecting/using IndexedDB
    Oh, there’s the problem! facepalm
    const nSQL = require('@nano-sql/core').nSQL;
    
    nSQL().createDatabase({
      id: 'animeflydb',
      mode: ‘PERM’, // Need MODE here, not MODEL
      tables: [{}] //models omited for this chat
    });
    Chris Michael
    @ChrisMichaelPerezSantiago
    ohh wao
    I will check if it works for me. give me a second
    It shows me the data locally, but not in production.
    Scott Lott
    @ClickSimply
    how are you loading the data?
    Chris Michael
    @ChrisMichaelPerezSantiago
    This is the way I am storing the data
    const type = require ('./ types');
    const axios = require ('axios');
    const nSQL = require ('@ nano-sql / core'). nSQL;
    
    nSQL (). useDatabase ('animeflydb');
    
    export const actions = {
       GET_LATEST_ANIME_ADDED ({commit}) {
         axios.get ('https://animeflv.chrismichael.now.sh/api/v1/LatestAnimeAdded')
           .then (res => {
             nSQL ('latestAnimeAdded')
             .query ('upsert', res.data.animes)
             .exec ()
             .then (doc => {
               commit (type.LATEST_ANIMED_ADDED, doc)
               setTimeout (() => {
                 commit (type.IS_LOADING, false)
               }, 1000);
             }). catch ((err) => {
               console.error (err)
             })
           });
       },
      // ......
    }
    And to show the data, I show it by referencing the id
           nSQL(). useDatabase ('animeflydb');
           nSQL('latestAnimeAdded'); // model
           nSQL()
             .query ("select")
             .where (["_id", "=", params._id.value])
             .exec ()
             .then ((rows) => {
               anime.value.push (rows)
             });
    Scott Lott
    @ClickSimply
    Also, none of the columns are set to primary key
    Chris Michael
    @ChrisMichaelPerezSantiago
    How can I add this information that you mention to me. ? Sorry ... I'm something new using the nanosql library.
    like this? {key:'id',type:'uuid',props:['pk']}, // This has the primary key value
    Chris Michael
    @ChrisMichaelPerezSantiago
    Sorry, like this "id:int": {pk: true, ai: true},
    Scott Lott
    @ClickSimply
    Yeah, the second one, add that to the data models.
    Sorry got distracted with other things over here!
    Chris Michael
    @ChrisMichaelPerezSantiago
    Now when I want to select an anime. The page shows me nothing. To see each anime, what I am doing is using the id. But when ago console.log (rows) shows me an empty array.
    nSQL (). useDatabase ('animeflydb');
           nSQL ('latestAnimeAdded');
           nSQL ()
             .query ("select")
             .where (["id", "=", params.id.value])
             .exec ()
             .then ((rows) => {
               anime.value.push (rows)
             });
    Scott Lott
    @ClickSimply
           nSQL ('latestAnimeAdded');
           nSQL ()
             .query ("select")
             .exec ()
             .then ((rows) => {
               anime.value.push (rows)
             });
    What does this do?
    Chris Michael
    @ChrisMichaelPerezSantiago

    Yes, he shows me the list, but when I want to enter the section with a particular anime by clicking on it, he takes me to a section of the particular anime and shows me nothing there.

    Even with reference to the WERE id = params.id.value

          <router-link 
            :to="{name: 'MovieVideoSection' , params:{_id: movie.id /* update movie id to the right key */ , title: movie.title}}"
            class="nk-btn nk-btn-rounded nk-btn-color-dark-3 nk-btn-hover-color-main-1"
            >
            ver
          </router-link>
    Chris Michael
    @ChrisMichaelPerezSantiago
    Yes I did it
    But for now I'm just testing with the VideoSection section
    Scott Lott
    @ClickSimply
    It’s likely that it’s not pulling the primary key value in a part of your app, and that’s the problem.
    Chris Michael
    @ChrisMichaelPerezSantiago
    I'm using the command .where (["id", "=", params.id.value]) to reference the anime I clicked on.
    Scott Lott
    @ClickSimply
    // console.log out params.id.value and see if it’s an actual valid key from the database
    nSQL (). useDatabase ('animeflydb');
           nSQL ('latestAnimeAdded');
           nSQL ()
             .query ("select")
             .where (["id", "=", params.id.value])
             .exec ()
             .then ((rows) => {
               anime.value.push (rows)
             });
    Chris Michael
    @ChrisMichaelPerezSantiago
    Yes, params.id.value shows me the correct value according to the route.
    rows value show to me []
    Scott Lott
    @ClickSimply
    could you push your current state to github so I can see how it’s all plugged together?
    Chris Michael
    @ChrisMichaelPerezSantiago
    Oh yea
    give me a few minutes
    Chris Michael
    @ChrisMichaelPerezSantiago
    You can verify now.
    Chris Michael
    @ChrisMichaelPerezSantiago
    @ClickSimply I think the problem is related to the fact that it seems to me that the id is changing its ramdon value
    Scott Lott
    @ClickSimply
    Seems to be working for me….
    Chris Michael
    @ChrisMichaelPerezSantiago
    Ohh yes,
    I had to reset the cache, and now I get everything.
    I will do build electron to see if it works for me
    Chris Michael
    @ChrisMichaelPerezSantiago

    If you try with

    npm run electron: build

    He generates the application installer. You will see when you enter that it does not show you the data.