Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Model with devices does not exist #37

Open
chrisjd20 opened this issue Mar 3, 2022 · 1 comment
Open

Error: Model with devices does not exist #37

chrisjd20 opened this issue Mar 3, 2022 · 1 comment

Comments

@chrisjd20
Copy link

chrisjd20 commented Mar 3, 2022

Trying to figure out this error.

/usr/local/lib/node_modules/tuql/dist/utils/index.js:57
  throw Error(`Model with ${key} does not exist`);
        ^
Error: Model with devices does not exist
    at findModelKey (/usr/local/lib/node_modules/tuql/dist/utils/index.js:57:9)
    at /usr/local/lib/node_modules/tuql/dist/builders/schema.js:107:47
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/tuql/dist/builders/schema.js:100:18

This is from

throw Error(`Model with ${key} does not exist`);

Here is a small sample of my simulated database:

PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE cybermen ( id INTEGER PRIMARY KEY AUTOINCREMENT, cybermen_id TEXT, time INTEGER, latitude FLOAT, longitude FLOAT, altitude FLOAT, ll_accuracy FLOAT, alt_accuracy FLOAT, platform TEXT, planet_id TEXT, os_version TEXT, cybermen_model TEXT, device_id TEXT, tracking_enabled INTEGER );
INSERT INTO cybermen VALUES(1,'5505929089744357',1646332890,-58.012831404017347835,41.831462491840198936,54327.88482743823988,78.102049147571591448,60.14073751739705642,'cyberm_os','A-996','COS 10.8.5','T-240','4717defa-a82c-4ac3-9b3d-620dc247fb3d',1);
CREATE TABLE sentients ( id INTEGER PRIMARY KEY AUTOINCREMENT, sentient_id TEXT, time INTEGER, latitude FLOAT, longitude FLOAT, altitude FLOAT, ll_accuracy FLOAT, alt_accuracy FLOAT, platform TEXT, planet_id TEXT, os_version TEXT, species_id TEXT, device_id TEXT, tracking_enabled INTEGER );
INSERT INTO sentients VALUES(1,'06466350783550256',1646332892,-34.706857617227065305,-177.25406639115001894,3273.0915289905128701,64.153259426315315749,37.280746329670137128,'nano_dna_os','2-362','COS 9.1.6','S-545','a05c3f61-e90a-4219-9f2a-a74c71fd67e8',1);
CREATE TABLE planets ( id INTEGER PRIMARY KEY AUTOINCREMENT, planet_id TEXT, aliases TEXT );
INSERT INTO planets VALUES(1,'A-245','Aglaia');
CREATE TABLE sentient_species ( id INTEGER PRIMARY KEY AUTOINCREMENT, species_id TEXT, aliases TEXT );
INSERT INTO sentient_species VALUES(1,'X-209','Xad');
DELETE FROM sqlite_sequence;
COMMIT;

Any idea whats going on?

Error: Model with devices does not exist Whats up with a key name of devices? I dont have anything named devices in my db.

@chrisjd20
Copy link
Author

OK so I'm not exactly sure what I did to fix it but _ and uppercase characerts in the table names or column names was causing it to error out for some reason cause this worked:

PRAGMA foreignkeys=OFF;
BEGIN TRANSACTION;
CREATE TABLE cybermen ( id INTEGER PRIMARY KEY AUTOINCREMENT, cybermenid TEXT, time INTEGER, latitude INTEGER, longitude INTEGER, altitude INTEGER, llaccuracy INTEGER, altaccuracy INTEGER, platform TEXT, planetid TEXT, osversion TEXT, cybermenmodel TEXT, deviceid TEXT, trackingenabled INTEGER );
INSERT INTO cybermen VALUES(1,'5505929089744357',1646332890,-58.012831404017347835,41.831462491840198936,54327.88482743823988,78.102049147571591448,60.14073751739705642,'cybermos','A-996','COS 10.8.5','T-240','4717defa-a82c-4ac3-9b3d-620dc247fb3d',1);
CREATE TABLE sentients ( id INTEGER PRIMARY KEY AUTOINCREMENT, sentientid TEXT, time INTEGER, latitude INTEGER, longitude INTEGER, altitude INTEGER, llaccuracy INTEGER, altaccuracy INTEGER, platform TEXT, planetid TEXT, osversion TEXT, speciesid TEXT, deviceid TEXT, trackingenabled INTEGER );
INSERT INTO sentients VALUES(1,'06466350783550256',1646332892,-34.706857617227065305,-177.25406639115001894,3273.0915289905128701,64.153259426315315749,37.280746329670137128,'nanodnaos','2-362','COS 9.1.6','S-545','a05c3f61-e90a-4219-9f2a-a74c71fd67e8',1);
CREATE TABLE planets ( id INTEGER PRIMARY KEY AUTOINCREMENT, planetid TEXT, aliases TEXT );
INSERT INTO planets VALUES(1,'A-245','Aglaia');
CREATE TABLE sentientspecies ( id INTEGER PRIMARY KEY AUTOINCREMENT, speciesid TEXT, aliases TEXT );
INSERT INTO sentientspecies VALUES(1,'X-209','Xad');
COMMIT;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant