-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert-spirits.js
39 lines (34 loc) · 1.17 KB
/
insert-spirits.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { getTableArtifact, insertDifference } from './util.js';
import { tableland } from "./tableland.js";
const columns = [
'sprite_sheet_uri',
'sprite_sheet_version_id'
];
const SPRITE_SHEET_VERSION_ID = 1; // 16x16 sprite dimensions
const data = [
[
'https://analyzer.gemspirits.monster/sprite-sheets/01-00-00.png',
SPRITE_SHEET_VERSION_ID,
],
[
'https://analyzer.gemspirits.monster/sprite-sheets/01-01-00.png',
SPRITE_SHEET_VERSION_ID,
],
[
'https://analyzer.gemspirits.monster/sprite-sheets/01-02-00.png',
SPRITE_SHEET_VERSION_ID,
],
[
'https://analyzer.gemspirits.monster/sprite-sheets/01-03-00.png',
SPRITE_SHEET_VERSION_ID,
],
];
const tableArtifact = await getTableArtifact('Spirits');
const { name: tableName } = tableArtifact;
const result = await tableland.read(`SELECT * FROM ${tableName};`);
await insertDifference(tableName, result.rows, columns, data)
const newResult = await tableland.read(`SELECT * FROM ${tableName};`);
console.log("Latest Tableland Result")
newResult.rows.forEach((row) => console.log("\t", row))
// Example of a delete
// const removeRes = await tableland.write(`DELETE FROM ${tableName} WHERE id = 1;`);