Skip to content

Commit ed13dfc

Browse files
authored
Merge pull request #4084 from LiteFarmOrg/integration
Release 3.10.1
2 parents 064b20e + 1fe8fad commit ed13dfc

File tree

41 files changed

+2164
-5157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2164
-5157
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2026 LiteFarm.org
3+
* This file is part of LiteFarm.
4+
*
5+
* LiteFarm is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* LiteFarm is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details, see <https://www.gnu.org/licenses/>.
14+
*/
15+
16+
/**
17+
* @param { import("knex").Knex } knex
18+
* @returns { Promise<void> }
19+
*/
20+
export const up = async function (knex) {
21+
await knex.schema.createTable('tape_survey', function (table) {
22+
table.increments('id').primary();
23+
table.uuid('submission_id').notNullable().defaultTo(knex.raw('uuid_generate_v4()'));
24+
table.uuid('farm_id').notNullable().references('farm_id').inTable('farm');
25+
table.string('survey_version').notNullable();
26+
table.string('project_id').notNullable();
27+
table.string('survey_step').notNullable();
28+
table.jsonb('survey_response').notNullable();
29+
table
30+
.string('created_by_user_id')
31+
.notNullable()
32+
.references('user_id')
33+
.inTable('users')
34+
.defaultTo(1);
35+
table.dateTime('created_at').notNullable().defaultTo(new Date('2000/1/1').toISOString());
36+
});
37+
38+
await knex('permissions').insert([
39+
{ permission_id: 185, name: 'add:tape_survey', description: 'add tape_survey' },
40+
{ permission_id: 186, name: 'get:tape_survey', description: 'get tape_survey' },
41+
{ permission_id: 187, name: 'edit:tape_survey', description: 'edit tape_survey' },
42+
]);
43+
await knex('rolePermissions').insert([
44+
{ role_id: 1, permission_id: 185 },
45+
{ role_id: 2, permission_id: 185 },
46+
{ role_id: 5, permission_id: 185 },
47+
{ role_id: 1, permission_id: 186 },
48+
{ role_id: 2, permission_id: 186 },
49+
{ role_id: 5, permission_id: 186 },
50+
{ role_id: 1, permission_id: 187 },
51+
{ role_id: 2, permission_id: 187 },
52+
{ role_id: 5, permission_id: 187 },
53+
]);
54+
};
55+
56+
/**
57+
* @param { import("knex").Knex } knex
58+
* @returns { Promise<void> }
59+
*/
60+
export const down = async function (knex) {
61+
await knex.schema.dropTable('tape_survey');
62+
await knex('rolePermissions').whereIn('permission_id', [185, 186, 187]).del();
63+
await knex('permissions').whereIn('permission_id', [185, 186, 187]).del();
64+
};

0 commit comments

Comments
 (0)