Sync dependency versions and apply formatting to migrations

Signed-off-by: Damon Kaswell <damon.kaswell1@hp.com>
This commit is contained in:
Damon Kaswell
2022-10-27 11:04:22 -07:00
committed by Fredrik Adelöw
parent 484be3318e
commit 9087451fb1
5 changed files with 127 additions and 1390 deletions
@@ -14,7 +14,10 @@
* limitations under the License.
*/
exports.up = async function (knex) {
/**
* @param { import("knex").Knex } knex
*/
exports.up = async function up(knex) {
await knex.raw(`
CREATE VIEW ingestion.current_entities as SELECT
FORMAT('%s:%s/%s',
@@ -30,77 +33,114 @@ CREATE VIEW ingestion.current_entities as SELECT
await schema().createTable('ingestions', table => {
table.comment('Tracks ingestion streams for very large data sets');
table.uuid('id', { primary: true }).notNullable().comment('Auto-generated ID of the ingestion');
table
.uuid('id', { primary: true })
.notNullable()
.comment('Auto-generated ID of the ingestion');
table.string('provider_name').notNullable().comment('each provider gets its own identifiable name');
table
.string('provider_name')
.notNullable()
.comment('each provider gets its own identifiable name');
table
.string('status')
.notNullable()
.comment('One of "interstitial" | "bursting" | "backing off" | "resting" | "complete"');
.comment(
'One of "interstitial" | "bursting" | "backing off" | "resting" | "complete"',
);
table.string('next_action').notNullable().comment("what will this, 'ingest', 'rest', 'backoff', 'nothing (done)'");
table
.string('next_action')
.notNullable()
.comment("what will this, 'ingest', 'rest', 'backoff', 'nothing (done)'");
table
.timestamp('next_action_at')
.defaultTo(knex.fn.now())
.comment('the moment in time at which point ingestion can begin again');
table.string('last_error').comment('records any error that occured in the previous burst attempt');
table
.string('last_error')
.comment('records any error that occured in the previous burst attempt');
table.integer('attempts').defaultTo(0).comment('how many attempts have been made to burst without success');
table
.integer('attempts')
.defaultTo(0)
.comment('how many attempts have been made to burst without success');
table.timestamp('created_at').defaultTo(knex.fn.now()).comment('when did this ingestion actually begin');
table
.timestamp('created_at')
.defaultTo(knex.fn.now())
.comment('when did this ingestion actually begin');
table.timestamp('ingestion_completed_at').comment('when did the ingestion actually end');
table
.timestamp('ingestion_completed_at')
.comment('when did the ingestion actually end');
table.timestamp('rest_completed_at').comment('when did the rest period actually end');
table
.timestamp('rest_completed_at')
.comment('when did the rest period actually end');
});
await schema().createTable('ingestion_marks', table => {
table.comment('tracks each step of an iterative ingestion');
table.uuid('id', { primary: true }).notNullable().comment('Auto-generated ID of the ingestion mark');
table
.uuid('id', { primary: true })
.notNullable()
.comment('Auto-generated ID of the ingestion mark');
table.uuid('ingestion_id').notNullable().comment('The id of the ingestion in which this mark took place');
// table
// .foreign('ingestion_id').references('ingestions.id');
table
.uuid('ingestion_id')
.notNullable()
.comment('The id of the ingestion in which this mark took place');
table
.json('cursor')
.comment('the current data associated with this iteration wherever it is in this moment in time');
.comment(
'the current data associated with this iteration wherever it is in this moment in time',
);
table.integer('sequence').defaultTo(0).comment('what is the order of this mark');
table
.integer('sequence')
.defaultTo(0)
.comment('what is the order of this mark');
table.timestamp('created_at').defaultTo(knex.fn.now());
});
await schema().createTable('ingestion_mark_entities', table => {
table.comment('tracks the entities recorded in each step of an iterative ingestion');
table.comment(
'tracks the entities recorded in each step of an iterative ingestion',
);
table.uuid('id', { primary: true }).notNullable().comment('Auto-generated ID of the marked entity');
table
.uuid('id', { primary: true })
.notNullable()
.comment('Auto-generated ID of the marked entity');
table
.uuid('ingestion_mark_id')
.notNullable()
.comment('Every time a mark happens during an ingestion, there are a list of entities marked.');
.comment(
'Every time a mark happens during an ingestion, there are a list of entities marked.',
);
// table
// .foreign('ingestion_mark_id').references('ingestion_marks.id');
table.string('ref').notNullable().comment('the entity reference of the marked entity');
table
.string('ref')
.notNullable()
.comment('the entity reference of the marked entity');
});
};
exports.down = async function (knex) {
/**
* @param { import("knex").Knex } knex
*/
exports.down = async function down(knex) {
const schema = () => knex.schema.withSchema('ingestion');
await schema().dropView('current_entities');
await schema().dropTable('ingestion_mark_entities');
await schema().dropTable('ingestion_marks');
await schema().dropTable('ingestions');
};
@@ -15,10 +15,9 @@
*/
/**
* @param { import('knex').Knex } knex
* @returns { Promise<void> }
* @param { import("knex").Knex } knex
*/
exports.up = async function (knex) {
exports.up = async function up(knex) {
const schema = () => knex.schema.withSchema('ingestion');
await knex.raw(
@@ -45,9 +44,8 @@ exports.up = async function (knex) {
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = async function (knex) {
exports.down = async function down(knex) {
const schema = () => knex.schema.withSchema('ingestion');
await schema().alterTable('ingestions', t => {
@@ -61,7 +59,10 @@ exports.down = async function (knex) {
});
await schema().alterTable('ingestions_mark_entities', t => {
t.dropIndex('ingestion_mark_id', 'ingestion_mark_entity_ingestion_mark_id_idx');
t.dropIndex(
'ingestion_mark_id',
'ingestion_mark_entity_ingestion_mark_id_idx',
);
t.dropPrimary('id');
});
@@ -18,9 +18,8 @@ const { v4: uuidv4 } = require('uuid');
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = async function (knex) {
exports.up = async function up(knex) {
const schema = () => knex.schema.withSchema('ingestion');
await knex.transaction(async tx => {
@@ -75,9 +74,8 @@ exports.up = async function (knex) {
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = async function (knex) {
exports.down = async function down(knex) {
const schema = () => knex.schema.withSchema('ingestion');
await schema().alterTable('ingestions', t => {
@@ -35,7 +35,7 @@
},
"devDependencies": {
"@backstage/cli": "workspace:^",
"@types/express": "*"
"@types/express": "^4.17.6"
},
"files": [
"dist",
+48 -1350
View File
File diff suppressed because it is too large Load Diff