mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00:00
db: add protected flag to app and subdomain
This commit is contained in:
parent
360ad2e252
commit
56e527d3ee
@ -117,6 +117,9 @@ module.exports = {
|
|||||||
to: 'app',
|
to: 'app',
|
||||||
sql: { use_id: true },
|
sql: { use_id: true },
|
||||||
},
|
},
|
||||||
|
protected: {
|
||||||
|
type: 'flag',
|
||||||
|
},
|
||||||
|
|
||||||
// OPERATIONS
|
// OPERATIONS
|
||||||
last_review: {
|
last_review: {
|
||||||
|
@ -94,6 +94,9 @@ module.exports = {
|
|||||||
to: 'app',
|
to: 'app',
|
||||||
sql: { use_id: true },
|
sql: { use_id: true },
|
||||||
},
|
},
|
||||||
|
protected: {
|
||||||
|
type: 'flag',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
|||||||
this.db = new Database(this.config.path);
|
this.db = new Database(this.config.path);
|
||||||
|
|
||||||
// Database upgrade logic
|
// Database upgrade logic
|
||||||
const TARGET_VERSION = 10;
|
const TARGET_VERSION = 11;
|
||||||
|
|
||||||
if ( do_setup ) {
|
if ( do_setup ) {
|
||||||
this.log.noticeme(`SETUP: creating database at ${this.config.path}`);
|
this.log.noticeme(`SETUP: creating database at ${this.config.path}`);
|
||||||
@ -59,6 +59,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
|||||||
'0010_add-git-app.sql',
|
'0010_add-git-app.sql',
|
||||||
'0011_notification.sql',
|
'0011_notification.sql',
|
||||||
'0012_appmetadata.sql',
|
'0012_appmetadata.sql',
|
||||||
|
'0013_protected-apps.sql',
|
||||||
].map(p => path_.join(__dirname, 'sqlite_setup', p));
|
].map(p => path_.join(__dirname, 'sqlite_setup', p));
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
for ( const filename of sql_files ) {
|
for ( const filename of sql_files ) {
|
||||||
@ -115,6 +116,10 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
|||||||
upgrade_files.push('0012_appmetadata.sql');
|
upgrade_files.push('0012_appmetadata.sql');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( user_version <= 10 ) {
|
||||||
|
upgrade_files.push('0013_protected-apps.sql');
|
||||||
|
}
|
||||||
|
|
||||||
if ( upgrade_files.length > 0 ) {
|
if ( upgrade_files.length > 0 ) {
|
||||||
this.log.noticeme(`Database out of date: ${this.config.path}`);
|
this.log.noticeme(`Database out of date: ${this.config.path}`);
|
||||||
this.log.noticeme(`UPGRADING DATABASE: ${user_version} -> ${TARGET_VERSION}`);
|
this.log.noticeme(`UPGRADING DATABASE: ${user_version} -> ${TARGET_VERSION}`);
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE apps ADD COLUMN "protected" tinyint(1) DEFAULT '0';
|
||||||
|
ALTER TABLE subdomains ADD COLUMN "protected" tinyint(1) DEFAULT '0';
|
Loading…
Reference in New Issue
Block a user