diff --git a/.changeset/eight-eels-compete.md b/.changeset/eight-eels-compete.md new file mode 100644 index 0000000000..5cd0cdf041 --- /dev/null +++ b/.changeset/eight-eels-compete.md @@ -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. diff --git a/plugins/bazaar-backend/migrations/20211014144054_init.js b/plugins/bazaar-backend/migrations/20211014144054_init.js index 5bf66698ac..503812225d 100644 --- a/plugins/bazaar-backend/migrations/20211014144054_init.js +++ b/plugins/bazaar-backend/migrations/20211014144054_init.js @@ -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'); diff --git a/plugins/bazaar-backend/migrations/20211020073922_add_columns.js b/plugins/bazaar-backend/migrations/20211020073922_add_columns.js index ea3a89ea72..740eacb407 100644 --- a/plugins/bazaar-backend/migrations/20211020073922_add_columns.js +++ b/plugins/bazaar-backend/migrations/20211020073922_add_columns.js @@ -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 diff --git a/plugins/bazaar-backend/migrations/20211117092217_optional_entity_ref.js b/plugins/bazaar-backend/migrations/20211117092217_optional_entity_ref.js index 9dd8097ae2..0953d5c2b1 100644 --- a/plugins/bazaar-backend/migrations/20211117092217_optional_entity_ref.js +++ b/plugins/bazaar-backend/migrations/20211117092217_optional_entity_ref.js @@ -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'); diff --git a/plugins/bazaar-backend/migrations/20220817150443_add_member_entity_ref.js b/plugins/bazaar-backend/migrations/20220817150443_add_member_entity_ref.js index 79b80ef20c..c7ac0ccf2c 100644 --- a/plugins/bazaar-backend/migrations/20220817150443_add_member_entity_ref.js +++ b/plugins/bazaar-backend/migrations/20220817150443_add_member_entity_ref.js @@ -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'); diff --git a/plugins/bazaar-backend/migrations/20221121120212_rename_col_to_title.js b/plugins/bazaar-backend/migrations/20221121120212_rename_col_to_title.js index 9974c9eb20..93de567f93 100644 --- a/plugins/bazaar-backend/migrations/20221121120212_rename_col_to_title.js +++ b/plugins/bazaar-backend/migrations/20221121120212_rename_col_to_title.js @@ -14,9 +14,10 @@ * limitations under the License. */ +// @ts-check + /** - * @param { import("knex").Knex } knex - * @returns { Promise } + * @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 } + * @param {import('knex').Knex} knex */ exports.down = async function down(knex) { await knex.schema.alterTable('metadata', table => { diff --git a/plugins/catalog-backend-module-incremental-ingestion/migrations/20221116073152_init.js b/plugins/catalog-backend-module-incremental-ingestion/migrations/20221116073152_init.js index dc77e0bc31..09b6af9004 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/migrations/20221116073152_init.js +++ b/plugins/catalog-backend-module-incremental-ingestion/migrations/20221116073152_init.js @@ -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'); }); }; diff --git a/plugins/catalog-backend/migrations/20200511113813_init.js b/plugins/catalog-backend/migrations/20200511113813_init.js index a34912135e..710ff537e0 100644 --- a/plugins/catalog-backend/migrations/20200511113813_init.js +++ b/plugins/catalog-backend/migrations/20200511113813_init.js @@ -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') diff --git a/plugins/catalog-backend/migrations/20220616202842_refresh_keys.js b/plugins/catalog-backend/migrations/20220616202842_refresh_keys.js index ddc39d4005..a7ec819489 100644 --- a/plugins/catalog-backend/migrations/20220616202842_refresh_keys.js +++ b/plugins/catalog-backend/migrations/20220616202842_refresh_keys.js @@ -14,6 +14,8 @@ * limitations under the License. */ +// @ts-check + /** * @param { import("knex").Knex } knex */ diff --git a/plugins/catalog-backend/migrations/20221109192547_search_add_original_value_column.js b/plugins/catalog-backend/migrations/20221109192547_search_add_original_value_column.js index 258af5ef06..fff7955530 100644 --- a/plugins/catalog-backend/migrations/20221109192547_search_add_original_value_column.js +++ b/plugins/catalog-backend/migrations/20221109192547_search_add_original_value_column.js @@ -14,6 +14,8 @@ * limitations under the License. */ +// @ts-check + /** * @param { import("knex").Knex } knex */ diff --git a/plugins/playlist-backend/migrations/20220701011329_init.js b/plugins/playlist-backend/migrations/20220701011329_init.js index be08363dec..fea6b52700 100644 --- a/plugins/playlist-backend/migrations/20220701011329_init.js +++ b/plugins/playlist-backend/migrations/20220701011329_init.js @@ -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'); diff --git a/plugins/search-backend-module-pg/migrations/20210311110000_init.js b/plugins/search-backend-module-pg/migrations/20210311110000_init.js index 70ccf9406b..e3bbca41e3 100644 --- a/plugins/search-backend-module-pg/migrations/20210311110000_init.js +++ b/plugins/search-backend-module-pg/migrations/20210311110000_init.js @@ -14,6 +14,8 @@ * limitations under the License. */ +// @ts-check + /** * @param {import('knex').Knex} knex */ diff --git a/plugins/search-backend-module-pg/migrations/20210727180000_delta_update.js b/plugins/search-backend-module-pg/migrations/20210727180000_delta_update.js index 429c8aa805..2a449b5fa4 100644 --- a/plugins/search-backend-module-pg/migrations/20210727180000_delta_update.js +++ b/plugins/search-backend-module-pg/migrations/20210727180000_delta_update.js @@ -14,6 +14,8 @@ * limitations under the License. */ +// @ts-check + /** * @param {import('knex').Knex} knex */ diff --git a/plugins/user-settings-backend/migrations/20220824183000_init.js b/plugins/user-settings-backend/migrations/20220824183000_init.js index a519969a98..0e99a76f93 100644 --- a/plugins/user-settings-backend/migrations/20220824183000_init.js +++ b/plugins/user-settings-backend/migrations/20220824183000_init.js @@ -14,6 +14,8 @@ * limitations under the License. */ +// @ts-check + /** * @param {import('knex').Knex} knex */