implemented a lot of features
This commit is contained in:
1 parent
62f1767df3
commit
bcb9be5da9
141 files changed
+10705
-385
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { BaseSchema } from '@adonisjs/lucid/schema'
|
||||
|
||||
/**
|
||||
* Names and groupings from file contents (CONCEPT.md D21): a fingerprint
|
||||
* (exact size + MD5 of the first 16 KiB, as par2 records it) and the real
|
||||
* filename recovered from par2.
|
||||
*/
|
||||
export default class extends BaseSchema {
|
||||
async up() {
|
||||
this.schema.alterTable('binaries', (table) => {
|
||||
table.string('md5_16k', 32).index()
|
||||
// Filename recovered from file contents (par2); `name` stays as posted.
|
||||
table.text('real_name')
|
||||
})
|
||||
this.schema.alterTable('files', (table) => {
|
||||
table.text('real_name')
|
||||
})
|
||||
for (const tableName of ['parts', 'part_conflicts']) {
|
||||
this.schema.alterTable(tableName, (table) => {
|
||||
// Only for part 1: MD5 of the first 16 KiB of the file.
|
||||
table.string('md5_16k', 32)
|
||||
})
|
||||
}
|
||||
this.schema.alterTable('release_files', (table) => {
|
||||
table.index(['md5_16k'])
|
||||
})
|
||||
}
|
||||
|
||||
async down() {
|
||||
this.schema.alterTable('release_files', (table) => table.dropIndex(['md5_16k']))
|
||||
for (const tableName of ['parts', 'part_conflicts']) {
|
||||
this.schema.alterTable(tableName, (table) => table.dropColumn('md5_16k'))
|
||||
}
|
||||
this.schema.alterTable('files', (table) => table.dropColumn('real_name'))
|
||||
this.schema.alterTable('binaries', (table) => {
|
||||
table.dropColumn('real_name')
|
||||
table.dropColumn('md5_16k')
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user