initial commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
//
|
||||
// M8 — Quote Viewed-At Timestamp.
|
||||
//
|
||||
// Adds a `viewedAt` text field to the `quotes` collection so the front-end
|
||||
// can record the first time a customer opens the public approval link.
|
||||
//
|
||||
migrate(
|
||||
(db) => {
|
||||
const quotes = db.findCollectionByNameOrId('quotes');
|
||||
if (!quotes) {
|
||||
console.warn('[M8] quotes collection not found — skipping');
|
||||
return;
|
||||
}
|
||||
if (!quotes.fields.find((f) => f.name === 'viewedAt')) {
|
||||
quotes.fields.push(new TextField({ name: 'viewedAt', required: false }));
|
||||
console.log('[M8] added viewedAt field to quotes');
|
||||
}
|
||||
db.save(quotes);
|
||||
},
|
||||
(db) => {
|
||||
const quotes = db.findCollectionByNameOrId('quotes');
|
||||
if (!quotes) return;
|
||||
const idx = quotes.fields.findIndex((f) => f.name === 'viewedAt');
|
||||
if (idx >= 0) {
|
||||
quotes.fields.splice(idx, 1);
|
||||
db.save(quotes);
|
||||
console.log('[M8] removed viewedAt from quotes');
|
||||
}
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user