-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update admin codes for new tables
- Loading branch information
1 parent
9c401c0
commit c203f35
Showing
27 changed files
with
255 additions
and
1,618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
DO $$ | ||
BEGIN | ||
IF EXISTS(SELECT 1 FROM feeds) THEN | ||
DELETE FROM feeds; | ||
END IF; | ||
|
||
IF EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name = 'feeds' AND column_name = 'config_id') THEN | ||
ALTER TABLE feeds DROP COLUMN config_id; | ||
END IF; | ||
|
||
IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name = 'feeds' AND column_name = 'adapter_id') THEN | ||
ALTER TABLE feeds ADD COLUMN adapter_id INT8 NOT NULL; | ||
ALTER TABLE feeds ADD CONSTRAINT feeds_adapter_id_fkey FOREIGN KEY(adapter_id) REFERENCES adapters(id) ON DELETE CASCADE; | ||
END IF; | ||
END $$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
DO $$ | ||
BEGIN | ||
IF EXISTS(SELECT 1 FROM feeds) THEN | ||
DELETE FROM feeds; | ||
END IF; | ||
|
||
IF EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name = 'feeds' AND column_name = 'adapter_id') THEN | ||
ALTER TABLE feeds DROP COLUMN adapter_id; | ||
END IF; | ||
|
||
IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name = 'feeds' AND column_name = 'config_id') THEN | ||
ALTER TABLE feeds ADD COLUMN config_id INT8 NOT NULL; | ||
ALTER TABLE feeds ADD CONSTRAINT feeds_config_id_fkey FOREIGN KEY(config_id) REFERENCES configs(id) ON DELETE CASCADE; | ||
END IF; | ||
END $$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
CREATE TABLE IF NOT EXISTS adapters ( | ||
id SERIAL PRIMARY KEY, | ||
name text NOT NULL, | ||
active bool NOT NULL DEFAULT true, | ||
interval int4 NOT NULL DEFAULT 2000, | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS aggregators ( | ||
id SERIAL PRIMARY KEY, | ||
name test NOT NULL, | ||
active bool NOT NULL DEFAULT true, | ||
interval int4 NOT NULL DEFAULT 5000, | ||
) | ||
|
||
CREATE TABLE IF NOT EXISTS submission_addresses ( | ||
id SERIAL PRIMARY KEY, | ||
name text NOT NULL, | ||
address text NOT NULL, | ||
interval int4 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
DROP TABLE IF EXISTS adapters; | ||
DROP TABLE IF EXISTS aggregators; | ||
DROP TABLE IF EXISTS submission_addresses; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.