mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-23 06:00:21 +08:00
fix: column nullability blunder
This commit is contained in:
parent
b10302ad74
commit
1429d6f57c
@ -42,7 +42,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
||||
this.db = new Database(this.config.path);
|
||||
|
||||
// Database upgrade logic
|
||||
const TARGET_VERSION = 15;
|
||||
const TARGET_VERSION = 16;
|
||||
|
||||
if ( do_setup ) {
|
||||
this.log.noticeme(`SETUP: creating database at ${this.config.path}`);
|
||||
@ -64,6 +64,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
||||
'0015_group.sql',
|
||||
'0016_group-permissions.sql',
|
||||
'0017_publicdirs.sql',
|
||||
'0018_fix-0003.sql',
|
||||
].map(p => path_.join(__dirname, 'sqlite_setup', p));
|
||||
const fs = require('fs');
|
||||
for ( const filename of sql_files ) {
|
||||
@ -140,6 +141,10 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
||||
upgrade_files.push('0017_publicdirs.sql');
|
||||
}
|
||||
|
||||
if ( user_version <= 15 ) {
|
||||
upgrade_files.push('0018_fix-0003.sql');
|
||||
}
|
||||
|
||||
if ( upgrade_files.length > 0 ) {
|
||||
this.log.noticeme(`Database out of date: ${this.config.path}`);
|
||||
this.log.noticeme(`UPGRADING DATABASE: ${user_version} -> ${TARGET_VERSION}`);
|
||||
|
@ -0,0 +1,40 @@
|
||||
CREATE TABLE `audit_user_to_user_permissions_new` (
|
||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
||||
"issuer_user_id" INTEGER DEFAULT NULL,
|
||||
"issuer_user_id_keep" INTEGER DEFAULT NULL,
|
||||
|
||||
"holder_user_id" INTEGER DEFAULT NULL,
|
||||
"holder_user_id_keep" INTEGER DEFAULT NULL,
|
||||
|
||||
"permission" TEXT NOT NULL,
|
||||
"extra" JSON DEFAULT NULL,
|
||||
|
||||
"action" TEXT DEFAULT NULL,
|
||||
"reason" TEXT DEFAULT NULL,
|
||||
|
||||
"created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
FOREIGN KEY("issuer_user_id") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
FOREIGN KEY("holder_user_id") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
INSERT INTO `audit_user_to_user_permissions_new`
|
||||
(
|
||||
`id`,
|
||||
`issuer_user_id`, `issuer_user_id_keep`,
|
||||
`holder_user_id`, `holder_user_id_keep`,
|
||||
`permission`, `extra`, `action`, `reason`,
|
||||
`created_at`
|
||||
)
|
||||
SELECT
|
||||
`id`,
|
||||
`issuer_user_id`, `issuer_user_id_keep`,
|
||||
`holder_user_id`, `holder_user_id_keep`,
|
||||
`permission`, `extra`, `action`, `reason`,
|
||||
`created_at`
|
||||
FROM `audit_user_to_user_permissions`;
|
||||
DROP TABLE `audit_user_to_user_permissions`;
|
||||
|
||||
ALTER TABLE `audit_user_to_user_permissions_new`
|
||||
RENAME TO `audit_user_to_user_permissions`;
|
Loading…
Reference in New Issue
Block a user