ts-check all migration files

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-12-03 16:21:54 +01:00
parent 7c65d54a35
commit c507aee8a2
14 changed files with 73 additions and 11 deletions
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/plugin-bazaar-backend': patch
'@backstage/plugin-catalog-backend': patch
'@backstage/plugin-catalog-backend-module-incremental-ingestion': patch
'@backstage/plugin-playlist-backend': patch
'@backstage/plugin-search-backend-module-pg': patch
'@backstage/plugin-user-settings-backend': patch
---
Ensured typescript type checks in migration files.
@@ -14,6 +14,11 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.createTable('metadata', table => {
table.comment('The table of Bazaar metadata');
@@ -59,6 +64,9 @@ exports.up = async function up(knex) {
});
};
/**
* @param {import('knex').Knex} knex
*/
exports.down = async function down(knex) {
await knex.schema.dropTable('metadata');
await knex.schema.dropTable('members');
@@ -14,6 +14,11 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.alterTable('metadata', table => {
table
@@ -35,6 +40,9 @@ exports.up = async function up(knex) {
});
};
/**
* @param {import('knex').Knex} knex
*/
exports.down = async function down(knex) {
await knex.schema.alterTable('metadata', table => {
table
@@ -14,6 +14,11 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
if (knex.client.config.client.includes('sqlite3')) {
await knex.schema.dropTable('metadata');
@@ -92,6 +97,9 @@ exports.up = async function up(knex) {
}
};
/**
* @param {import('knex').Knex} knex
*/
exports.down = async function down(knex) {
if (knex.client.config.client.includes('sqlite3')) {
await knex.schema.dropTable('metadata');
@@ -14,12 +14,20 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.alterTable('members', table => {
table.string('user_ref').nullable();
});
};
/**
* @param {import('knex').Knex} knex
*/
exports.down = async function down(knex) {
return knex.schema.table('members', table => {
table.dropColumn('user_ref');
@@ -14,9 +14,10 @@
* limitations under the License.
*/
// @ts-check
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.alterTable('metadata', table => {
@@ -25,8 +26,7 @@ exports.up = async function up(knex) {
};
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
* @param {import('knex').Knex} knex
*/
exports.down = async function down(knex) {
await knex.schema.alterTable('metadata', table => {
@@ -14,6 +14,8 @@
* limitations under the License.
*/
// @ts-check
/**
* @param { import("knex").Knex } knex
*/
@@ -25,7 +27,7 @@ exports.up = async function up(knex) {
table.comment('Tracks ingestion streams for very large data sets');
table
.uuid('id', { primary: true })
.uuid('id')
.notNullable()
.comment('Auto-generated ID of the ingestion');
@@ -85,7 +87,7 @@ exports.up = async function up(knex) {
});
await knex.schema.alterTable('ingestions', t => {
t.primary('id');
t.primary(['id']);
t.index('provider_name', 'ingestion_provider_name_idx');
t.unique(['provider_name', 'completion_ticket'], {
indexName: 'ingestion_composite_index',
@@ -100,7 +102,7 @@ exports.up = async function up(knex) {
table.comment('tracks each step of an iterative ingestion');
table
.uuid('id', { primary: true })
.uuid('id')
.notNullable()
.comment('Auto-generated ID of the ingestion mark');
@@ -128,7 +130,7 @@ exports.up = async function up(knex) {
});
await knex.schema.alterTable('ingestion_marks', t => {
t.primary('id');
t.primary(['id']);
t.index('ingestion_id', 'ingestion_mark_ingestion_id_idx');
});
@@ -141,7 +143,7 @@ exports.up = async function up(knex) {
);
table
.uuid('id', { primary: true })
.uuid('id')
.notNullable()
.comment('Auto-generated ID of the marked entity');
@@ -162,7 +164,7 @@ exports.up = async function up(knex) {
});
await knex.schema.alterTable('ingestion_mark_entities', t => {
t.primary('id');
t.primary(['id']);
t.index('ingestion_mark_id', 'ingestion_mark_entity_ingestion_mark_id_idx');
});
};
@@ -27,7 +27,7 @@ exports.up = async function up(knex) {
//
.createTable('locations', table => {
table.comment(
'Registered locations that shall be contiuously scanned for catalog item updates',
'Registered locations that shall be continuously scanned for catalog item updates',
);
table
.uuid('id')
@@ -14,6 +14,8 @@
* limitations under the License.
*/
// @ts-check
/**
* @param { import("knex").Knex } knex
*/
@@ -14,6 +14,8 @@
* limitations under the License.
*/
// @ts-check
/**
* @param { import("knex").Knex } knex
*/
@@ -14,6 +14,11 @@
* limitations under the License.
*/
// @ts-check
/**
* @param { import("knex").Knex } knex
*/
exports.up = async function up(knex) {
await knex.schema.createTable('playlists', table => {
table.comment('Playlists table');
@@ -57,6 +62,9 @@ exports.up = async function up(knex) {
});
};
/**
* @param { import("knex").Knex } knex
*/
exports.down = async function down(knex) {
await knex.schema.dropTable('playlists');
await knex.schema.dropTable('entities');
@@ -14,6 +14,8 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
@@ -14,6 +14,8 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
@@ -14,6 +14,8 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/