sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.58k stars 812 forks source link

Access to FOREIGN KEY info #3634

Open delaneyj opened 1 month ago

delaneyj commented 1 month ago

What do you want to change?

Hi, I've been writing a plugin and want to get access to foreign key info

CREATE TABLE articles(
    id INTEGER PRIMARY KEY,
    slug TEXT NOT NULL UNIQUE,
    title TEXT NOT NULL,
    description TEXT NOT NULL,
    body TEXT NOT NULL,
    created_at DATETIME NOT NULL,
    updated_at DATETIME NOT NULL,
    author_id INT NOT NULL,
    FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE
);

I don't see in the pb def how to get that fk info although it's part of the migrations. Please advise!

What database engines need to be changed?

SQLite

What programming language backends need to be changed?

Go

barp commented 1 month ago

I want to have the same for postgres