-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy path20260317000001_add_farm_notes_read.js
More file actions
35 lines (33 loc) · 1.21 KB
/
Copy path20260317000001_add_farm_notes_read.js
File metadata and controls
35 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright 2026 LiteFarm.org
* This file is part of LiteFarm.
*
* LiteFarm is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiteFarm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details, see <https://www.gnu.org/licenses/>.
*/
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export const up = async function (knex) {
await knex.schema.createTable('farm_notes_read', (table) => {
table.string('user_id').notNullable().references('user_id').inTable('users');
table.uuid('farm_id').notNullable().references('farm_id').inTable('farm');
table.dateTime('last_read_at').notNullable();
table.primary(['user_id', 'farm_id']);
});
};
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export const down = async function (knex) {
await knex.schema.dropTable('farm_notes_read');
};