Code Monkey home page Code Monkey logo

Comments (7)

paulrosen avatar paulrosen commented on June 2, 2024 1

Here's the initialization:

class SetListDb extends Dexie {
	public metaNames: Dexie.Table<MetaNames, number>;
	public tunes: Dexie.Table<Tune, number>;
	public lists: Dexie.Table<List, number>;
	public tunesInLists: Dexie.Table<TuneInList, [number, number, number]>;
	constructor(name: string, options?: any) {
		super(name, options);
		this.version(2).stores({
			tunes: '@id, name, abc, leader, roadMap, countOff, key, bpm',
			lists: '@id, name',
			tunesInLists: '[tuneId+listId+order],tuneId,listId,order',
			metaNames: '@id, tabTitle'
		});
		this.metaNames = this.table('metaNames');
		this.tunes = this.table('tunes');
		this.lists = this.table('lists');
		this.tunesInLists = this.table('tunesInLists');
	}
}

And the model:

export class MetaNames {
	tabTitle: string;
    constructor(name:string) {}
}

export class Tune {
    id:number;
    name: string;
	abc: string;
	leader: string;
	roadMap: string;
	countOff: string;
	key: string;
	tempo: string;
    lists: List[];
	order?: number;
    constructor(name:string) {this.name = name}
}

export class List {
    id:number;
    name: string;
    tunes:Tune[];
    constructor(name:string) {this.name=name}
}

export class TuneInList {
	id?: number;
	tuneId: number;
	listId: number;
	order: number;
	constructor() {}
}

from dexie.js.

paulrosen avatar paulrosen commented on June 2, 2024 1

Yes! can confirm - it works. And I ran npx dexie-cloud@latest export all-data.json and all the data is there.

from dexie.js.

paulrosen avatar paulrosen commented on June 2, 2024

One thing that would give me a little clue is if I could see what is stored on the cloud for my account. Is there a way to dump that out? Or is the a "Dashboard" website I could log into? If the problem were data-related I can try to remove that record and see if the rest works.

I'll try to delete my indexedDB and put records in one at a time and see if I get a pattern. I don't have time today for that, though.

from dexie.js.

dfahlander avatar dfahlander commented on June 2, 2024

Thanks for the log printouts - seems as the problem is related a table with compound primary keys but the keys are not arrays as expected but plain strings. This could indicate a bug in dexie-cloud. I'll see if I can reproduce the issue from your database if I get a chance tomorrow. You can export everything to a JSON file if that would help using npx dexie-cloud@latest export. Compound primary keys are stored as JSON strings and it might be a problem with that. I might get wiser after looking into your db.

An admin dashboard with database and subscription management is under development as the last part before the service goes into production in the end of the summer. For now, it's only npx dexie-cloud export and the REST API available to inspect what's stored in the cloud.

from dexie.js.

paulrosen avatar paulrosen commented on June 2, 2024

all-data.txt

That is what export gives me - but did you want the contents of indexedDB instead? That is much larger.

from dexie.js.

paulrosen avatar paulrosen commented on June 2, 2024

A little more info:

I split the writes into sections and I successfully wrote all the MetaNames, Tunes, and Lists. That synced up properly.

But when I went to write TuneInList it started failing. That is doing a many-to-many relationship.

from dexie.js.

dfahlander avatar dfahlander commented on June 2, 2024

I found the issue and it's really a bug occurring when client is about to sync a table with inbound compound keys. I've released a new version with "test" tag for you to try out:

Let me know if this fixes it.

Another thing I noticed is that the typings for IDs in your code are all numbers while they really should be strings ('@'-keys) and the relation table should be:

export class TuneInList {
        //id?: number; not there!
	tuneId: string; // not number
	listId: string; // not number
	order: number;
	constructor() {}
}

Please try out the fix and let me know if everything is working properly with it.

from dexie.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.