Skip to content

Commit

Permalink
added source missing field
Browse files Browse the repository at this point in the history
  • Loading branch information
kalebheitzman committed Jan 29, 2024
1 parent a8f1ffe commit 2135c60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@
</TABLE>
<TABLE NAME="filter_autotranslate_jobs" COMMENT="Autotranslate jobs">
<FIELDS>
<FIELD NAME="id" SEQUENCE="true" TYPE="int" NOTNULL="true" />
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="hash" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="lang" TYPE="char" LENGTH="30" NOTNULL="true" DEFAULT="en" SEQUENCE="false"/>
<FIELD NAME="fetched" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" />
<FIELD NAME="source_missing" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
</KEYS>
<INDEXES>
<INDEX NAME="lang_index" UNIQUE="false" FIELDS="lang" COMMENT="Translation language index"/>
<INDEX NAME="hash_index" UNIQUE="false" FIELDS="hash" COMMENT="Translation hash index" />
<INDEX NAME="source_missing_index" UNIQUE="false" FIELDS="source_missing" COMMENT="Translation source_missing index" />
</INDEXES>
</TABLE>
<TABLE NAME="filter_autotranslate_ids" COMMENT="Autotranslate index by content ids">
<FIELDS>
<FIELD NAME="id" SEQUENCE="true" TYPE="int" NOTNULL="true" />
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="hash" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="lang" TYPE="char" LENGTH="30" NOTNULL="true" DEFAULT="en" SEQUENCE="false"/>
<FIELD NAME="context_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
Expand Down
4 changes: 4 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function xmldb_filter_autotranslate_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();

// create initial table
if ($oldversion < 2024011900) {

// Define table filter_autotranslate to be created.
Expand Down Expand Up @@ -64,6 +65,7 @@ function xmldb_filter_autotranslate_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2024011900, 'filter', 'autotranslate');
}

// create jobs and context id tables
if ($oldversion < 2024012900) {
// Define table filter_autotranslate_jobs to be created.
$filter_autotranslate_jobs_table = new xmldb_table('filter_autotranslate_jobs');
Expand All @@ -73,13 +75,15 @@ function xmldb_filter_autotranslate_upgrade($oldversion) {
$filter_autotranslate_jobs_table->add_field('hash', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null);
$filter_autotranslate_jobs_table->add_field('lang', XMLDB_TYPE_CHAR, '2', null, XMLDB_NOTNULL, null, null);
$filter_autotranslate_jobs_table->add_field('fetched', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null);
$filter_autotranslate_jobs_table->add_field('source_missing', XMLDB_TYPE_INTEGER, '1', null, null, null, null);

// Add keys to filter_autotranslate.
$filter_autotranslate_jobs_table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);

// Add indexes to filter_autotranslate.
$filter_autotranslate_jobs_table->add_index('hash_index', XMLDB_INDEX_NOTUNIQUE, ['hash']);
$filter_autotranslate_jobs_table->add_index('lang_index', XMLDB_INDEX_NOTUNIQUE, ['lang']);
$filter_autotranslate_jobs_table->add_index('source_missing_index', XMLDB_INDEX_NOTUNIQUE, ['source_missing']);

// Conditionally launch create table for filter_autotranslate.
if (!$dbman->table_exists($filter_autotranslate_jobs_table)) {
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024012903; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024012906; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2021051700; // Requires this Moodle version.
$plugin->component = 'filter_autotranslate'; // Full name of the plugin (used for diagnostics).
$plugin->release = '1.0.0';
Expand Down

0 comments on commit 2135c60

Please sign in to comment.