Skip to content

Commit 2886685

Browse files
author
d34dscene
committed
adjust trigger
1 parent 6dec7be commit 2886685

File tree

7 files changed

+2
-268
lines changed

7 files changed

+2
-268
lines changed

internal/db/db.go

-70
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/db/migrations/00001_init.sql

-12
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,6 @@ CREATE TABLE IF NOT EXISTS agents (
113113
FOREIGN KEY (profile_id) REFERENCES profiles (id) ON DELETE CASCADE
114114
);
115115

116-
-- +goose StatementBegin
117-
CREATE TRIGGER add_profile_config AFTER INSERT ON profiles FOR EACH ROW BEGIN
118-
INSERT INTO
119-
config (profile_id)
120-
VALUES
121-
(NEW.id);
122-
123-
END;
124-
125-
-- +goose StatementEnd
126116
-- +goose StatementBegin
127117
CREATE TRIGGER ensure_single_active_insert BEFORE INSERT ON providers FOR EACH ROW WHEN NEW.is_active = 1 BEGIN
128118
UPDATE providers
@@ -165,8 +155,6 @@ DROP TABLE IF EXISTS settings;
165155

166156
DROP TABLE IF EXISTS agents;
167157

168-
DROP TRIGGER IF EXISTS add_profile_config;
169-
170158
DROP TRIGGER IF EXISTS ensure_single_active_insert;
171159

172160
DROP TRIGGER IF EXISTS ensure_single_active_update;

internal/db/migrations/00002_entrypoints.sql

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
-- +goose StatementBegin
33
DROP TABLE IF EXISTS config;
44

5+
DROP TRIGGER IF EXISTS add_profile_config;
6+
57
CREATE TABLE IF NOT EXISTS entrypoints (
68
profile_id INTEGER NOT NULL,
79
name VARCHAR(255) NOT NULL,

internal/db/models.go

-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/db/querier.go

-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/db/query.sql

-33
Original file line numberDiff line numberDiff line change
@@ -64,33 +64,6 @@ DELETE FROM profiles
6464
WHERE
6565
name = ?;
6666

67-
-- name: GetConfigByProfileID :one
68-
SELECT
69-
*
70-
FROM
71-
config
72-
WHERE
73-
profile_id = ?
74-
LIMIT
75-
1;
76-
77-
-- name: GetConfigByProfileName :one
78-
SELECT
79-
*
80-
FROM
81-
config
82-
WHERE
83-
profile_id = (
84-
SELECT
85-
id
86-
FROM
87-
profiles
88-
WHERE
89-
name = ?
90-
)
91-
LIMIT
92-
1;
93-
9467
-- name: ListEntryPoints :many
9568
SELECT
9669
*
@@ -129,12 +102,6 @@ WHERE
129102
)
130103
AND entrypoints.name = ?;
131104

132-
-- name: ListConfigs :many
133-
SELECT
134-
*
135-
FROM
136-
config;
137-
138105
-- name: GetRouterByID :one
139106
SELECT
140107
*

0 commit comments

Comments
 (0)