Skip to content

Commit

Permalink
feat: finish seeding v1 data
Browse files Browse the repository at this point in the history
  • Loading branch information
rvcas committed Jul 7, 2024
1 parent b2bc807 commit ffef7ba
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion migrations/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "6",
"dialect": "sqlite",
"id": "f446e901-326a-426f-ae87-24ec3db13633",
"id": "dfb1da91-7ce9-427f-b65b-a6dedab53a34",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"blocks": {
Expand Down
4 changes: 2 additions & 2 deletions migrations/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{
"idx": 0,
"version": "6",
"when": 1720228959695,
"tag": "0000_mushy_red_ghost",
"when": 1720299004477,
"tag": "0000_futuristic_stellaris",
"breakpoints": true
}
]
Expand Down
8 changes: 4 additions & 4 deletions src/lib/server/schema.sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
export const blocks = sqliteTable('blocks', {
number: integer('number').notNull().primaryKey(),
hash: text('hash', { length: 64 }).notNull().unique(),
leading_zeros: integer('leading_zeros').notNull(),
target_number: integer('target_number').notNull(),
epoch_time: integer('epoch_time').notNull(),
current_posix_time: integer('current_posix_time').notNull(),
leadingZeros: integer('leading_zeros').notNull(),
targetNumber: integer('target_number').notNull(),
epochTime: integer('epoch_time').notNull(),
currentPosixTime: integer('current_posix_time').notNull(),
// only the genesis block has an undefined nonce
nonce: text('nonce', { length: 32 }),
});
3 changes: 3 additions & 0 deletions src/routes/explorer/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export async function load({ url, platform }: PageServerLoadEvent) {
}

const blocks = await db.query.blocks.findMany({
orderBy(fields, { desc }) {
return [desc(fields.number)];
},
limit: parsedPageLimit,
offset: (parsedPageNumber - 1) * parsedPageLimit,
});
Expand Down

0 comments on commit ffef7ba

Please sign in to comment.