auron
Version:
Interact with your ATProto labeler from your terminal
59 lines (58 loc) • 2.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.initializeRecordTable = exports.initializeRepoTable = exports.initializeSubjectTable = void 0;
const initializeSubjectTable = async (db) => {
await db.schema
.createTable("subjects")
.ifNotExists()
.addColumn("id", "integer", (col) => col.primaryKey().notNull())
.addColumn("reviewState", "text", (col) => col.notNull())
.addColumn("createdAt", "text", (col) => col.notNull())
.addColumn("updatedAt", "text", (col) => col.notNull())
.addColumn("lastReportedAt", "text")
.addColumn("lastReviewedBy", "text")
.addColumn("lastReviewedAt", "text")
.addColumn("takendown", "integer", (col) => col.notNull().defaultTo(0))
.addColumn("subjectRepoHandle", "text")
.addColumn("subjectBlobCids", "text")
.addColumn("tags", "text")
.addColumn("did", "text", (col) => col.notNull())
.addColumn("recordPath", "text", (col) => col.notNull().defaultTo(""))
.addColumn("lastAppealedAt", "text")
.addColumn("suspendUntil", "text")
.addColumn("muteUntil", "text")
.addColumn("muteReportingUntil", "text")
.addColumn("comment", "text")
.execute();
};
exports.initializeSubjectTable = initializeSubjectTable;
const initializeRepoTable = async (db) => {
await db.schema
.createTable("repos")
.ifNotExists()
.addColumn("did", "text", (col) => col.primaryKey().notNull())
.addColumn("handle", "text", (col) => col.notNull())
.addColumn("ip", "text", (col) => col.notNull())
.addColumn("profile", "jsonb")
.addColumn("indexedAt", "text", (col) => col.notNull())
.addColumn("email", "text", (col) => col.notNull())
.addColumn("emailConfirmedAt", "text")
.addColumn("threatSignatures", "text")
.addColumn("labels", "jsonb")
.execute();
};
exports.initializeRepoTable = initializeRepoTable;
const initializeRecordTable = async (db) => {
await db.schema
.createTable("records")
.ifNotExists()
.addColumn("uri", "text", (col) => col.primaryKey().notNull())
.addColumn("cid", "text", (col) => col.notNull())
.addColumn("value", "jsonb", (col) => col.notNull())
.addColumn("blobCids", "jsonb", (col) => col.notNull())
.addColumn("indexedAt", "text", (col) => col.notNull())
.addColumn("blobs", "jsonb", (col) => col.notNull())
.addColumn("labels", "jsonb", (col) => col.notNull())
.execute();
};
exports.initializeRecordTable = initializeRecordTable;