summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-04 09:34:21 +0300
committerAndrew Dolgov <[email protected]>2021-03-04 09:34:21 +0300
commitcfa706e6fb28e363bf95fa2cf5b210c9064c6fef (patch)
tree24dcc842f993fe7616875e719bcf6f354a6cdd60
parent3c83968584e42966b0e40b2df6b92df8a0bed188 (diff)
use new migrations system to load schema automatically
-rwxr-xr-xinit.php4
-rw-r--r--sql/pgsql/schema.sql (renamed from schema.sql)2
2 files changed, 5 insertions, 1 deletions
diff --git a/init.php b/init.php
index 22871e9..c96e230 100755
--- a/init.php
+++ b/init.php
@@ -15,6 +15,10 @@ class Reddit_Delay extends Plugin {
function init($host) {
$this->host = $host;
+ $migrations = new Db_Migrations();
+ $migrations->initialize_for_plugin($this);
+ $migrations->migrate();
+
$host->add_hook(PluginHost::HOOK_FEED_FETCHED, $this);
$host->add_hook(PluginHost::HOOK_PREFS_TAB, $this);
$host->add_hook(PluginHost::HOOK_PREFS_EDIT_FEED, $this);
diff --git a/schema.sql b/sql/pgsql/schema.sql
index 1b61cf0..f93f596 100644
--- a/schema.sql
+++ b/sql/pgsql/schema.sql
@@ -1,4 +1,4 @@
-drop table ttrss_plugin_reddit_delay_cache;
+drop table if exists ttrss_plugin_reddit_delay_cache;
create table ttrss_plugin_reddit_delay_cache (id serial not null primary key,
feed_id integer not null REFERENCES ttrss_feeds(id) on DELETE cascade,