Merge pull request #10341 from backstage/freben/cherry-blossom-auth-backend
Apply #10338
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-auth-backend': patch
|
||||
---
|
||||
|
||||
Applied the fix from version 0.12.3 of this package, which is part of the v1.0.1 release of Backstage.
|
||||
@@ -1,5 +1,13 @@
|
||||
# @backstage/plugin-auth-backend
|
||||
|
||||
## 0.12.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix migrations to do the right thing on sqlite databases, and reapply the column type fix for those who are _not_ on sqlite databases.
|
||||
|
||||
Reconstruction of #10317 in the form of a patch release instead.
|
||||
|
||||
## 0.12.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
exports.up = async function up(knex) {
|
||||
// Sqlite does not support alter column.
|
||||
if (knex.client.config.client.includes('sqlite3')) {
|
||||
if (!knex.client.config.client.includes('sqlite3')) {
|
||||
await knex.schema.alterTable('signing_keys', table => {
|
||||
table
|
||||
.timestamp('created_at', { useTz: true, precision: 0 })
|
||||
@@ -38,7 +38,7 @@ exports.up = async function up(knex) {
|
||||
*/
|
||||
exports.down = async function down(knex) {
|
||||
// Sqlite does not support alter column.
|
||||
if (knex.client.config.client.includes('sqlite3')) {
|
||||
if (!knex.client.config.client.includes('sqlite3')) {
|
||||
await knex.schema.alterTable('signing_keys', table => {
|
||||
table
|
||||
.timestamp('created_at', { useTz: false, precision: 0 })
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
// NOTE: This may look like a plain duplicate of the previous one, but that
|
||||
// file had a bug added when improving sqlite driver support:
|
||||
// https://github.com/backstage/backstage/pull/10053/files#diff-30bb343265e71ca2f1cdcccd5ac8fdbb2a597507c5531bf26945059783377b15R24
|
||||
// Since the old file was released to end users, those who created a new
|
||||
// Backstage app specifically for PostgreSQL since the release will be missing
|
||||
// this fix on their table. So we re-apply it.
|
||||
|
||||
/**
|
||||
* @param {import('knex').Knex} knex
|
||||
*/
|
||||
exports.up = async function up(knex) {
|
||||
// Sqlite does not support alter column.
|
||||
if (!knex.client.config.client.includes('sqlite3')) {
|
||||
await knex.schema.alterTable('signing_keys', table => {
|
||||
table
|
||||
.timestamp('created_at', { useTz: true, precision: 0 })
|
||||
.notNullable()
|
||||
.defaultTo(knex.fn.now())
|
||||
.comment('The creation time of the key')
|
||||
.alter({ alterType: true });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {import('knex').Knex} knex
|
||||
*/
|
||||
exports.down = async function down(knex) {
|
||||
// Sqlite does not support alter column.
|
||||
if (!knex.client.config.client.includes('sqlite3')) {
|
||||
await knex.schema.alterTable('signing_keys', table => {
|
||||
table
|
||||
.timestamp('created_at', { useTz: false, precision: 0 })
|
||||
.notNullable()
|
||||
.defaultTo(knex.fn.now())
|
||||
.comment('The creation time of the key')
|
||||
.alter({ alterType: true });
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user