feat: update user_documents table to allow nullable object_storage_id and add signatureBase64 column
This commit is contained in:
parent
edeacea8ea
commit
d7fd62d6b4
@ -271,7 +271,8 @@ async function createDatabase() {
|
|||||||
user_id INT NOT NULL,
|
user_id INT NOT NULL,
|
||||||
document_type ENUM('personal_id', 'company_id', 'signature', 'contract', 'other') NOT NULL,
|
document_type ENUM('personal_id', 'company_id', 'signature', 'contract', 'other') NOT NULL,
|
||||||
contract_type ENUM('contract','gdpr') NOT NULL DEFAULT 'contract',
|
contract_type ENUM('contract','gdpr') NOT NULL DEFAULT 'contract',
|
||||||
object_storage_id VARCHAR(255) UNIQUE NOT NULL,
|
object_storage_id VARCHAR(255) UNIQUE NULL,
|
||||||
|
signatureBase64 LONGTEXT NULL,
|
||||||
original_filename VARCHAR(255),
|
original_filename VARCHAR(255),
|
||||||
file_size INT,
|
file_size INT,
|
||||||
mime_type VARCHAR(100),
|
mime_type VARCHAR(100),
|
||||||
@ -292,6 +293,14 @@ async function createDatabase() {
|
|||||||
await connection.query(`
|
await connection.query(`
|
||||||
CREATE INDEX IF NOT EXISTS idx_user_contract_type ON user_documents (user_id, contract_type);
|
CREATE INDEX IF NOT EXISTS idx_user_contract_type ON user_documents (user_id, contract_type);
|
||||||
`);
|
`);
|
||||||
|
await connection.query(`
|
||||||
|
ALTER TABLE user_documents
|
||||||
|
MODIFY COLUMN object_storage_id VARCHAR(255) NULL;
|
||||||
|
`);
|
||||||
|
await connection.query(`
|
||||||
|
ALTER TABLE user_documents
|
||||||
|
ADD COLUMN IF NOT EXISTS signatureBase64 LONGTEXT NULL AFTER object_storage_id;
|
||||||
|
`);
|
||||||
console.log('✅ User documents table created/verified');
|
console.log('✅ User documents table created/verified');
|
||||||
|
|
||||||
// 8c. document_templates table: Stores template metadata and object storage keys
|
// 8c. document_templates table: Stores template metadata and object storage keys
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user