Skip to content

Commit d5e023a

Browse files
authored
Merge pull request #24 from p369349074/main
update indicator code to match new version
2 parents afa653c + fbd1885 commit d5e023a

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

backend_api_python/migrations/init.sql

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -276,31 +276,37 @@ CREATE INDEX IF NOT EXISTS idx_notifications_is_read ON qd_strategy_notification
276276
-- =============================================================================
277277

278278
CREATE TABLE IF NOT EXISTS qd_indicator_codes (
279-
id SERIAL PRIMARY KEY,
280-
user_id INTEGER NOT NULL DEFAULT 1 REFERENCES qd_users(id) ON DELETE CASCADE,
281-
is_buy INTEGER NOT NULL DEFAULT 0,
282-
end_time BIGINT NOT NULL DEFAULT 1,
283-
name VARCHAR(255) NOT NULL DEFAULT '',
284-
code TEXT,
285-
description TEXT DEFAULT '',
286-
publish_to_community INTEGER NOT NULL DEFAULT 0,
287-
pricing_type VARCHAR(20) NOT NULL DEFAULT 'free',
288-
price DECIMAL(10,2) NOT NULL DEFAULT 0,
289-
is_encrypted INTEGER NOT NULL DEFAULT 0,
290-
preview_image VARCHAR(500) DEFAULT '',
291-
-- Review status fields (for admin review feature)
292-
review_status VARCHAR(20) DEFAULT 'approved', -- pending/approved/rejected
293-
review_note TEXT DEFAULT '',
294-
reviewed_at TIMESTAMP,
295-
reviewed_by INTEGER,
296-
createtime BIGINT,
297-
updatetime BIGINT,
298-
created_at TIMESTAMP DEFAULT NOW(),
299-
updated_at TIMESTAMP DEFAULT NOW()
279+
id serial4 NOT NULL,
280+
user_id int4 DEFAULT 1 NOT NULL,
281+
is_buy int4 DEFAULT 0 NOT NULL,
282+
end_time int8 DEFAULT 1 NOT NULL,
283+
name varchar(255) DEFAULT ''::character varying NOT NULL,
284+
code text NULL,
285+
description text DEFAULT ''::text NULL,
286+
publish_to_community int4 DEFAULT 0 NOT NULL,
287+
pricing_type varchar(20) DEFAULT 'free'::character varying NOT NULL,
288+
price numeric(10, 2) DEFAULT 0 NOT NULL,
289+
is_encrypted int4 DEFAULT 0 NOT NULL,
290+
preview_image varchar(500) DEFAULT ''::character varying NULL,
291+
createtime int8 NULL,
292+
updatetime int8 NULL,
293+
created_at timestamp DEFAULT now(),
294+
updated_at timestamp DEFAULT now(),
295+
purchase_count int4 DEFAULT 0 NULL,
296+
avg_rating numeric(3, 2) DEFAULT 0 NULL,
297+
rating_count int4 DEFAULT 0 NULL,
298+
view_count int4 DEFAULT 0 NULL,
299+
review_status varchar(20) DEFAULT 'approved'::character varying NULL,
300+
review_note text DEFAULT ''::text NULL,
301+
reviewed_at timestamp NULL,
302+
reviewed_by int4 NULL,
303+
CONSTRAINT qd_indicator_codes_pkey PRIMARY KEY (id),
304+
CONSTRAINT qd_indicator_codes_user_id_fkey FOREIGN KEY (user_id) REFERENCES qd_users(id) ON DELETE CASCADE
305+
300306
);
301307

302-
CREATE INDEX IF NOT EXISTS idx_indicator_codes_user_id ON qd_indicator_codes(user_id);
303-
CREATE INDEX IF NOT EXISTS idx_indicator_review_status ON qd_indicator_codes(review_status);
308+
CREATE INDEX IF NOT EXISTS idx_indicator_codes_user_id ON qd_indicator_codes USING btree (user_id);
309+
CREATE INDEX IF NOT EXISTS idx_indicator_review_status ON qd_indicator_codes USING btree (review_status);
304310

305311
-- =============================================================================
306312
-- 8. AI Decisions

0 commit comments

Comments
 (0)