mirror of
https://github.com/safishamsi/graphify.git
synced 2026-07-12 18:37:12 +00:00
7d604e8141
- extract_sql(): deterministic tree-sitter extraction of tables, views, functions, foreign key references, and FROM/JOIN reads_from edges - .sql added to CODE_EXTENSIONS and dispatch table - tree-sitter-sql added as optional dep under [sql] extra - xlsx_extract_structure(): extracts sheet/table/column nodes from .xlsx (utility — pipeline wiring in follow-up) - 6 new SQL tests, 447 total passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
417 B
PL/PgSQL
20 lines
417 B
PL/PgSQL
CREATE TABLE organizations (
|
|
id SERIAL PRIMARY KEY,
|
|
name TEXT NOT NULL
|
|
);
|
|
|
|
CREATE TABLE users (
|
|
id SERIAL PRIMARY KEY,
|
|
email TEXT NOT NULL,
|
|
org_id INT REFERENCES organizations(id)
|
|
);
|
|
|
|
CREATE VIEW active_users AS
|
|
SELECT * FROM users WHERE active = true;
|
|
|
|
CREATE FUNCTION get_user(user_id INT) RETURNS users AS $$
|
|
BEGIN
|
|
RETURN QUERY SELECT * FROM users WHERE id = user_id;
|
|
END;
|
|
$$ LANGUAGE plpgsql;
|