diff --git a/core/src/conf/VERSION b/core/src/conf/VERSION index 003d6a96fa..1b9fe0a064 100644 --- a/core/src/conf/VERSION +++ b/core/src/conf/VERSION @@ -1 +1 @@ -##VERSION_NUMBER##__##VERSION_DATE##__##REVISION## \ No newline at end of file +##VERSION_NUMBER##__##VERSION_DATE##__##REVISION##__##DB_VERSION## \ No newline at end of file diff --git a/core/src/conf/VERSION.php b/core/src/conf/VERSION.php new file mode 100644 index 0000000000..cccbd03d81 --- /dev/null +++ b/core/src/conf/VERSION.php @@ -0,0 +1,5 @@ +getBaseDir()."/create.sql"); + $res = AJXP_Utils::runCreateTablesQuery($p, $this->getBaseDir()."/create.sql"); + // SET DB VERSION + if(defined('AJXP_VERSION_DB') && AJXP_VERSION_DB != "##DB_VERSION##"){ + require_once(AJXP_BIN_FOLDER."/dibi.compact.php"); + dibi::connect($p); + dibi::query("UPDATE [ajxp_version] SET [db_build]=%i", intval(AJXP_VERSION_DB)); + dibi::disconnect(); + } + return $res; } public function supportsUserTeams() diff --git a/core/src/plugins/conf.sql/create.mysql b/core/src/plugins/conf.sql/create.mysql index 3c16f82135..b03a09a316 100644 --- a/core/src/plugins/conf.sql/create.mysql +++ b/core/src/plugins/conf.sql/create.mysql @@ -87,4 +87,9 @@ CREATE TABLE IF NOT EXISTS ajxp_user_teams ( team_label VARCHAR(255) NOT NULL, owner_id varchar(255) NOT NULL, PRIMARY KEY(team_id, user_id) -) CHARACTER SET utf8 COLLATE utf8_unicode_ci; \ No newline at end of file +) CHARACTER SET utf8 COLLATE utf8_unicode_ci; + +CREATE TABLE IF NOT EXISTS ajxp_version ( + db_build INT NOT NULL +); +INSERT INTO ajxp_version SET db_build=0; \ No newline at end of file diff --git a/core/src/plugins/conf.sql/create.pgsql b/core/src/plugins/conf.sql/create.pgsql index 2b45669d32..bade4ea399 100644 --- a/core/src/plugins/conf.sql/create.pgsql +++ b/core/src/plugins/conf.sql/create.pgsql @@ -89,3 +89,9 @@ CREATE TABLE ajxp_user_teams ( owner_id varchar(255) NOT NULL, PRIMARY KEY(team_id, user_id) ); + +CREATE TABLE ajxp_version ( + db_build INT NOT NULL +); + +INSERT INTO ajxp_version VALUES (0); \ No newline at end of file diff --git a/core/src/plugins/conf.sql/create.sqlite b/core/src/plugins/conf.sql/create.sqlite index 98a93346cf..0c3a9ca38b 100644 --- a/core/src/plugins/conf.sql/create.sqlite +++ b/core/src/plugins/conf.sql/create.sqlite @@ -81,4 +81,10 @@ CREATE TABLE IF NOT EXISTS ajxp_user_teams ( user_id text NOT NULL, team_label text NOT NULL, owner_id text NOT NULL -); \ No newline at end of file +); + +CREATE TABLE IF NOT EXISTS ajxp_version ( + db_build INT NOT NULL +); + +INSERT INTO ajxp_version VALUES (0); \ No newline at end of file