update pocketbase,
This commit is contained in:
@@ -1,34 +1,36 @@
|
||||
module.exports = $app => {
|
||||
module.exports = ($app) => {
|
||||
let draft_lesson_types = [
|
||||
['1'.padStart(15, 0), 'Vocabulary', 'vocabulary', 0, 'visible'],
|
||||
['2'.padStart(15, 0), 'Connectives', 'connectivse', 1, 'visible'],
|
||||
['3'.padStart(15, 0), 'Testing visible', 'testing', 3, 'visible'],
|
||||
['4'.padStart(15, 0), 'Testing hidden', 'testing', 3, 'hidden'],
|
||||
['5'.padStart(15, 0), 'lesson type 5', 'testing', 3, 'hidden'],
|
||||
['6'.padStart(15, 0), '中文 6', 'testing', 3, 'hidden'],
|
||||
['7'.padStart(15, 0), 'レッスン7 レッスン7 レッスン7', 'testing', 3, 'hidden'],
|
||||
["1".padStart(15, 0), "Vocabulary", "vocabulary", 0, "visible"],
|
||||
["2".padStart(15, 0), "Connectives", "connectives", 1, "visible"],
|
||||
["3".padStart(15, 0), "Testing visible", "testing", 3, "visible"],
|
||||
["4".padStart(15, 0), "Testing hidden", "testing", 3, "hidden"],
|
||||
["5".padStart(15, 0), "lesson type 5", "testing", 3, "hidden"],
|
||||
["6".padStart(15, 0), "中文 6", "testing", 3, "hidden"],
|
||||
["7".padStart(15, 0), "レッスン7 レッスン7 レッスン7", "testing", 3, "hidden"],
|
||||
];
|
||||
dirtyTruncateTable('LessonsTypes');
|
||||
dirtyTruncateTable("LessonsTypes");
|
||||
|
||||
let lt_collection = $app.findCollectionByNameOrId('LessonsTypes');
|
||||
let lt_collection = $app.findCollectionByNameOrId("LessonsTypes");
|
||||
|
||||
for (let i = 0; i < draft_lesson_types.length; i++) {
|
||||
let lesson_type = draft_lesson_types[i];
|
||||
|
||||
let record = new Record(lt_collection);
|
||||
record.set('id', lesson_type[0]);
|
||||
record.set('name', lesson_type[1]);
|
||||
record.set('type', lesson_type[2]);
|
||||
record.set('pos', lesson_type[3]);
|
||||
record.set('visible', lesson_type[4]);
|
||||
record.set("id", lesson_type[0]);
|
||||
record.set("name", lesson_type[1]);
|
||||
record.set("type", lesson_type[2]);
|
||||
record.set("pos", lesson_type[3]);
|
||||
record.set("visible", lesson_type[4]);
|
||||
// record.set("created", new Date(Date.now() - i * 1000 * 60 * 60));
|
||||
// record.set("updated", new Date(Date.now() - i * 1000 * 60 * 60));
|
||||
|
||||
$app.save(record);
|
||||
}
|
||||
console.log('seeding done');
|
||||
console.log("seeding done");
|
||||
};
|
||||
|
||||
const dirtyTruncateTable = COLLECTION_NAME => {
|
||||
const dirtyTruncateTable = (COLLECTION_NAME) => {
|
||||
console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`);
|
||||
const cmd_to_exec = $os.cmd('sqlite3', '/pb_data/data.db', `DELETE from ${COLLECTION_NAME};`);
|
||||
const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`);
|
||||
cmd_to_exec.output();
|
||||
};
|
||||
|
2584
002_source/pocketbase/pb_hooks/seed/schema copy 2.json
Normal file
2584
002_source/pocketbase/pb_hooks/seed/schema copy 2.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2581,4 +2581,4 @@
|
||||
"indexes": [],
|
||||
"system": false
|
||||
}
|
||||
]
|
||||
]
|
Reference in New Issue
Block a user